[3.8] bpo-4963: Fix for initialization and non-deterministic behavior issues in mimetypes (GH-3062)#14375
Merged
zooba merged 1 commit intopython:3.8from Jun 25, 2019
Merged
Conversation
The-Compiler
added a commit
to qutebrowser/qutebrowser
that referenced
this pull request
Jan 4, 2021
Python 3.6 gets some of those "wrong": https://bugs.python.org/issue1043134 This has been fixed in Python 3.7: python/cpython#14375 The override dict has been generated by copying the types_map from the current git master: https://github.com/python/cpython/blob/v3.10.0a3/Lib/mimetypes.py#L414-L547 And then running the following with Python 3.6: import mimetypes reverse = {} for ext, mimetype in types_map.items(): if mimetype not in reverse: reverse[mimetype] = ext assert reverse['text/plain'] == '.txt' for mimetype, ext in reverse.items(): got = mimetypes.guess_extension(mimetype) if got != ext: print(f' "{mimetype}": "{ext}", # not {got}')
The-Compiler
added a commit
to qutebrowser/qutebrowser
that referenced
this pull request
Jan 5, 2021
Python 3.6 gets some of those "wrong": https://bugs.python.org/issue1043134 This has been fixed in Python 3.7: python/cpython#14375 The override dict has been generated by copying the types_map from the current git master: https://github.com/python/cpython/blob/v3.10.0a3/Lib/mimetypes.py#L414-L547 And then running the following with Python 3.6: import mimetypes reverse = {} for ext, mimetype in types_map.items(): if mimetype not in reverse: reverse[mimetype] = ext assert reverse['text/plain'] == '.txt' for mimetype, ext in reverse.items(): got = mimetypes.guess_extension(mimetype) if got != ext: print(f' "{mimetype}": "{ext}", # not {got}')
jugmac00
pushed a commit
to jugmac00/launchpad
that referenced
this pull request
Dec 5, 2022
Python 3.8 slightly changed how the `mimetypes` module is initialized (python/cpython#14375), and this interacted badly with the reinitialization code in `zope.contenttype` in such a way as to make the extensions in `lp.services.mime` be ineffective. Work around this in a way that works with both old and new versions of Python by monkey-patching `mimetypes.init`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://bugs.python.org/issue4963