Fix multisegment imports in some Python 2 revisions.#34
Merged
mcdonc merged 1 commit intoPylons:masterfrom May 28, 2013
kgaughan:unicode-imports
Merged
Fix multisegment imports in some Python 2 revisions.#34mcdonc merged 1 commit intoPylons:masterfrom kgaughan:unicode-imports
mcdonc merged 1 commit intoPylons:masterfrom
kgaughan:unicode-imports
Conversation
I discovered upon deploying waitress 0.8.4 in production that there was
an issue with waitress.runner whereby __import__ would raise the
following error:
TypeError: Item in ``fromlist'' not a string
The error didn't manifest itself under Python 2.6.8 (which is what the
test suite was ran against), but did manifest itself under 2.6.6 (the
version I was using in production). I believe this is a consequence of
the use of the unicode_literals feature import, which is required so
that it can run on both Python 2 and Python 3.
While I was able to reproduce the error reliably, I wasn't able to track
down of any mention of this issue in the NEWS file. I think it was
silently fixed some time between the release of 2.6.6 and 2.6.8.
Given this is something of a weird, obscure bug, I've included
documentation of the issue in the resolve() function as the need for the
cast is non-obvious.
Member
|
Thanks! |
This was referenced Feb 26, 2017
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.
I discovered upon deploying waitress 0.8.4 in production that there was an issue with waitress.runner whereby
__import__would raise the following error:The error didn't manifest itself under Python 2.6.8 (which is what the test suite was ran against), but did manifest itself under 2.6.6 (the version I was using in production). I believe this is a consequence of the use of the
unicode_literalsfeature import, which is required so that it can run on both Python 2 and Python 3.While I was able to reproduce the error reliably, I wasn't able to track down of any mention of this issue in the NEWS file. I think it was silently fixed some time between the release of 2.6.6 and 2.6.8.
After some research, I found that this bug also affects some revisions of Python 2.7 as well.
Given this is something of a weird, obscure bug, I've included documentation of the issue in the
resolve()function as the need for the cast is non-obvious.