-
-
Notifications
You must be signed in to change notification settings - Fork 49
Release handle on zipfile when generating path in ZipReader #194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
9992a54
Add test capturing deleting zips. From python/cpython#21748.
jaraco 87361b1
👹 Feed the hobgoblins (delint).
jaraco 5d047c9
Ensure unlink gets fspath treatment
jaraco 922871b
Add Python 2.7 compatibility for modules_setup/cleanup
jaraco 6ab2b58
Defer construction of the zipfile.Path and release the handle after g…
jaraco 01a2ed4
Try sleeping to see if that gives gc time to clean up and close the z…
jaraco 0410114
Also delete references to reader in _path_from_reader
jaraco e838d1b
Also delete the reader in _tempfile
jaraco f661cb4
This approach begins to work, but it requires as_file to be aware of …
jaraco 4657df7
Remove unnecessary context managers.
jaraco eb8570c
Refactor _path_from_reader to avoid introduction of extraneous contex…
jaraco b080948
Skip this test, because it's difficult to achieve.
jaraco 0fae833
Ignore types on compatibility objects
jaraco f85c3e1
Fix posargs for cov, diffcov
jaraco c929cbc
Exclude zip files from coverage so Delete tests don't trip up coverage.
jaraco 9b018ff
Consolidate import_helper functions.
jaraco 522f271
Update changelog.
jaraco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
try: | ||
from test.support import import_helper # type: ignore | ||
except ImportError: | ||
try: | ||
# Python 3.9 and earlier | ||
class import_helper: # type: ignore | ||
from test.support import modules_setup, modules_cleanup | ||
except ImportError: | ||
from . import py27compat | ||
|
||
class import_helper: # type: ignore | ||
modules_setup = staticmethod(py27compat.modules_setup) | ||
modules_cleanup = staticmethod(py27compat.modules_cleanup) | ||
|
||
|
||
try: | ||
from os import fspath # type: ignore | ||
except ImportError: | ||
# Python 3.5 | ||
fspath = str # type: ignore | ||
|
||
|
||
try: | ||
# Python 3.10 | ||
from test.support.os_helper import unlink | ||
except ImportError: | ||
from test.support import unlink as _unlink | ||
|
||
def unlink(target): | ||
return _unlink(fspath(target)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import sys | ||
|
||
|
||
def modules_setup(): | ||
return sys.modules.copy(), | ||
|
||
|
||
def modules_cleanup(oldmodules): | ||
# Encoders/decoders are registered permanently within the internal | ||
# codec cache. If we destroy the corresponding modules their | ||
# globals will be set to None which will trip up the cached functions. | ||
encodings = [(k, v) for k, v in sys.modules.items() | ||
if k.startswith('encodings.')] | ||
sys.modules.clear() | ||
sys.modules.update(encodings) | ||
# XXX: This kind of problem can affect more than just encodings. | ||
# In particular extension modules (such as _ssl) don't cope | ||
# with reloading properly. Really, test modules should be cleaning | ||
# out the test specific modules they know they added (ala test_runpy) | ||
# rather than relying on this function (as test_importhooks and test_pkg | ||
# do currently). Implicitly imported *real* modules should be left alone | ||
# (see issue 10556). | ||
sys.modules.update(oldmodules) |
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.