98 Commits
Author SHA1 Message Date
cb7a629f4d [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)

Co-authored-by: Stan Ulbrych <[email protected]>
(cherry picked from commit c700121b15)

---------

Co-authored-by: Stan Ulbrych <[email protected]>
2026-10-16 11:15:23 +00:00
Victor StinnerandGitHub 364db5df08 [3.15] gh-157649: Merge test_cppext into test_cext (#158176) (#159264)
* test_cext now uses a single virtual environment for all tests.
  It makes the test way faster since creating a virtual environment
  is quite slow.
* Add Py_TARGET_ABI3T test on C++.
* Move macro tests from module exec function to test_macros().
* Call Py_BEGIN_CRITICAL_SECTION() on a fresh dictionary object,
  rather than on the module.
* Rename some environment variables to always use "CPYTHON_TEST_"
  prefix.
* Replace support.MS_WINDOWS with MSVC to be more explicit.
* Move macro tests to test_macros().
* On macOS, use C++11 by default.

(cherry picked from commit b71989d657)
2026-10-13 00:21:22 +02:00
6411ac7d84 [3.15] Add os.supports_dir_fd to test.pythoninfo (GH-158605) (GH-159023)
Add os.supports_dir_fd to test.pythoninfo (GH-158605)

Split the attribute lists so the 'supports_*' names don't need
to be repeated twice.

Add 'supports_dir_fd'.
(cherry picked from commit eb77b4b2e4)

Co-authored-by: Petr Viktorin <[email protected]>
2026-10-10 14:02:25 +03:00
23b2b40d55 [3.15] gh-122931: Allow stable abi3 API extensions to include a multiarch tuple in the filename (GH-152461) (GH-154772)
This permits stable ABI extensions for multiple architectures to be
co-installed into the same directory, without clashing with each other,
the same way (non-stable ABI) regular extensions can.

It is listed before the current platform-less suffixes since it's more
specific.

The platform is stored in a new pyconfig.h define & sysconfig
variable, SOABI_PLATFORM.
On some known architectures (FreeBSD, Windows), this
will be undefined/zero; these won't have the new tag (yet).

Add SOABI_PLATFORM & ALT_SOABI the info to
`make pythoninfo` as well.
(cherry picked from commit 7961bbf2bb)

Co-authored-by: Stefano Rivera <[email protected]>
Co-authored-by: Petr Viktorin <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
2026-07-29 10:21:30 +02:00
a1a9e6f081 [3.15] gh-152680: Detect virtualization on Windows in pythoninfo (GH-152824) (#152890)
gh-152680: Detect virtualization on Windows in pythoninfo (GH-152824)

Use WMI to detect virtualization on Windows.

Replace wmic command with _wmi module to get the operating system caption and
version.

The wmic tool is deprecated since January 2024:
https://techcommunity.microsoft.com/blog/windows-itpro-blog/wmi-command-line-wmic-utility-deprecation-next-steps/4039242

For example, it's no longer installed in Windows images on GitHub
Action.

Fix also run_command(): no longer try to spawn a subprocess if the
platform doesn't support subprocess. It avoids logging run_command()
errors.
(cherry picked from commit 4e4869b62f)

Co-authored-by: Victor Stinner <[email protected]>
2026-07-02 13:27:35 +00:00
e9d064f395 [3.15] gh-152680: Detect container/VM in test.pythoninfo (GH-152668) (#152699)
gh-152680: Detect container/VM in test.pythoninfo (GH-152668)

On Apple, log the hardware model as "system.hardware".

* Log the "CI", "IMAGE_OS_VERSION" and "container"
  environment variables.
* Add run_command() and first_line() functions.
(cherry picked from commit f1c5363721)

Co-authored-by: Victor Stinner <[email protected]>
2026-06-30 15:47:12 +00:00
1926cf3dc9 [3.15] gh-151929: Get uptime on BSD/macOS in pythoninfo (GH-152189) (#152196)
gh-151929: Get uptime on BSD/macOS in pythoninfo (GH-152189)

* Check sysctlbyname() function and sys/sysctl.h header in
  configure.
* Add _testcapi.uptime_bsd() function.
(cherry picked from commit b6d89edc4a)

Co-authored-by: Victor Stinner <[email protected]>
2026-06-25 13:41:18 +00:00
Victor StinnerandGitHub ae4c2c126b [3.15] gh-151929: Get machine ID and uptime on Windows in pythoninfo (#152146) (#152187)
gh-151929: Get machine ID and uptime on Windows in pythoninfo (#152146)

* Replace "linux." prefix with "system." in pythoninfo.
* Add _winapi.GetTickCount64() function.

(cherry picked from commit f9910519af)
2026-06-25 12:34:16 +00:00
7d5e2dd398 [3.15] gh-151929: Get boot ID, machine ID and uptime in test.pythoninfo (GH-152127) (#152134)
gh-151929: Get boot ID, machine ID and uptime in test.pythoninfo (GH-152127)
(cherry picked from commit 3db3bba4d1)


GHA: Run test.pythoninfo on the "Cross build Linux" job.

Co-authored-by: Victor Stinner <[email protected]>
2026-06-25 00:00:32 +00:00
Victor StinnerandGitHub b5a27bdcf0 gh-146410: Add --pythoninfo option to regrtest (#146413)
* Android now runs tests with --pythoninfo to dump build information.
* Add display_title() function.
2026-03-26 10:56:38 +01:00
Victor StinnerandGitHub 6c8c72f7fe gh-145548: Use VMADDR_CID_LOCAL in VSOCK socket tests (#145589)
Prefer VMADDR_CID_LOCAL instead of VMADDR_CID_ANY for bind() in the
server. Skip the test if bind() fails with EADDRNOTAVAIL.

Log vsock CID in test.pythoninfo.
2026-03-06 16:51:36 +01:00
Filipe LaínsandGitHub f739e2ca62 Add sysconfig[VPATH] to test.pythoninfo (#145434) 2026-03-02 20:48:07 +00:00
4e45c9c309 gh-136677: Introduce executable specific linker flags to configure (#137296)
* introduce executable specific linker flags

Add PY_CORE_EXE_LDFLAGS and EXE_LDFLAGS which stores executable specific
LDFLAGS, replacing PY_CORE_LDFLAGS for building
executable targets.

If PY_CORE_EXE_LDFLAGS / EXE_LDFLAGS is not provided, then it defaults
to the value of PY_CORE_LDFLAGS which is the existing behaviour.

If both flags are supplied, and there is a need
to distinguish between executable and shared specific LDFLAGS,
in particular, PY_CORE_LDFLAGS should contain the shared specific LDFLAGS.

* documentation for new linker flags

* update Misc folder documentation

* Update Makefile.pre.in

Co-authored-by: Victor Stinner <[email protected]>

---------

Co-authored-by: Filipe Laíns <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
Co-authored-by: Filipe Laíns <[email protected]>
2026-02-24 22:52:02 +00:00
Victor StinnerandGitHub 376559bf54 gh-140702: Log color and GHA env vars in test.pythoninfo (#140747) 2025-10-29 13:29:10 +01:00
aafb1435d8 Use test.support.is_wasm32 flag for is_emscripten or is_wasi for generic checks (GH-136815)
Co-authored-by: Brett Cannon <[email protected]>
2025-07-22 12:50:13 -07:00
Victor StinnerandGitHub d9ec0ee733 gh-133711: Log Windows OEM code page in test.pythoninfo (#134840)
Add _winapi.GetOEMCP() function.
2025-05-28 17:41:11 +02:00
46d7c114d8 gh-132983: Add zstd version info to test.pythoninfo (#134230)
Co-authored-by: Victor Stinner <[email protected]>
2025-05-20 00:06:04 +02:00
Victor StinnerandGitHub f0485de43a gh-132950: Log is_remote_debug_enabled() in pythoninfo (#132965)
Log also the Py_REMOTE_DEBUG macro.
2025-04-25 18:13:47 +00:00
Steve DowerandGitHub 63a638c43f gh-91349: Replace zlib with zlib-ng in Windows build (GH-131438) 2025-03-19 19:03:25 +00:00
Mark ShannonandGitHub 014223649c GH-130396: Use computed stack limits on linux (GH-130398)
* Implement C recursion protection with limit pointers for Linux, MacOS and Windows

* Remove calls to PyOS_CheckStack

* Add stack protection to parser

* Make tests more robust to low stacks

* Improve error messages for stack overflow
2025-02-25 09:24:48 +00:00
Petr ViktorinandGitHub ef29104f7d GH-91079: Revert "GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)" for now (GH130413)
Revert "GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)" for now

Unfortunatlely, the change broke some buildbots.

This reverts commit 2498c22fa0.
2025-02-24 11:16:08 +01:00
Mark ShannonandGitHub 2498c22fa0 GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)
* Implement C recursion protection with limit pointers

* Remove calls to PyOS_CheckStack

* Add stack protection to parser

* Make tests more robust to low stacks

* Improve error messages for stack overflow
2025-02-19 11:44:57 +00:00
aecbc2e6f4 gh-115382: Fix cross compiles when host and target use same SOABI
Co-authored-by: Erlend E. Aasland <[email protected]>
2024-10-16 23:01:42 +01:00
Donghee NaandGitHub ad7c778546 gh-123990: Good bye WITH_FREELISTS macro (gh-124358) 2024-09-24 01:28:59 +00:00
Victor StinnerandGitHub 74072a3ffc gh-119132: Log sys._is_gil_enabled() in test.pythoninfo (#119140) 2024-05-18 09:24:22 -04:00
Victor StinnerandGitHub 64cd6fc9a6 gh-117889: Fix PGO test in test_peg_generator (#117893)
Reuse support.check_cflags_pgo() in test_peg_generator to check for
PGO build.

Log PGO_PROF_USE_FLAG in test.pythoninfo.
2024-04-15 13:59:34 +00:00
Erlend E. AaslandandGitHub 6c8ac8a32f gh-116303: Handle disabled test modules in test.support helpers (#116482)
Make sure test.support helpers skip iso. failing if test extension
modules are disabled. Also log TEST_MODULES in test.pythoninfo.
2024-03-28 08:40:37 +00:00
f006338017 gh-114099: Additions to standard library to support iOS (GH-117052)
Co-authored-by: Hugo van Kemenade <[email protected]>
Co-authored-by: Malcolm Smith <[email protected]>
Co-authored-by: Ned Deily <[email protected]>
2024-03-28 03:59:33 -04:00
Malcolm SmithandGitHub 74c8568d07 gh-71042: Add platform.android_ver (#116674) 2024-03-27 17:53:27 +01:00
Victor StinnerandGitHub c77f552ec0 gh-114107: test.pythoninfo logs Windows Developer Mode (#114121)
Also, don't skip the whole collect_windows() if ctypes is missing.

Log also ctypes.windll.shell32.IsUserAnAdmin().
2024-01-16 17:23:46 +01:00
Serhiy StorchakaandGitHub 53330f1677 gh-113440: Ignore the "ver" command failure with exit code 0xc0000142 (GH-113435) 2023-12-24 12:31:23 +02:00
Hugo van KemenadeandGitHub 3b3ec0d77f gh-111863: Rename Py_NOGIL to Py_GIL_DISABLED (#111864)
Rename Py_NOGIL to Py_GIL_DISABLED
2023-11-20 15:52:00 +02:00
05f2f0ac92 gh-90815: Add mimalloc memory allocator (#109914)
* Add mimalloc v2.12

Modified src/alloc.c to remove include of alloc-override.c and not
compile new handler.

Did not include the following files:

 - include/mimalloc-new-delete.h
 - include/mimalloc-override.h
 - src/alloc-override-osx.c
 - src/alloc-override.c
 - src/static.c
 - src/region.c

mimalloc is thread safe and shares a single heap across all runtimes,
therefore finalization and getting global allocated blocks across all
runtimes is different.

* mimalloc: minimal changes for use in Python:

 - remove debug spam for freeing large allocations
 - use same bytes (0xDD) for freed allocations in CPython and mimalloc
   This is important for the test_capi debug memory tests

* Don't export mimalloc symbol in libpython.
* Enable mimalloc as Python allocator option.
* Add mimalloc MIT license.
* Log mimalloc in Lib/test/pythoninfo.py.
* Document new mimalloc support.
* Use macro defs for exports as done in:
  https://github.com/python/cpython/pull/31164/

Co-authored-by: Sam Gross <[email protected]>
Co-authored-by: Christian Heimes <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
2023-10-30 15:43:11 +00:00
Victor StinnerandGitHub e0c4437793 Add support.MS_WINDOWS constant (#110446) 2023-10-06 02:37:28 +02:00
Victor StinnerandGitHub a46e960768 gh-109649: Use os.process_cpu_count() (#110165)
Replace os.cpu_count() with os.process_cpu_count() in modules:

* compileall
* concurrent.futures
* multiprocessing

Replace os.cpu_count() with os.process_cpu_count() in programs:

* _decimal deccheck.py test
* freeze.py
* multissltests.py
* python -m test (regrtest)
* wasm_build.py

Other changes:

* test.pythoninfo logs os.process_cpu_count().
* regrtest gets os.process_cpu_count() / os.cpu_count() in headers.
2023-10-01 03:14:57 +02:00
Victor StinnerandGitHub b89ed9df39 gh-109615: Fix support test_copy_python_src_ignore() (#109958)
Fix the test when run on an installed Python: use "abs_srcdir" of
sysconfig, and skip the test if the Python source code cannot be
found.

* Tools/patchcheck/patchcheck.py, Tools/freeze/test/freeze.py and
  Lib/test/libregrtest/utils.py now first try to get "abs_srcdir"
  from sysconfig, before getting "srcdir" from sysconfig.
* test.pythoninfo logs sysconfig "abs_srcdir".
2023-09-27 12:32:12 +02:00
Victor StinnerandGitHub 81cd1bd713 gh-103053: Skip test_freeze_simple_script() on PGO build (#109591)
Skip test_freeze_simple_script() of test_tools.test_freeze if Python
is built with "./configure --enable-optimizations", which means with
Profile Guided Optimization (PGO): it just makes the test too slow.
The freeze tool is tested by many other CIs with other (faster)
compiler flags.

test.pythoninfo now gets also get_build_info() of
test.libregrtests.utils.
2023-09-20 01:58:34 +00:00
Victor StinnerandGitHub 715f663258 gh-109276: libregrtest: WASM use stdout for JSON (#109355)
On Emscripten and WASI, or if --python command line is used,
libregrtest now writes JSON into stdout, instead of using a name
file.

* Add JsonFileType.STDOUT.
* Remove JsonFileType.FILENAME.
* test.pythoninfo logs environment variables related to
  cross-compilation and running Python on Emscripten/WASI.
2023-09-13 02:24:43 +02:00
Victor StinnerandGitHub d12b3e3152 gh-109276: test.pythoninfo gets more test.support data (#109337)
Collect data from:

* test.support
* test.support.os_helper
* test.support.socket_helper
* test.support.threading_helper
2023-09-12 18:43:32 +02:00
Victor StinnerandGitHub df4f0fe203 gh-109276: Complete test.pythoninfo (#109312)
* Enable collect_sysconfig() on Windows.
* Add sysconfig 'abs_builddir' and 'srcdir'
* Add sysconfig.is_python_build()
* Add tempfile.gettempdir()
* Remove compatiblity with Python 2.7 (print_function).
2023-09-12 02:50:05 +00:00
Victor StinnerandGitHub b0edf3b98e GH-91079: Rename C_RECURSION_LIMIT to Py_C_RECURSION_LIMIT (#108507)
Symbols of the C API should be prefixed by "Py_" to avoid conflict
with existing names in 3rd party C extensions on "#include <Python.h>".

test.pythoninfo now logs Py_C_RECURSION_LIMIT constant and other
_testcapi and _testinternalcapi constants.
2023-09-08 09:48:28 +00:00
Victor StinnerandGitHub babdced23f test.pythoninfo logs freedesktop_os_release() (#109057) 2023-09-07 05:43:32 +00:00
Victor StinnerandGitHub 8ff1142578 gh-108851: Fix tomllib recursion tests (#108853)
* Add get_recursion_available() and get_recursion_depth() functions
  to the test.support module.
* Change infinite_recursion() default max_depth from 75 to 100.
* Fix test_tomllib recursion tests for WASI buildbots: reduce the
  recursion limit and compute the maximum nested array/dict depending
  on the current available recursion limit.
* test.pythoninfo logs sys.getrecursionlimit().
* Enhance test_sys tests on sys.getrecursionlimit()
  and sys.setrecursionlimit().
2023-09-06 17:34:31 +02:00
Victor StinnerandGitHub 3a1ac87f8f gh-90791: test.pythoninfo logs ASAN_OPTIONS env var (#108289)
* Cleanup libregrtest code logging ASAN_OPTIONS.
* Fix a typo on "ASAN_OPTIONS" vs "MSAN_OPTIONS".
2023-08-23 01:39:50 +02:00
Victor StinnerandGitHub 5afe0c17ca gh-108223: test.pythoninfo and libregrtest log Py_NOGIL (#108238)
Enable with --disable-gil --without-pydebug:

    $ make pythoninfo|grep NOGIL
    sysconfig[Py_NOGIL]: 1

    $ ./python -m test
    ...
    == Python build: nogil debug
    ...
2023-08-21 22:16:23 +02:00
Victor StinnerandGitHub 307186704d gh-106320: Remove private _PyMem API (#107187)
Move private _PyMem functions to the internal C API (pycore_pymem.h):

* _PyMem_GetCurrentAllocatorName()
* _PyMem_RawStrdup()
* _PyMem_RawWcsdup()
* _PyMem_Strdup()

No longer export these functions.

Move pymem_getallocatorsname() function from _testcapi to _testinternalcapi,
since the API moved to the internal C API.
2023-07-24 18:48:06 +00:00
Zachary WareandGitHub a989b73e8e gh-75552: Remove deprecated tkinter.tix module (GH-104902) 2023-05-27 12:34:19 -05:00
0fe645d6fd gh-95174: Add pthread stubs for WASI (GH-95234)
Co-authored-by: Brett Cannon <[email protected]>
2022-07-27 20:28:06 +02:00
Erlend Egeberg AaslandandGitHub 27934bef2d gh-93370: Drop deprecated sqlite3.version from pythoninfo.py (#94277) 2022-06-26 12:10:28 +02:00
Victor StinnerandGitHub d8f40ead92 test.pythoninfo: Fix typo, Py_REF_DEBUG => Py_TRACE_REFS (#93467) 2022-06-03 15:46:41 +02:00