]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-121921: Make bogus_code_obj.py crash the interpreter (#121922)
authorJelle Zijlstra <jelle.zijlstra@gmail.com>
Thu, 18 Jul 2024 08:02:08 +0000 (01:02 -0700)
committerGitHub <noreply@github.com>
Thu, 18 Jul 2024 08:02:08 +0000 (04:02 -0400)
Lib/test/crashers/bogus_code_obj.py
Misc/NEWS.d/next/Tests/2024-07-17-08-25-06.gh-issue-121921.HW8CIS.rst [new file with mode: 0644]

index e71b3582cf2d7611801945efd7f9b8bbaa25dda4..b3ff07995c95ed44e7027e63a273abbac4cf8ef8 100644 (file)
@@ -12,8 +12,8 @@ the user build or load random bytecodes anyway.  Otherwise, this is a
 
 """
 
-import types
+def f():
+    pass
 
-co = types.CodeType(0, 0, 0, 0, 0, 0, b'\x04\x00\x71\x00',
-                    (), (), (), '', '', 1, b'')
-exec(co)
+f.__code__ = f.__code__.replace(co_code=b"")
+f()
diff --git a/Misc/NEWS.d/next/Tests/2024-07-17-08-25-06.gh-issue-121921.HW8CIS.rst b/Misc/NEWS.d/next/Tests/2024-07-17-08-25-06.gh-issue-121921.HW8CIS.rst
new file mode 100644 (file)
index 0000000..ef14fa9
--- /dev/null
@@ -0,0 +1,2 @@
+Update ``Lib/test/crashers/bogus_code_obj.py`` so that it crashes properly
+again.