]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-132775: Add _PyCode_GetScriptXIData() (gh-133676)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 8 May 2025 16:05:34 +0000 (18:05 +0200)
committerGitHub <noreply@github.com>
Thu, 8 May 2025 16:05:34 +0000 (10:05 -0600)
commit10595486860aa054c9d7ad236cc50064e7b800d5
treea9163a4549d8e58e2fa09ed07f9034268de878b3
parentdc1a4dda88637d551d0be26632186be10343b098
[3.14] gh-132775: Add _PyCode_GetScriptXIData() (gh-133676)

This converts functions, code, str, bytes, bytearray, and memoryview objects to PyCodeObject,
and ensure that the object looks like a script.  That means no args, no return, and no closure.
_PyCode_GetPureScriptXIData() takes it a step further and ensures there are no globals.

We also add _PyObject_SupportedAsScript() to the internal C-API.

(cherry picked from commit c81fa2b9cd1ed4d4ff5c13984d6582c27e5f2633, AKA gh-133480)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
Include/internal/pycore_crossinterp.h
Include/internal/pycore_pythonrun.h
Lib/test/_code_definitions.py
Lib/test/test_code.py
Lib/test/test_crossinterp.py
Modules/_testinternalcapi.c
Python/crossinterp.c
Python/pythonrun.c