summaryrefslogtreecommitdiffstats
path: root/Modules/_testsinglephase.c
Commit message (Collapse)AuthorAgeFilesLines
* [3.13] gh-123880: Allow recursive import of single-phase-init modules ↵Miss Islington (bot)2024-09-231-2/+61
| | | | | | | | | | | (GH-123950) (#124273) gh-123880: Allow recursive import of single-phase-init modules (GH-123950) (cherry picked from commit aee219f4558dda619bd86e4b0e028ce47a5e4b77) Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Co-authored-by: Brett Cannon <brett@python.org>
* [3.13] gh-119584: Fix test_import Failed Assertion (gh-119623) (gh-119633)Miss Islington (bot)2024-05-271-0/+3
| | | | | | | The fix in gh-119561 introduced an assertion that doesn't hold true if any of the three new test extension modules are loaded more than once. This is fine normally but breaks if the new test_check_state_first() is run more than once, which happens for refleak checking and with the regrtest --forever flag. We fix that here by clearing each of the three modules after loading them. We also tweak a check in _modules_by_index_check(). (cherry picked from commit ae7b17673f29efe17b416cbcfbf43b5b3ff5977c) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.13] gh-119560: Drop an Invalid Assert in PyState_FindModule() (gh-119561) ↵Miss Islington (bot)2024-05-271-2/+89
| | | | | | | | | (gh-119632) The assertion was added in gh-118532 but was based on the invalid assumption that PyState_FindModule() would only be called with an already-initialized module def. I've added a test to make sure we don't make that assumption again. (cherry picked from commit 0c5ebe13e9937c446e9947c44f2570737ecca135) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* gh-116322: Rename PyModule_ExperimentalSetGIL to PyUnstable_Module_SetGIL ↵Petr Viktorin2024-05-061-3/+3
| | | | (GH-118645)
* gh-116322: Add Py_mod_gil module slot (#116882)Brett Simmers2024-05-031-0/+9
| | | | | | | | | | | | | | This PR adds the ability to enable the GIL if it was disabled at interpreter startup, and modifies the multi-phase module initialization path to enable the GIL when loading a module, unless that module's spec includes a slot indicating it can run safely without the GIL. PEP 703 called the constant for the slot `Py_mod_gil_not_used`; I went with `Py_MOD_GIL_NOT_USED` for consistency with gh-104148. A warning will be issued up to once per interpreter for the first GIL-using module that is loaded. If `-v` is given, a shorter message will be printed to stderr every time a GIL-using module is loaded (including the first one that issues a warning).
* gh-117953: Other Cleanups in the Extensions Machinery (gh-118206)Eric Snow2024-05-031-1/+167
| | | This change will make some later changes simpler.
* gh-110850: Use public PyTime functions (#115746)Victor Stinner2024-02-201-5/+4
| | | | | Replace private _PyTime functions with public PyTime functions. random_seed_time_pid() now reports errors to its caller.
* gh-110850: Rename internal PyTime C API functions (#115734)Victor Stinner2024-02-201-2/+2
| | | | | | | | | | | | | | | | | Rename functions: * _PyTime_GetSystemClock() => _PyTime_TimeUnchecked() * _PyTime_GetPerfCounter() => _PyTime_PerfCounterUnchecked() * _PyTime_GetMonotonicClock() => _PyTime_MonotonicUnchecked() * _PyTime_GetSystemClockWithInfo() => _PyTime_TimeWithInfo() * _PyTime_GetMonotonicClockWithInfo() => _PyTime_MonotonicWithInfo() * _PyTime_GetMonotonicClockWithInfo() => _PyTime_MonotonicWithInfo() Changes: * Remove "typedef PyTime_t PyTime_t;" which was "typedef PyTime_t _PyTime_t;" before a previous rename. * Update comments of "Unchecked" functions. * Remove invalid PyTime_Time() comment.
* gh-110850: Replace _PyTime_t with PyTime_t (#115719)Victor Stinner2024-02-201-5/+5
| | | | | Run command: sed -i -e 's!\<_PyTime_t\>!PyTime_t!g' $(find -name "*.c" -o -name "*.h")
* gh-86493: Use PyModule_Add() instead of PyModule_AddObjectRef() (GH-106860)Serhiy Storchaka2023-07-181-7/+1
|
* gh-106316: Remove pytime.h header file (#106317)Victor Stinner2023-07-011-0/+1
| | | | | | | | | | | | | | | | | Remove the "cpython/pytime.h" header file: it only contained private functions. Move functions to the internal pycore_time.h header file. Move tests from _testcapi to _testinternalcapi. Rename also test methods to have the same name than tested C functions. No longer export these functions: * _PyTime_Add() * _PyTime_As100Nanoseconds() * _PyTime_FromMicrosecondsClamp() * _PyTime_FromTimespec() * _PyTime_FromTimeval() * _PyTime_GetPerfCounterWithInfo() * _PyTime_MulDiv()
* gh-102251: Explicitly free state for test modules with state in test_import ↵sunmy20192023-05-311-1/+21
| | | | | (#105085) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-102251: Fix reference leak in _testsinglephase initialization (#105082)sunmy20192023-05-301-1/+3
| | | | | Correctly decref 'initialized' in init_module() Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-102251: Updates to test_imp Toward Fixing Some Refleaks (gh-102254)Eric Snow2023-02-271-11/+11
| | | | | | | This is related to fixing the refleaks introduced by commit 096d009. I haven't been able to find the leak yet, but these changes are a consequence of that effort. This includes some cleanup, some tweaks to the existing tests, and a bunch of new test cases. The only change here that might have impact outside the tests in question is in imp.py, where I update imp.load_dynamic() to use spec_from_file_location() instead of creating a ModuleSpec directly. Also note that I've updated the tests to only skip if we're checking for refleaks (regrtest's --huntrleaks), whereas in gh-101969 I had skipped the tests entirely. The tests will be useful for some upcoming work and I'd rather the refleaks not hold that up. (It isn't clear how quickly we'll be able to fix the leaking code, though it will certainly be done in the short term.) https://github.com/python/cpython/issues/102251
* gh-101758: Add a Test For Single-Phase Init Modules in Multiple Interpreters ↵Eric Snow2023-02-151-2/+47
| | | | | | | (gh-101920) The test verifies the behavior of single-phase init modules when loaded in multiple interpreters. https://github.com/python/cpython/issues/101758
* gh-101758: Add a Test For Single-Phase Init Module Variants (gh-101891)Eric Snow2023-02-141-28/+366
| | | | | The new test exercises the most important variants for single-phase init extension modules. We also add some explanation about those variants to import.c. https://github.com/python/cpython/issues/101758
* gh-98627: Add the _testsinglephase Module (gh-99039)Eric Snow2022-11-081-0/+78
This makes it more clear that a given test is definitely testing against a single-phase init (legacy) extension module. The new module is a companion to _testmultiphase. https://github.com/python/cpython/issues/98627