mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded as
an iterable of integers. Now only strings and byte-like objects are accepted.
This commit is contained in:
parent
bae5d81f5d
commit
9305d83425
6 changed files with 62 additions and 1 deletions
|
@ -472,6 +472,13 @@ if 1:
|
|||
d = {f(): f(), f(): f()}
|
||||
self.assertEqual(d, {1: 2, 3: 4})
|
||||
|
||||
def test_compile_filename(self):
|
||||
for filename in ('file.py', b'file.py',
|
||||
bytearray(b'file.py'), memoryview(b'file.py')):
|
||||
code = compile('pass', filename, 'exec')
|
||||
self.assertEqual(code.co_filename, 'file.py')
|
||||
self.assertRaises(TypeError, compile, 'pass', list(b'file.py'), 'exec')
|
||||
|
||||
@support.cpython_only
|
||||
def test_same_filename_used(self):
|
||||
s = """def f(): pass\ndef g(): pass"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue