8000 gh-98393: os module reject bytes-like, only accept bytes by vstinner · Pull Request #98394 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 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
Prev Previous commit
Update test_compile and test_symtable
  • Loading branch information
vstinner committed Oct 18, 2022
commit f88a1ae392ce837dcc6ef3b9fb97c79459840a2c
5 changes: 2 additions & 3 deletions Lib/test/test_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,8 @@ def test_compile_filename(self):
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
Expand Down
5 changes: 2 additions & 3 deletions Lib/test/test_symtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,9 @@ def checkfilename(brokencode, offset):
checkfilename("def f(x): foo)(", 14) # parse-time
checkfilename("def f(x): global x", 11) # symtable-build-time
symtable.symtable("pass", b"spam", "exec")
with self.assertWarns(DeprecationWarning), \
self.assertRaises(TypeError):
with self.assertRaises(TypeError):
symtable.symtable("pass", bytearray(b"spam"), "exec")
with self.assertWarns(DeprecationWarning):
with self.assertRaises(TypeError):
symtable.symtable("pass", memoryview(b"spam"), "exec")
with self.assertRaises(TypeError):
symtable.symtable("pass", list(b"spam"), "exec")
Expand Down
0