GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||
GeezerVison is showing github.com — gh-75223: Reject undotted extensions in `mimetypes.add_type()` by OddBloke · Pull Request #2895 · python/cpython Conversation
|
|
I've opened this now to get feedback on whether this is an appropriate change to make. Does it need a warning first, before it becomes the default behaviour? (At a minimum, I would expect to need to add to documentation.) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
As said in https://bugs.python.org/issue31040, please use There is one case where it works without a dot: And someone may have used it to distinguish between emptyness and type not found. What I propose: Emit a warning in case the ext is empty, else ValueError in case the type does not start with a dot, to ensure we're not breaking any code. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Extensions that don't start with a dot will never be found by methods/functions that act on the registry, so we should stop users from mistakenly adding them. The one exception is the empty string extension. This could be in use to detect absent extensions, so instead of raising a ValueError we emit a warning.
b92d271 to
1485be9
Compare
|
I have made the requested changes; please review again. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for making the requested changes! @JulienPalard: please review the changes made to this pull request. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase And if you don't make the requested changes, you will be put in the comfy chair! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
IMO, this is a backwards-incompatible change and should be deprecated with a warning, and documented. (For example, if |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks, please see #128638 to deprecate it first, and I've marked this as a draft until it's ready for merge. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
It was deprecated and scheduled for 3.16, so it's time! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Documentation build overview
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
mimetypes.add_type()
|
|
||
| .. function:: add_type(type, ext, strict=True) | ||
|
|
||
| Add a mapping from the MIME type *type* to the extension *ext*. When the |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This should have the same "Valid extensions start with a '.' or are empty." note IMO, but it wasn't updated before?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Completed in #149721. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.