-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
bpo-37144: Convert path-like object to regular path #13817
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7cfe617
Convert path-like object to regular path
0x29a a307164
📜🤖 Added by blurb_it.
blurb-it[bot] 9d34011
Replace os.path.abspath with os.fspath and add test
0x29a cd73f1e
Change os.path.abspath on os.fspath
0x29a cb85402
Perform open check against temp tar file
0x29a dd30c0d
Remove unused variable
0x29a 82882dd
Perform os.path.abspath to result of os.fspath, use context manager
0x29a 14ae149
Convert path object to raw path for all usages
0x29a 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
Change os.path.abspath on os.fspath
- Loading branch information
commit cd73f1e9782a0b594e769ef12dfc7ad546a35329
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1468,7 +1468,7 @@ def __init__(self, name=None, mode="r", fileobj=None, format=None, | |
if hasattr(fileobj, "mode"): | ||
self._mode = fileobj.mode | ||
self._extfileobj = True | ||
self.name = os.path.abspath(name) if name else None | ||
self.name = os.fspath(name) if name else None | ||
self.fileobj = fileobj | ||
|
||
# Init attributes. | ||
|
@@ -1943,7 +1943,7 @@ def add(self, name, arcname=None, recursive=True, *, filter=None): | |
arcname = name | ||
|
||
# Skip if somebody tries to archive the archive... | ||
if self.name is not None and os.path.abspath(name) == self.name: | ||
if self.name is not None and os.fspath(name) == self.name: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the same |
||
self._dbg(2, "tarfile: Skipped %r" % name) | ||
return | ||
|
||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these lines are not equal.
The correct code should be something like:
I've skipped the check for empty/None name.