GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||
GeezerVison is showing github.com — gh-98393: os module reject bytes-like, only accept bytes by vstinner · Pull Request #98394 · python/cpython Conversation
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The os module and the PyUnicode_FSDecoder() function no longer accept bytes-like paths, like bytearray and memoryview types: only the exact bytes type is accepted for bytes strings.
|
Merged, thanks for the review @methane! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM besides few tests nitpicks.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| for name in filenames: | ||
| try: | ||
| if isinstance(name, (str, bytes)): | ||
| if not isinstance(name, (str, bytes)): |
There was a problem 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 the filename attribute of OSError.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| self.assertIs(type(entry.name), bytes) | ||
| self.assertIs(type(entry.path), bytes) | ||
| with self.assertRaises(TypeError): | ||
| list(os.scandir(path_bytes)) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
list() is redundant here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Since this PR is already merged, I created #98487 to take your review in account. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.