summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2022-04-21 18:08:36 (GMT)
committerGitHub <noreply@github.com>2022-04-21 18:08:36 (GMT)
commitd44815cabc0a8d9932df2fa95cb374eadddb7c17 (patch)
tree12cd641cbd5b32d20983b5edb7ac650ea85a434a /Lib
parent5974827c71d884bb3cc58f07a9eaefafe0cbaa6e (diff)
downloadcpython-d44815cabc0a8d9932df2fa95cb374eadddb7c17.zip
cpython-d44815cabc0a8d9932df2fa95cb374eadddb7c17.tar.gz
cpython-d44815cabc0a8d9932df2fa95cb374eadddb7c17.tar.bz2
GH-88116: Document that PyCodeNew is dangerous, and make PyCode_NewEmpty less dangerous. (GH-91790)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_code.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/test/test_code.py b/Lib/test/test_code.py
index a37ebd2..1bb138e 100644
--- a/Lib/test/test_code.py
+++ b/Lib/test/test_code.py
@@ -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):