summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_embed.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.11] Add support.MS_WINDOWS constant (#110446) (#110452) (#110464)Victor Stinner2023-10-061-3/+1
| | | | | | | | [3.12] Add support.MS_WINDOWS constant (#110446) (#110452) Add support.MS_WINDOWS constant (#110446) (cherry picked from commit e0c44377935de3491b2cbe1e5f87f8b336fdc922) (cherry picked from commit e188534607761af1f8faba483ce0b1e8578c73e5)
* 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-98790: When DLLs directory is missing on Windows, assume executable_dir ↵Steve Dower2022-11-021-13/+7
| | | | contains PYD files instead (GH-98936)
* [3.11] gh-96853: Restore test coverage for Py_Initialize(Ex) (GH-98874)Miss Islington (bot)2022-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) (cherry picked from commit 05e48865be69e1e5824f6915b588ff054717bb42) Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>
* GH-96975: Skip incomplete frames in PyEval_GetFrame (GH-97018)Miss Islington (bot)2022-09-221-0/+3
| | | | | (cherry picked from commit 8fd2c3b75b90c4ee391894aa5094615bbdb6242f) Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
* bpo-45445: Revert "bpo-45445: Fail if an invalid X-option is provided in the ↵Miss Islington (bot)2022-07-311-12/+11
| | | | | | | command line (GH-28823)" (GH-94745) (cherry picked from commit aa37ffda29ac48fb2df5a7029ba2e626ecc45850) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* gh-91985: Ensure in-tree builds override platstdlib_dir in every path ↵Miss Islington (bot)2022-06-201-0/+60
| | | | | | | calculation (GH-93641) (cherry picked from commit 38af903506e9b18c6350c1dadcb489f057713f36) Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
* GH-89858: Fix test_embed for out-of-tree builds (GH-93465)Miss Islington (bot)2022-06-181-5/+4
| | | | | (cherry picked from commit 96464e5401783c99f1ae24369bb2a854b8c5f46a) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-89745: Avoid exact match when comparing program_name in test_embed on ↵Miss Islington (bot)2022-06-171-10/+7
| | | | | | | Windows (GH-93888) (cherry picked from commit ffc228dd4e409336f2c2ad54125de384bf1a767b) Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
* gh-92031, test_embed: Improve test for unquickening static code (GH-92440)Miss Islington (bot)2022-05-111-10/+30
| | | | | (cherry picked from commit 27185f98fff07b1da84f390f84dc9cbc7c8f0ad5) Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
* 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
|
* bpo-45020: Add tests for the -X "frozen_modules" option. (gh-28997)Eric Snow2021-10-251-0/+24
| | | | | We hadn't explicitly added any tests for this, so here they are. https://bugs.python.org/issue45020
* bpo-45506: Go back to not running most of test_embed in out-of-tree builds. ↵Eric Snow2021-10-191-1/+1
| | | | | | | (gh-29063) In gh-28954 I adjusted how test_embed determines if it should be skipped. That broke out-of-tree builds. This change fixes them. https://bugs.python.org/issue45506
* bpo-45020: Default to using frozen modules unless running from source tree. ↵Eric Snow2021-10-161-3/+11
| | | | | | | (gh-28940) The default was "off". Switching it to "on" means users get the benefit of frozen stdlib modules without having to do anything. There's a special-case for running-in-source-tree, so contributors don't get surprised when their stdlib changes don't get used. https://bugs.python.org/issue45020
* bpo-45471: Do not set PyConfig.stdlib_dir in Py_SetPythonHome(). (gh-28954)Eric Snow2021-10-141-1/+6
| | | | | The change in gh-28586 (bpo-45211) should not have included code to set _Py_path_config.stdlib_dir in Py_SetPythonHome(). We fix that here. https://bugs.python.org/issue45471
* bpo-45445: Fail if an invalid X-option is provided in the command line ↵Pablo Galindo Salgado2021-10-131-11/+12
| | | | (GH-28823)
* bpo-45453: Fix test_embed.StdPrinterTests (GH-28916)Victor Stinner2021-10-131-8/+4
| | | | | | | test_embed.StdPrinterTests now always use the file descriptor 1 for stdout, rather than using sys.__stdout__.fileno(). PyFile_NewStdPrinter() does crash if the argument is not 1 or 2. Fix also a few pyflakes warnings: remove unused import and variables.
* Fix typos in the Lib directory (GH-28775)Christian Clauss2021-10-061-2/+2
| | | | | Fix typos in the Lib directory as identified by codespell. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* bpo-45211: Remember the stdlib dir during startup. (gh-28586)Eric Snow2021-09-281-0/+17
| | | | | During runtime startup we figure out the stdlib dir but currently throw that information away. This change preserves it and exposes it via PyConfig.stdlib_dir, _Py_GetStdlibDir(), and sys._stdlib_dir. https://bugs.python.org/issue45211
* bpo-45211: Move helpers from getpath.c to internal API. (gh-28550)Eric Snow2021-09-271-1/+1
| | | | | | | | | | | | This accomplishes 2 things: * consolidates some common code between getpath.c and getpathp.c * makes the helpers available to code in other files FWIW, the signature of the join_relfile() function (in fileutils.c) intentionally mirrors that of Windows' PathCchCombineEx(). Note that this change is mostly moving code around. No behavior is meant to change. https://bugs.python.org/issue45211
* bpo-40413: test_embed tests calling Py_RunMain() multiple times (GH-28466)Victor Stinner2021-09-201-0/+8
| | | | | | Calling Py_InitializeFromConfig()+Py_RunMain() multiple times must not crash. Cleanup also test_get_argc_argv().
* bpo-45020: Freeze os, site, and codecs. (gh-28398)Eric Snow2021-09-171-5/+7
| | | https://bugs.python.org/issue45020
* bpo-45020: Add -X frozen_modules=[on|off] to explicitly control use of ↵Eric Snow2021-09-141-0/+2
| | | | | | | frozen modules. (gh-28320) Currently we freeze several modules into the runtime. For each of these modules it is essential to bootstrapping the runtime that they be frozen. Any other stdlib module that we later freeze into the runtime is not essential. We can just as well import from the .py file. This PR lets users explicitly choose which should be used, with the new "-X frozen_modules=[on|off]" CLI flag. The default is "off" for now. https://bugs.python.org/issue45020
* bpo-43950: Add option to opt-out of PEP-657 (GH-27023)Ammar Askar2021-07-071-0/+4
| | | | | Co-authored-by: Pablo Galindo <Pablogsal@gmail.com> Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com> Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
* bpo-44441: _PyImport_Fini2() resets PyImport_Inittab (GH-26874)Victor Stinner2021-06-231-3/+14
| | | | | Py_RunMain() now resets PyImport_Inittab to its initial value at exit. It must be possible to call PyImport_AppendInittab() or PyImport_ExtendInittab() at each Python initialization.
* bpo-43988: Use check disallow instantiation helper (GH-26392)Erlend Egeberg Aasland2021-05-271-3/+1
|
* bpo-44131: Py_FrozenMain() uses PyConfig_SetBytesArgv() (GH-26201)Victor Stinner2021-05-201-3/+7
| | | | | Moreover, Py_FrozenMain() relies on Py_InitializeFromConfig() to handle the PYTHONUNBUFFERED environment variable and configure C stdio streams like stdout (make the stream unbuffered).