Commit Graph

73 Commits

Author SHA1 Message Date
Victor Stinner 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. Aasland 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
Russell Keith-Magee f006338017
gh-114099: Additions to standard library to support iOS (GH-117052)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Malcolm Smith <smith@chaquo.com>
Co-authored-by: Ned Deily <nad@python.org>
2024-03-28 03:59:33 -04:00
Malcolm Smith 74c8568d07
gh-71042: Add `platform.android_ver` (#116674) 2024-03-27 17:53:27 +01:00
Victor Stinner 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 Storchaka 53330f1677
gh-113440: Ignore the "ver" command failure with exit code 0xc0000142 (GH-113435) 2023-12-24 12:31:23 +02:00
Hugo van Kemenade 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
Dino Viehland 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 <colesbury@gmail.com>
Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-10-30 15:43:11 +00:00
Victor Stinner e0c4437793
Add support.MS_WINDOWS constant (#110446) 2023-10-06 02:37:28 +02:00
Victor Stinner 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 Stinner 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 Stinner 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 Stinner 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 Stinner 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 Stinner 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 Stinner 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 Stinner babdced23f
test.pythoninfo logs freedesktop_os_release() (#109057) 2023-09-07 05:43:32 +00:00
Victor Stinner 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 Stinner 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 Stinner 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 Stinner 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 Ware a989b73e8e
gh-75552: Remove deprecated tkinter.tix module (GH-104902) 2023-05-27 12:34:19 -05:00
Christian Heimes 0fe645d6fd
gh-95174: Add pthread stubs for WASI (GH-95234)
Co-authored-by: Brett Cannon <brett@python.org>
2022-07-27 20:28:06 +02:00
Erlend Egeberg Aasland 27934bef2d
gh-93370: Drop deprecated sqlite3.version from pythoninfo.py (#94277) 2022-06-26 12:10:28 +02:00
Victor Stinner d8f40ead92
test.pythoninfo: Fix typo, Py_REF_DEBUG => Py_TRACE_REFS (#93467) 2022-06-03 15:46:41 +02:00
Victor Stinner 06dd26f89f
test.pythoninfo logs more build info (#93225)
Log also test.support.check_sanitizer() values.
2022-05-26 16:07:01 +02:00
Victor Stinner 4a31ed8a32
test.pythoninfo no longer requires socket (#93191)
test.pythoninfo no longer fails if "import socket" fails: the socket
module is now optional.
2022-05-25 02:11:51 +02:00
Christian Heimes 137fd3d88a
gh-90473: Decrease recursion limit and skip tests on WASI (GH-92803) 2022-05-19 12:43:16 +02:00
Christian Heimes 9ff2f12c87
gh-84461: Include _emscripten_info in pythoninfo output (GH-91907) 2022-04-25 12:58:25 +02:00
Inada Naoki 1317b70f89
gh-91156: Use `locale.getencoding()` instead of getpreferredencoding (GH-91732)
Co-authored-by: Victor Stinner <vstinner@python.org>
2022-04-22 10:39:24 +09:00
Christian Heimes deeaac49e2
bpo-40280: Skip socket, fork, subprocess tests on Emscripten (GH-31986)
- Add requires_fork and requires_subprocess to more tests
- Skip extension import tests if dlopen is not available
- Don't assume that _testcapi is a shared extension
- Skip a lot of socket tests that don't work on Emscripten
- Skip mmap tests, mmap emulation is incomplete
- venv does not work yet
- Cannot get libc from executable

The "entire" test suite is now passing on Emscripten with EMSDK from git head (91 suites are skipped).
2022-03-22 03:04:36 -07:00
Victor Stinner cef0a5458f
bpo-45382: test.pythoninfo: set wmic.exe encoding to OEM (GH-30890) 2022-01-25 20:02:23 +01:00
Victor Stinner b0898f4aa9
bpo-45382: test.pythoninfo logs more Windows versions (GH-30817)
Add the following info to test.pythoninfo:

* windows.ver: output of the shell "ver" command
* windows.version and windows.version_caption: output of the
  "wmic os get Caption,Version /value" command.
2022-01-23 04:03:43 +01:00
Victor Stinner 1781d55eb3
bpo-46417: _curses uses PyStructSequence_NewType() (GH-30736)
The _curses module now creates its ncurses_version type as a heap
type using PyStructSequence_NewType(), rather than using a static
type.

* Move _PyStructSequence_FiniType() definition to pycore_structseq.h.
* test.pythoninfo: log curses.ncurses_version.
2022-01-21 03:30:20 +01:00
Victor Stinner 49acac00c0
bpo-44860: Update test_sysconfig for posix_user platlib (GH-28235)
Update test_sysconfig.test_user_similar() for the posix_user scheme:
"platlib" doesn't use sys.platlibdir.
2021-09-09 11:02:48 +02:00
Christian Heimes 2875c603b2
bpo-43880: Show DeprecationWarnings for deprecated ssl module features (GH-25455)
* ssl.OP_NO_SSLv2
* ssl.OP_NO_SSLv3
* ssl.OP_NO_TLSv1
* ssl.OP_NO_TLSv1_1
* ssl.OP_NO_TLSv1_2
* ssl.OP_NO_TLSv1_3
* ssl.PROTOCOL_SSLv2
* ssl.PROTOCOL_SSLv3
* ssl.PROTOCOL_SSLv23 (alias for PROTOCOL_TLS)
* ssl.PROTOCOL_TLS
* ssl.PROTOCOL_TLSv1
* ssl.PROTOCOL_TLSv1_1
* ssl.PROTOCOL_TLSv1_2
* ssl.TLSVersion.SSLv3
* ssl.TLSVersion.TLSv1
* ssl.TLSVersion.TLSv1_1
* ssl.wrap_socket()
* ssl.RAND_pseudo_bytes()
* ssl.RAND_egd() (already removed since it's not supported by OpenSSL 1.1.1)
* ssl.SSLContext() without a protocol argument
* ssl.match_hostname()
* hashlib.pbkdf2_hmac() (pure Python implementation, fast OpenSSL
  function will stay)

Signed-off-by: Christian Heimes <christian@python.org>
2021-04-19 07:27:10 +02:00
Victor Stinner e3dfb9b967
bpo-9216: Expose OpenSSL FIPS_mode() as _hashlib.get_fips_mode() (GH-19703)
test.pythoninfo logs OpenSSL FIPS_mode() and Linux
/proc/sys/crypto/fips_enabled in a new "fips" section.

Co-Authored-By: Petr Viktorin <encukou@gmail.com>
2020-04-29 09:04:22 -07:00
Victor Stinner ec9bea4a37
bpo-40436: Fix code parsing gdb version (GH-19792)
test_gdb and test.pythoninfo now check gdb command exit code.
2020-04-29 17:11:48 +02:00
Victor Stinner 4a46adc774
bpo-39459: test.pythoninfo logs effective uid/gid (GH-18203)
Fix also umask formatting: use octal prefix.
2020-01-27 18:06:42 +01:00
Pablo Galindo 293dd23477
Remove binding of captured exceptions when not used to reduce the chances of creating cycles (GH-17246)
Capturing exceptions into names can lead to reference cycles though the __traceback__ attribute of the exceptions in some obscure cases that have been reported previously and fixed individually. As these variables are not used anyway, we can remove the binding to reduce the chances of creating reference cycles.

See for example GH-13135
2019-11-19 21:34:03 +00:00
Victor Stinner b3e7045f83
bpo-38338, test.pythoninfo: add more ssl infos (GH-16539)
test.pythoninfo now logs environment variables used by OpenSSL and
Python ssl modules, and logs attributes of 3 SSL contexts
(SSLContext, default HTTPS context, stdlib context).
2019-10-02 17:52:35 +02:00
Victor Stinner 221fd84703
bpo-38234: Cleanup getpath.c (GH-16367)
* search_for_prefix() directly calls reduce() if found is greater
  than 0.
* Add calculate_pybuilddir() subfunction.
* search_for_prefix(): add path string buffer for readability.
* Fix some error handling code paths: release resources on error.
* calculate_read_pyenv(): rename tmpbuffer to filename.
* test.pythoninfo now also logs windows.dll_path
2019-09-25 02:54:25 +02:00
Victor Stinner 64580da331
bpo-37412: pythoninfo: add Windows long paths (GH-14434)
On Windows, test.pythoninfo now checks if support for long paths is
enabled using ntdll.RtlAreLongPathsEnabled() function.

Co-Authored-By: Eryk Sun <eryksun@gmail.com>
2019-06-28 18:05:05 +02:00
Victor Stinner 9cb274114c
bpo-37400: pythoninfo logs getpwuid and getgrouplist (GH-14373)
test.pythoninfo now also logs pwd.getpwuid(os.getuid()) and
os.getgrouplist(). Extract also os.getrandom() test to run it first.
2019-06-25 13:37:27 +02:00
Victor Stinner 5f38b8407b
bpo-36763: Add _PyCoreConfig_SetArgv() (GH-13030)
* Add 2 new config methods:

  * _PyCoreConfig_SetArgv()
  * _PyCoreConfig_SetWideArgv()

* Add also an internal _PyCoreConfig_SetPyArgv() method.
* Remove 'args' parameter from _PyCoreConfig_Read().
2019-05-01 02:30:12 +02:00
xdegaye a86e06433a bpo-35952: Fix test.pythoninfo when the compiler is missing (GH-13007) 2019-04-29 14:53:30 +02:00
Victor Stinner 23bace26ec
bpo-36635: Add _testinternalcapi module (GH-12841)
Add a new _testinternalcapi module to test the internal C API.

Move _Py_GetConfigsAsDict() function to the internal C API:
_testembed now uses _testinternalcapi to access the function.
2019-04-18 11:37:26 +02:00
Victor Stinner 1075d1684a
bpo-36301: Add _Py_GetConfigsAsDict() function (GH-12540)
* Add _Py_GetConfigsAsDict() function to get all configurations as a
  dict.
* dump_config() of _testembed.c now dumps preconfig as a separated
  key: call _Py_GetConfigsAsDict().
* Make _PyMainInterpreterConfig_AsDict() private.
2019-03-25 23:19:57 +01:00
Victor Stinner b2385458ce
bpo-35772: Fix test_tarfile on ppc64 (GH-11606)
Fix sparse file tests of test_tarfile on ppc64le with the tmpfs
filesystem.

Fix the function testing if the filesystem supports sparse files:
create a file which contains data and "holes", instead of creating a
file which contains no data.

tmpfs effective block size is a page size (tmpfs lives in the page
cache). RHEL uses 64 KiB pages on aarch64, ppc64 and ppc64le, only
s390x and x86_64 use 4 KiB pages, whereas the test punch holes of
4 KiB.

test.pythoninfo: Add resource.getpagesize().
2019-01-21 10:24:12 +01:00
Victor Stinner 8c349565e8
Revert "bpo-35537: subprocess can now use os.posix_spawnp (GH-11579)" (GH-11582)
This reverts commit 0785889468.
2019-01-16 23:38:06 +01:00