mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
GH-88116: Document that PyCodeNew is dangerous, and make PyCode_NewEmpty less dangerous. (GH-91790)
This commit is contained in:
parent
5974827c71
commit
d44815cabc
4 changed files with 39 additions and 7 deletions
|
@ -176,6 +176,9 @@ class CodeTest(unittest.TestCase):
|
|||
self.assertEqual(co.co_filename, "filename")
|
||||
self.assertEqual(co.co_name, "funcname")
|
||||
self.assertEqual(co.co_firstlineno, 15)
|
||||
#Empty code object should raise, but not crash the VM
|
||||
with self.assertRaises(Exception):
|
||||
exec(co)
|
||||
|
||||
@cpython_only
|
||||
def test_closure_injection(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue