summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_embed.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] gh-122334: Fix test_embed failure when missing _ssl module ↵Miss Islington (bot)2024-08-061-2/+6
| | | | | | | | | (GH-122630) (#122648) gh-122334: Fix test_embed failure when missing _ssl module (GH-122630) (cherry picked from commit 50b36037518a8e7f7eee39b597d56b5b2756eb86) Co-authored-by: neonene <53406459+neonene@users.noreply.github.com> Co-authored-by: Wulian233 <1055917385@qq.com>
* [3.12] gh-122334: Fix crash when importing ssl after re-initialization ↵neonene2024-08-021-0/+15
| | | | | | | | | (GH-122481) (#122495) Fix crash when importing ssl after re-initialization The current METH_FASTCALL|METH_KEYWORDS functions in a non-builtin module can cause segfaults after restarting the main interpreter, invoking _PyArg_UnpackKeywords() with an insufficiently cleared _PyArg_Parser struct. This patch fixes the invalidation of the static argument parsers.
* [3.12] gh-117482: Fix the Slot Wrapper Inheritance Tests (gh-122250)Eric Snow2024-07-291-19/+37
| | | | | The tests were only checking cases where the slot wrapper was present in the initial case. They were missing when the slot wrapper was added in the additional initializations. This fixes that. (cherry-picked from commit 490e0ad83ac72c5688dfbbab4eac61ccfd7be5fd, AKA gh-122248)
* [3.12] gh-117482: Expand Tests for Slot Wrappers of Inherited Slots of ↵Eric Snow2024-07-231-0/+28
| | | | | Static Builtin Types (gh-122197) (cherry picked from commit 33d32faa580fb776cb660e9cc8aa7e45c6c68c08, AKA gh-122192)
* [3.12] Add support.MS_WINDOWS constant (#110446) (#110452)Victor Stinner2023-10-061-5/+2
| | | | | Add support.MS_WINDOWS constant (#110446) (cherry picked from commit e0c44377935de3491b2cbe1e5f87f8b336fdc922)
* gh-99113: Add PyInterpreterConfig.own_gil (gh-104204)Eric Snow2023-05-051-0/+1
| | | | | We also add PyInterpreterState.ceval.own_gil to record if the interpreter actually has its own GIL. Note that for now we don't actually respect own_gil; all interpreters still share the one GIL. However, PyInterpreterState.ceval.own_gil does reflect PyInterpreterConfig.own_gil. That lie is a temporary one that we will fix when the GIL really becomes per-interpreter.
* GH-103805: Lib test f541 linting issue fix (#103812)Rodolfo M. Pereira2023-04-241-1/+1
| | | | | | | | | | | | | | | | This PR makes some minor linting adjustments to the Lib/test module caught by [ruff](https://github.com/charliermarsh/ruff). The adjustments are all related to the `F541 f-string without any placeholders` issue. Issue: https://github.com/python/cpython/issues/103805 <!-- gh-issue-number: gh-103805 --> * Issue: gh-103805 <!-- /gh-issue-number --> --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Gregory P. Smith <greg@krypto.org>
* gh-101659: Isolate "obmalloc" State to Each Interpreter (gh-101660)Eric Snow2023-04-241-1/+2
| | | | | | | | | | | | | | This is strictly about moving the "obmalloc" runtime state from `_PyRuntimeState` to `PyInterpreterState`. Doing so improves isolation between interpreters, specifically most of the memory (incl. objects) allocated for each interpreter's use. This is important for a per-interpreter GIL, but such isolation is valuable even without it. FWIW, a per-interpreter obmalloc is the proverbial canary-in-the-coalmine when it comes to the isolation of objects between interpreters. Any object that leaks (unintentionally) to another interpreter is highly likely to cause a crash (on debug builds at least). That's a useful thing to know, relative to interpreter isolation.
* gh-98627: Add an Optional Check for Extension Module Subinterpreter ↵Eric Snow2023-02-161-1/+3
| | | | | | | | | | | | | | | Compatibility (gh-99040) Enforcing (optionally) the restriction set by PEP 489 makes sense. Furthermore, this sets the stage for a potential restriction related to a per-interpreter GIL. This change includes the following: * add tests for extension module subinterpreter compatibility * add _PyInterpreterConfig.check_multi_interp_extensions * add Py_RTFLAGS_MULTI_INTERP_EXTENSIONS * add _PyImport_CheckSubinterpIncompatibleExtensionAllowed() * fail iff the module does not implement multi-phase init and the current interpreter is configured to check https://github.com/python/cpython/issues/98627
* gh-100712: make it possible to disable specialization (for debugging) (#100713)Irit Katriel2023-01-191-0/+2
|
* gh-100320: Fix path calculations on Windows when python.exe is moved outside ↵Steve Dower2023-01-161-7/+9
| | | | of the normal location (GH-100947)
* GH-98686: Get rid of "adaptive" and "quick" instructions (GH-99182)Brandt Bucher2022-11-091-4/+0
|
* gh-98790: When DLLs directory is missing on Windows, assume executable_dir ↵Steve Dower2022-11-021-13/+7
| | | | contains PYD files instead (GH-98936)
* GH-98686: Quicken everything (GH-98687)Brandt Bucher2022-11-021-19/+27
|
* gh-98610: Adjust the Optional Restrictions on Subinterpreters (GH-98618)Eric Snow2022-10-311-2/+3
| | | | | | | Previously, the optional restrictions on subinterpreters were: disallow fork, subprocess, and threads. By default, we were disallowing all three for "isolated" interpreters. We always allowed all three for the main interpreter and those created through the legacy `Py_NewInterpreter()` API. Those settings were a bit conservative, so here we've adjusted the optional restrictions to: fork, exec, threads, and daemon threads. The default for "isolated" interpreters disables fork, exec, and daemon threads. Regular threads are allowed by default. We continue always allowing everything For the main interpreter and the legacy API. In the code, we add `_PyInterpreterConfig.allow_exec` and `_PyInterpreterConfig.allow_daemon_threads`. We also add `Py_RTFLAGS_DAEMON_THREADS` and `Py_RTFLAGS_EXEC`.
* gh-96853: Restore test coverage for Py_Initialize(Ex) (GH-98212)Nick Coghlan2022-10-301-0/+6
| | | | | | | | | | | * As most of `test_embed` now uses `Py_InitializeFromConfig`, add a specific test case to cover `Py_Initialize` (and `Py_InitializeEx`) * Rename `_testembed` init helper to clarify the API used * Add a `PyConfig_Clear` call in `Py_InitializeEx` to make the code more obviously correct (it already didn't leak as none of the dynamically allocated config fields were being populated, but it's clearer if the wrappers follow the documented API usage guidelines)
* gh-98608: Change _Py_NewInterpreter() to _Py_NewInterpreterFromConfig() ↵Eric Snow2022-10-261-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | | (gh-98609) (see https://github.com/python/cpython/issues/98608) This change does the following: 1. change the argument to a new `_PyInterpreterConfig` struct 2. rename the function to `_Py_NewInterpreterFromConfig()`, inspired by `Py_InitializeFromConfig()` (takes a `_PyInterpreterConfig` instead of `isolated_subinterpreter`) 3. split up the boolean `isolated_subinterpreter` into the corresponding multiple granular settings * allow_fork * allow_subprocess * allow_threads 4. add `PyInterpreterState.feature_flags` to store those settings 5. add a function for checking if a feature is enabled on an opaque `PyInterpreterState *` 6. drop `PyConfig._isolated_interpreter` The existing default (see `Py_NewInterpeter()` and `Py_Initialize*()`) allows fork, subprocess, and threads and the optional "isolated" interpreter (see the `_xxsubinterpreters` module) disables all three. None of that changes here; the defaults are preserved. Note that the given `_PyInterpreterConfig` will not be used outside `_Py_NewInterpreterFromConfig()`, nor preserved. This contrasts with how `PyConfig` is currently preserved, used, and even modified outside `Py_InitializeFromConfig()`. I'd rather just avoid that mess from the start for `_PyInterpreterConfig`. We can preserve it later if we find an actual need. This change allows us to follow up with a number of improvements (e.g. stop disallowing subprocess and support disallowing exec instead). (Note that this PR adds "private" symbols. We'll probably make them public, and add docs, in a separate change.)
* gh-96512: Move int_max_str_digits setting to PyConfig (#96944)Gregory P. Smith2022-10-031-0/+4
| | | | | | | | | | | It had to live as a global outside of PyConfig for stable ABI reasons in the pre-3.12 backports. This removes the `_Py_global_config_int_max_str_digits` and gets rid of the equivalent field in the internal `struct _is PyInterpreterState` as code can just use the existing nested config struct within that. Adds tests to verify unique settings and configs in subinterpreters.
* GH-96975: Skip incomplete frames in PyEval_GetFrame (GH-97003)Brandt Bucher2022-09-221-0/+3
|
* gh-96143: Allow Linux perf profiler to see Python calls (GH-96123)Pablo Galindo Salgado2022-08-301-0/+5
| | | | | | | :warning: :warning: Note for reviewers, hackers and fellow systems/low-level/compiler engineers :warning: :warning: If you have a lot of experience with this kind of shenanigans and want to improve the **first** version, **please make a PR against my branch** or **reach out by email** or **suggest code changes directly on GitHub**. If you have any **refinements or optimizations** please, wait until the first version is merged before starting hacking or proposing those so we can keep this PR productive.
* bpo-45445: Revert "bpo-45445: Fail if an invalid X-option is provided in the ↵Pablo Galindo Salgado2022-07-311-12/+11
| | | | command line (GH-28823)" (#94745)
* GH-89858: Fix test_embed for out-of-tree builds (GH-93465)Kumar Aditya2022-06-171-5/+4
|
* gh-89745: Avoid exact match when comparing program_name in test_embed on ↵neonene2022-06-171-10/+7
| | | | Windows (GH-93888)
* gh-91985: Ensure in-tree builds override platstdlib_dir in every path ↵neonene2022-06-161-0/+60
| | | | calculation (GH-93641)
* gh-69443: Add test.support.Py_DEBUG constant (#93226)Victor Stinner2022-05-251-6/+5
|
* gh-92031, test_embed: Improve test for unquickening static code (#92440)Dennis Sweeney2022-05-111-10/+30
|
* gh-57684: Add -P cmdline option and PYTHONSAFEPATH env var (#31542)Victor Stinner2022-05-051-2/+11
| | | | | | | | | | | | Add the -P command line option and the PYTHONSAFEPATH environment variable to not prepend a potentially unsafe path to sys.path. * Add sys.flags.safe_path flag. * Add PyConfig.safe_path member. * Programs/_bootstrap_python.c uses config.safe_path=0. * Update subprocess._optim_args_from_interpreter_flags() to handle the -P command line option. * Modules/getpath.py sets safe_path to 1 if a "._pth" file is present.
* GH-91173: disable frozen modules in debug builds (#92023)Kumar Aditya2022-05-031-5/+5
|
* gh-92031: Deoptimize Static Code at Finalization (GH-92039)Dennis Sweeney2022-05-031-0/+14
|
* bpo-47103: Copy pgort140.dll into output directory when building ↵Steve Dower2022-04-061-14/+5
| | | | PGInstrument on Windows (GH-32083)
* bpo-47182: Fix crash by named unicode characters after interpreter ↵Christian Heimes2022-03-311-0/+5
| | | | | reinitialization (GH-32212) Automerge-Triggered-By: GH:tiran
* bpo-47084: Clear Unicode cached representations on finalization (GH-32032)Jeremy Kloth2022-03-221-18/+23
|
* bpo-46857: Fix refleak in OSError INIT_ALIAS() (GH-31594)Victor Stinner2022-02-261-6/+2
| | | _Py_GetRefTotal() no longer decrements _PySet_Dummy refcount.
* bpo-46857: Fix test_embed.test_no_memleak() on Windows (GH-31589)Victor Stinner2022-02-251-4/+10
| | | Tolerate a leak of 1 reference and 1 memory block until it's fixed.
* bpo-1635741: test_embed cheks that Python does not leak (GH-31555)Victor Stinner2022-02-241-0/+21
|
* bpo-40280: Skip subprocess-based tests on wasm32-emscripten (GH-30615)Christian Heimes2022-01-251-0/+2
|
* bpo-46417: _testembed.c avoids Py_SetProgramName() (GH-30732)Victor Stinner2022-01-211-1/+1
| | | | | | * _testembed_Py_Initialize() now uses the PyConfig API, rather than deprecated Py_SetProgramName(). * Reduce INIT_LOOPS from 16 to 4: test_embed now takes 8.7 seconds rather than 14.7 seconds.
* bpo-46417: Finalize structseq types at exit (GH-30645)Victor Stinner2022-01-211-0/+12
| | | | | | | | | | | | | | | | | | Add _PyStructSequence_FiniType() and _PyStaticType_Dealloc() functions to finalize a structseq static type in Py_Finalize(). Currrently, these functions do nothing if Python is built in release mode. Clear static types: * AsyncGenHooksType: sys.set_asyncgen_hooks() * FlagsType: sys.flags * FloatInfoType: sys.float_info * Hash_InfoType: sys.hash_info * Int_InfoType: sys.int_info * ThreadInfoType: sys.thread_info * UnraisableHookArgsType: sys.unraisablehook * VersionInfoType: sys.version * WindowsVersionType: sys.getwindowsversion()
* bpo-46362: Ensure abspath() tests pass through environment variables to ↵neonene2022-01-141-1/+2
| | | | subprocess (GH-30595)
* bpo-46362: Ensure ntpath.abspath() uses the Windows API correctly (GH-30571)neonene2022-01-131-0/+27
| | | This makes ntpath.abspath()/getpath_abspath() follow normpath(), since some WinAPIs such as PathCchSkipRoot() require backslashed paths.
* bpo-46263: Do not ever expect "use_frozen_modules" to be -1. (gh-30438)Eric Snow2022-01-061-2/+0
| | | | | The condition is no longer valid. This should resolve the buildbot failure on FreeBSD. https://bugs.python.org/issue46263
* bpo-45582: Fix test_embed failure during a PGO build on Windows (GH-30014)neonene2021-12-101-3/+8
| | | This defines VPATH differently in PGO instrumentation builds, to account for a different default output directory. It also adds sys._vpath on Windows to make the value available to sysconfig so that it can be used in tests.
* bpo-46015: Fixes calculation of sys.path in a venv on Windows (GH-29992)Steve Dower2021-12-081-0/+2
| | | Also ensures that pybuilddir.txt is written early enough in the build to be picked up by later steps.
* bpo-45582: Fix getpath_isxfile() and test_embed on Windows (GH-29930)neonene2021-12-061-2/+10
|
* bpo-45582: Port getpath[p].c to Python (GH-29041)Steve Dower2021-12-031-80/+80
| | | | | The getpath.py file is frozen at build time and executed as code over a namespace. It is never imported, nor is it meant to be importable or reusable. However, it should be easier to read, modify, and patch than the previous code. This commit attempts to preserve every previously tested quirk, but these may be changed in the future to better align platforms.
* bpo-45954: Rename PyConfig.no_debug_ranges to code_debug_ranges (GH-29886)Victor Stinner2021-12-021-4/+4
| | | | | | | Rename PyConfig.no_debug_ranges to PyConfig.code_debug_ranges and invert the value. Document -X no_debug_ranges and PYTHONNODEBUGRANGES env var in PyConfig.code_debug_ranges documentation.
* bpo-45653: fix test_embed on windows (GH-29814)Kumar Aditya2021-11-291-1/+1
|
* bpo-45506: Fix test_embed expecting to not find stdlib in source tree build ↵Steve Dower2021-11-201-6/+11
| | | | when stdlib has been installed. (GH-29649)
* bpo-45506: Stop skipping test_embed. (gh-29300)Eric Snow2021-11-031-1/+3
| | | | | In gh-29063 I ended up disabling test_embed on non-Windows by accident. This gets it running again. https://bugs.python.org/issue45506
* bpo-45668: Fix PGO tests without test extensions (GH-29315)Christian Heimes2021-11-011-0/+1
|