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

gh-98393: os module reject bytes-like, only accept bytes#98394

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
vstinner merged 2 commits intopython:mainfromvstinner:remove_os_buffer
Oct 18, 2022
Merged

gh-98393: os module reject bytes-like, only accept bytes#98394

vstinner merged 2 commits intopython:mainfromvstinner:remove_os_buffer
Oct 18, 2022

Conversation

vstinner
Copy link
Member

@vstinnervstinner commentedOct 18, 2022
edited by bedevere-bot
Loading

The os module no longer accepts bytes-like paths, like bytearray and memoryview types: only the exact bytes type is accepted for bytes strings.

@vstinner
Copy link
MemberAuthor

The os module and the PyUnicode_FSDecoder() function no longer acceptbytes-like paths, like bytearray and memoryview types: only the exactbytes type is accepted for bytes strings.
@vstinnervstinner merged commitdb03c80 intopython:mainOct 18, 2022
@vstinnervstinner deleted the remove_os_buffer branchOctober 18, 2022 15:52
@vstinner
Copy link
MemberAuthor

Merged, thanks for the review@methane!

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM besides few tests nitpicks.

@@ -3860,18 +3860,18 @@ def test_oserror_filename(self):

for filenames, func, *func_args in funcs:
for name in filenames:
try:
if isinstance(name, (str, bytes)):
if not isinstance(name, (str, bytes)):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I would move these cases into separate test. It is not anymore about thefilename attribute of OSError.

self.assertIs(type(entry.name), bytes)
self.assertIs(type(entry.path), bytes)
with self.assertRaises(TypeError):
list(os.scandir(path_bytes))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

list() is redundant here.

@vstinner
Copy link
MemberAuthor

LGTM besides few tests nitpicks.

Since this PR is already merged, I created#98487 to take your review in account.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@serhiy-storchakaserhiy-storchakaserhiy-storchaka left review comments

@methanemethanemethane approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@vstinner@methane@serhiy-storchaka@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp