mirror of
https://github.com/python/cpython.git
synced 2025-10-05 14:41:07 +00:00
[3.6] bpo-13617: Reject embedded null characters in wchar* strings. (GH-2302) (#2462)
Based on patch by Victor Stinner.
Add private C API function _PyUnicode_AsUnicode() which is similar to
PyUnicode_AsUnicode(), but checks for null characters..
(cherry picked from commit f7eae0adfc
)
This commit is contained in:
parent
413c0a92bc
commit
0834905d9b
22 changed files with 115 additions and 24 deletions
|
@ -314,6 +314,10 @@ class ImportTests(unittest.TestCase):
|
|||
loader.get_data(imp.__file__) # File should be closed
|
||||
loader.get_data(imp.__file__) # Will need to create a newly opened file
|
||||
|
||||
def test_load_source(self):
|
||||
with self.assertRaisesRegex(ValueError, 'embedded null'):
|
||||
imp.load_source(__name__, __file__ + "\0")
|
||||
|
||||
|
||||
class ReloadTests(unittest.TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue