mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-98393: os module reject bytes-like, only accept bytes (#98394)
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.
This commit is contained in:
parent
9da5215000
commit
db03c8066a
9 changed files with 48 additions and 89 deletions
|
@ -494,9 +494,8 @@ if 1:
|
|||
code = compile('pass', filename, 'exec')
|
||||
self.assertEqual(code.co_filename, 'file.py')
|
||||
for filename in bytearray(b'file.py'), memoryview(b'file.py'):
|
||||
with self.assertWarns(DeprecationWarning):
|
||||
code = compile('pass', filename, 'exec')
|
||||
self.assertEqual(code.co_filename, 'file.py')
|
||||
with self.assertRaises(TypeError):
|
||||
compile('pass', filename, 'exec')
|
||||
self.assertRaises(TypeError, compile, 'pass', list(b'file.py'), 'exec')
|
||||
|
||||
@support.cpython_only
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue