Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[3.11] GH-88013: Fix TypeError raised by ntpath.realpath in some cases (GH-102813)#103343

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
NextNext commit
GH-88013: Fix TypeError raised by ntpath.realpath in some cases (GH-1…
…02813)(cherry picked from commit4dc339b)Co-authored-by: AN Long <aisk@users.noreply.github.com>
  • Loading branch information
@aisk@miss-islington
aisk authored andmiss-islington committedApr 7, 2023
commit2ce0330b84d5ef5759dd22a233a607609ce318c5
2 changes: 1 addition & 1 deletionLib/ntpath.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -644,7 +644,7 @@ def _getfinalpathname_nonstrict(path):

# Non-strict algorithm is to find as much of the target directory
# as we can and join the rest.
tail =''
tail =path[:0]
while path:
try:
path = _getfinalpathname(path)
Expand Down
7 changes: 7 additions & 0 deletionsLib/test/test_ntpath.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
import ntpath
import os
import string
import sys
import unittest
import warnings
Expand DownExpand Up@@ -321,6 +322,12 @@ def test_realpath_basic(self):
self.assertPathEqual(ntpath.realpath(os.fsencode(ABSTFN + "1")),
os.fsencode(ABSTFN))

# gh-88013: call ntpath.realpath with binary drive name may raise a
# TypeError. The drive should not exist to reproduce the bug.
drives = {f"{c}:\\" for c in string.ascii_uppercase} - set(os.listdrives())
d = drives.pop().encode()
self.assertEqual(ntpath.realpath(d), d)

@os_helper.skip_unless_symlink
@unittest.skipUnless(HAVE_GETFINALPATHNAME, 'need _getfinalpathname')
def test_realpath_strict(self):
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
Fixed a bug where :exc:`TypeError` was raised when calling
:func:`ntpath.realpath` with a bytes parameter in some cases.

[8]ページ先頭

©2009-2025 Movatter.jp