Avoid possible infinite recursion when writing pyc files in assert rewrite#3895
Merged
nicoddemus merged 1 commit intopytest-dev:masterfrom Aug 28, 2018
Merged
Avoid possible infinite recursion when writing pyc files in assert rewrite#3895nicoddemus merged 1 commit intopytest-dev:masterfrom
nicoddemus merged 1 commit intopytest-dev:masterfrom
Conversation
…write What happens is that atomic_write on Python 2.7 on Windows will try to convert the paths to unicode, but this triggers the import of the encoding module for the file system codec, which in turn triggers the rewrite, which in turn again tries to import the module, and so on. This short-circuits the cases where we try to import another file when writing a pyc file; I don't expect this to affect anything because the only modules that could be affected are those imported by atomic_writes. Fix pytest-dev#3506
Contributor
|
@nicoddemus thank you for your quick response! I'm glad our cookiecutter could be the test. |
13 tasks
Contributor
|
It looks like GitHub was unavailable during some of this test run. Would a maintainer please restart the job? |
Member
Author
|
@stevepiercy thanks for the ping, restarted it! |
Codecov Report
@@ Coverage Diff @@
## master #3895 +/- ##
==========================================
+ Coverage 92.58% 92.63% +0.05%
==========================================
Files 51 51
Lines 9960 9966 +6
==========================================
+ Hits 9221 9232 +11
+ Misses 739 734 -5
Continue to review full report at Codecov.
|
Member
Author
|
All good now. 👍 |
stevepiercy
approved these changes
Aug 28, 2018
blueyed
approved these changes
Aug 28, 2018
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.
What happens is that atomic_write on Python 2.7 on Windows will try
to convert the paths to unicode, but this triggers the import of
the encoding module for the file system codec, which in turn triggers
the rewrite, which in turn again tries to import the module, and so on.
This short-circuits the cases where we try to import another file when
writing a pyc file; I don't expect this to affect anything because
the only modules that could be affected are those imported by
atomic_writes.
The fix has been tested in an actual repository showing the problem: Pylons/pyramid-cookiecutter-starter#56
Fix #3506