[3.15] gh-158445: Add C API tests on build information functions (#159515)
* gh-158445: Add C API tests on build information functions (#158603)
Add tests on functions:
* Py_GetBuildInfo()
* Py_GetCompiler()
* Py_GetCopyright()
* Py_GetPlatform()
* Py_GetVersion()
Changes:
* Add Modules/_testlimitedcapi.c and
Lib/test/test_capi/test_build.py files.
* Add internal _Py_GetBuiltWithAssert() function.
* Reimplemenet support.built_with_c_assertions() using
_Py_GetBuiltWithAssert() to cover more cases like buildbots using
CFLAGS=-UNDEBUG in release mode.
(cherry picked from commit a831abba14)
* gh-155742: Add support.built_with_c_assertions() (#156776)
(cherry picked from commit c700121b15)
---------
(cherry picked from commit cb7a629f4d)
Co-authored-by: Stan Ulbrych <stan@python.org>
gh-159113: Update `PCBuild/find_python.bat` to allow discovery of Python 3.14 and 3.15 (GH-159114)
(cherry picked from commit 9c15cc9d69)
Co-authored-by: Wulian233 <1055917385@qq.com>
[3.15] gh-155503: Add more PyType C API tests (#155505) (#159085)
gh-155503: Add more PyType C API tests (#155505)
Add tests on functions:
* PyType_ClearCache()
* PyType_GetFlags()
* PyType_IsSubtype()
* PyType_Ready()
Move PyType limited C API tests from _testcapi to _testlimitedcapi.
Add a new Modules/_testlimitedcapi/type.c file.
(cherry picked from commit 29837a952c)
(cherry picked from commit 18c00673aa)
Test PySlice_Check(), PySlice_New(), PySlice_GetIndices(), PySlice_Unpack(),
PySlice_AdjustIndices() and PySlice_GetIndicesEx() -- both the macro and the
deprecated function.
Document the length and step precondition of PySlice_AdjustIndices()
(cherry picked from commit 8c056c33aa)
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Add _testcapi helpers to create a capsule with an arbitrary name and to call PyCapsule_Import(), and Python tests covering the current behavior: only the first component of the dotted name is imported, the rest are attribute lookups.
(cherry picked from commit d24d9d0f1d)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
gh-152132: Test Py_CompileString() in test_capi.test_run (#153470)
PyRun functions now raises ValueError if the start argument is
invalid.
Add Modules/_testlimitedcapi/run.c.
(cherry picked from commit d83d26724b)
GH-141808: Do not generate the jit stencils twice in case of PGO builds on Windows. (GH-142043)
* do not build the jit stencils twice in case of PGO builds on Windows
* blurb it
(cherry picked from commit f2ca1581ca)
Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
gh-139573: Update Windows builds to use OpenSSL 3.0.18 (GH-139574)
(cherry picked from commit 063cef9999)
Co-authored-by: Zachary Ware <zach@python.org>
gh-136421: Load `_datetime` static types during interpreter initialization (GH-136583)
`_datetime` is a special module, because it's the only non-builtin C extension that contains static types. As such, it would initialize static types in the module's execution function, which can run concurrently. Since static type initialization is not thread-safe, this caused crashes. This fixes it by moving the initialization of `_datetime`'s static types to interpreter startup (where all other static types are initialized), which is already properly protected through other locks.
(cherry picked from commit a10960699a)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Rename undocumented `HACL_CAN_COMPILE_SIMD{128,256}` macros
to `_Py_HACL_CAN_COMPILE_VEC{128,256}`. These macros are private.
(cherry picked from commit 1e975aee28)
(cherry picked from commit e9d845b41d)
Includes fix for off-by-one error from GH-134867
(cherry-picked from commit e64395e8eb)
Co-authored-by: Emma Smith <emma@emmatyping.dev>
Extension builders must specify Py_GIL_DISABLED if they want to link to the free-threaded builds.
This was usually the case already, but this change guarantees it in all circumstances.
Make `warnings.catch_warnings()` use a context variable for holding
the warning filtering state if the `sys.flags.context_aware_warnings`
flag is set to true. This makes using the context manager thread-safe in
multi-threaded programs.
Add the `sys.flags.thread_inherit_context` flag. If true, starting a new
thread with `threading.Thread` will use a copy of the context
from the caller of `Thread.start()`.
Both these flags are set to true by default for the free-threaded build
and false for the default build.
Move the Python implementation of warnings.py into _py_warnings.py.
Make _contextvars a builtin module.
Co-authored-by: Kumar Aditya <kumaraditya@python.org>