aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_cmd_line.py
Commit message (Collapse)AuthorAge
* gh-121016: Add test for `PYTHON_BASIC_REPL` envioronment variable (#121017)devdanzin2024-06-26
|
* gh-119574: Add some missing environment variables to '--help-env'. (GH-120006)devdanzin2024-06-18
|
* gh-120417: Add #noqa: F401 to tests (#120627)Victor Stinner2024-06-18
| | | | Ignore linter "imported but unused" warnings in tests when the linter doesn't understand how the import is used.
* Fixing a typo in test_cmd_line.py (#118728)Yutian Li2024-05-08
|
* gh-112730: Make the test suite resilient to color-activation environment ↵Pablo Galindo Salgado2024-04-24
| | | | variables (#117672)
* gh-116858: Add `@cpython_only` to several tests in `test_cmd_line` (#116859)Nikita Sobolev2024-03-16
|
* gh-116167: Allow disabling the GIL with `PYTHON_GIL=0` or `-X gil=0` (#116338)Brett Simmers2024-03-11
| | | | | | | | | In free-threaded builds, running with `PYTHON_GIL=0` will now disable the GIL. Follow-up issues track work to re-enable the GIL when loading an incompatible extension, and to disable the GIL by default. In order to support re-enabling the GIL at runtime, all GIL-related data structures are initialized as usual, and disabling the GIL simply sets a flag that causes `take_gil()` and `drop_gil()` to return early.
* gh-107954: Add PyConfig_MEMBER_BOOL type to PyConfigSpec (#116359)Victor Stinner2024-03-06
| | | | | | _PyConfig_AsDict() now returns bool objects for options using the new PyConfig_MEMBER_BOOL type. Update tests for these changes.
* gh-112532: Require mimalloc in `--disable-gil` builds (gh-112883)Sam Gross2023-12-12
|
* gh-108082: Use PyErr_FormatUnraisable() (GH-111580)Serhiy Storchaka2023-11-02
| | | | | | Replace most of calls of _PyErr_WriteUnraisableMsg() and some calls of PyErr_WriteUnraisable(NULL) with PyErr_FormatUnraisable(). Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-111374: Add a new PYTHON_FROZEN_MODULES env var, equivalent of `-X ↵Yilei Yang2023-11-01
| | | | | | | frozen_modules`. (#111411) Adds a new PYTHON_FROZEN_MODULES env var to correspond with -X frozen_modules. Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
* gh-90815: Add mimalloc memory allocator (#109914)Dino Viehland2023-10-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* gh-109595: Add -Xcpu_count=<n> cmdline for container users (#109667)Donghee Na2023-10-10
| | | | | | --------- Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
* gh-109721: Guard `_testinternalcapi` imports in tests (GH-109722)Nikita Sobolev2023-09-22
|
* gh-106320: Remove private _PyMem API (#107187)Victor Stinner2023-07-24
| | | | | | | | | | | | | 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.
* gh-96512: Move int_max_str_digits setting to PyConfig (#96944)Gregory P. Smith2022-10-03
| | | | | | | | | | | 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-96848: Fix -X int_max_str_digits option parsing (#96988)Victor Stinner2022-09-26
| | | | | Fix command line parsing: reject "-X int_max_str_digits" option with no value (invalid) when the PYTHONINTMAXSTRDIGITS environment variable is set to a valid limit.
* gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96499)Gregory P. Smith2022-09-02
| | | | | | | | | | | | | | | | Integer to and from text conversions via CPython's bignum `int` type is not safe against denial of service attacks due to malicious input. Very large input strings with hundred thousands of digits can consume several CPU seconds. This PR comes fresh from a pile of work done in our private PSRT security response team repo. Signed-off-by: Christian Heimes [Red Hat] <christian@python.org> Tons-of-polishing-up-by: Gregory P. Smith [Google] <greg@krypto.org> Reviews via the private PSRT repo via many others (see the NEWS entry in the PR). <!-- gh-issue-number: gh-95778 --> * Issue: gh-95778 <!-- /gh-issue-number --> I wrote up [a one pager for the release managers](https://docs.google.com/document/d/1KjuF_aXlzPUxTK4BMgezGJ2Pn7uevfX7g0_mvgHlL7Y/edit#). Much of that text wound up in the Issue. Backports PRs already exist. See the issue for links.
* bpo-45445: Revert "bpo-45445: Fail if an invalid X-option is provided in the ↵Pablo Galindo Salgado2022-07-31
| | | | command line (GH-28823)" (#94745)
* gh-90300: split --help output into separate options (#30331)Éric2022-06-01
| | | | | | Make --help output shorter and add new help options. --help-env, --help-xoptions and --help-all command-line options are added to complement --help.
* gh-69443: Add test.support.Py_DEBUG constant (#93226)Victor Stinner2022-05-26
|
* gh-57684: Update tests for PYTHONSAFEPATH=1 (#92358)Victor Stinner2022-05-06
| | | | | Fix tests failing with the PYTHONSAFEPATH=1 env var. Enhance also -P help in Python usage (python --help).
* gh-57684: Add -P cmdline option and PYTHONSAFEPATH env var (#31542)Victor Stinner2022-05-06
| | | | | | | | | | | | 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-91156: Use `locale.getencoding()` instead of getpreferredencoding (GH-91732)Inada Naoki2022-04-22
| | | Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-46421: Fix unittest filename evaluation when called as a module (GH-30654)Bader Zaidan2022-03-17
|
* bpo-1635741: test_embed cheks that Python does not leak (GH-31555)Victor Stinner2022-02-25
|
* bpo-40280: Skip subprocess-based tests on wasm32-emscripten (GH-30615)Christian Heimes2022-01-25
|
* bpo-46417: Clear symtable identifiers at exit (GH-30809)Victor Stinner2022-01-23
| | | | | | Add _PySymtable_Fini() function, called by finalize_interp_clear(). Update test_cmd_line.test_showrefcount() to tolerate negative reference count.
* bpo-45020: Add tests for the -X "frozen_modules" option. (gh-28997)Eric Snow2021-10-25
| | | | | We hadn't explicitly added any tests for this, so here they are. https://bugs.python.org/issue45020
* bpo-45445: Fail if an invalid X-option is provided in the command line ↵Pablo Galindo Salgado2021-10-13
| | | | (GH-28823)
* bpo-45229: Remove test_main in many tests (GH-28405)Serhiy Storchaka2021-09-19
| | | | | | | | | Instead of explicitly enumerate test classes for run_unittest() use the unittest ability to discover tests. This also makes these tests discoverable and runnable with unittest. load_tests() can be used for dynamic generating tests and adding doctests. setUpModule(), tearDownModule() and addModuleCleanup() can be used for running code before and after all module tests.
* bpo-43825: Fix deprecation warnings in test_cmd_line and test_collections ↵Karthikeyan Singaravelan2021-04-14
| | | | | | (GH-25380) * Fix deprecation warnings due to invalid escape sequences. * Use self.assertEqual instead of deprecated self.assertEquals.
* bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25145)Inada Naoki2021-04-04
| | | | | | | | | | | | | | | | | | | * test_asyncio * test_bz2 * test_math * test_cmath * test_cmd_line * test_cmd_line_script * test_compile * test_contextlib * test_profile * ctypes/test/test_find * test_multiprocessing * test_configparser * test_csv * test_dbm_dumb * test_decimal * test_difflib * os.fdopen() calls io.text_encoding() to emit EncodingWarning for right place.
* bpo-43591: Fix error location in interactive mode for errors at the end of ↵Pablo Galindo2021-03-22
| | | | | the line (GH-24973) Co-authored-by: Erlend Egeberg Aasland
* bpo-35883: Py_DecodeLocale() escapes invalid Unicode characters (GH-24843)Victor Stinner2021-03-17
| | | | | | | | | | Python no longer fails at startup with a fatal error if a command line argument contains an invalid Unicode character. The Py_DecodeLocale() function now escapes byte sequences which would be decoded as Unicode characters outside the [U+0000; U+10ffff] range. Use MAX_UNICODE constant in unicodeobject.c.
* bpo-43410: Fix crash in the parser when producing syntax errors when reading ↵Pablo Galindo2021-03-14
| | | | from stdin (GH-24763)
* bpo-32381: pymain_run_command() uses PyCF_IGNORE_COOKIE (GH-23724)Victor Stinner2020-12-23
| | | | | | | | | | The coding cookie (ex: "# coding: latin1") is now ignored in the command passed to the -c command line option. Since pymain_run_command() uses UTF-8, pass PyCF_IGNORE_COOKIE compiler flag to the parser. pymain_run_python() no longer propages compiler flags between function calls.
* bpo-41525: Make the Python program help ASCII-only (GH-21836)Serhiy Storchaka2020-09-09
|
* bpo-40275: Use new test.support helper submodules in tests (GH-20849)Hai Shi2020-06-25
|
* bpo-40527: Fix command line argument parsing (GH-19955)Victor Stinner2020-05-06
|
* bpo-13601: always use line-buffering for sys.stderr (GH-17646)Jendrik Seipp2020-01-01
|
* bpo-38991: Remove test.support.strip_python_stderr() (GH-17490)Victor Stinner2019-12-08
| | | | | test.support: run_python_until_end(), assert_python_ok() and assert_python_failure() functions no longer strip whitespaces from stderr.
* Remove unused imports in tests (GH-14518)Victor Stinner2019-07-01
|
* bpo-31904: Port test_cmd_line to VxWorks (#12648)Lihua Zhao2019-04-17
| | | subprocess.Popen doesn't support preexec on VxWorks.
* Revert "bpo-34589: Add -X coerce_c_locale command line option (GH-9378)" ↵Victor Stinner2018-09-19
| | | | | | | | | | | | | | | | (GH-9430) * Revert "bpo-34589: Add -X coerce_c_locale command line option (GH-9378)" This reverts commit dbdee0073cf0b88fe541980ace1f650900f455cc. * Revert "bpo-34589: C locale coercion off by default (GH-9073)" This reverts commit 7a0791b6992d420dc52536257f2f093851ed7215. * Revert "bpo-34589: Make _PyCoreConfig.coerce_c_locale private (GH-9371)" This reverts commit 188ebfa475a6f6aa2d0ea14ca8e1fbe7865b6d27.
* bpo-34589: Add -X coerce_c_locale command line option (GH-9378)Victor Stinner2018-09-17
| | | | Add a new -X coerce_c_locale command line option to control C locale coercion (PEP 538).
* bpo-34170: Enhance _PyCoreConfig_Read() (GH-8468)Victor Stinner2018-07-26
| | | | | | | | | | | | * Inline cmdline_get_env_flags() into config_read_env_vars(): _PyCoreConfig_Read() now reads much more environment variables like PYTHONVERBOSE. * Allow to override faulthandler and allocator even if dev_mode=1. PYTHONMALLOC is now the priority over PYTHONDEVMODE. * Fix _PyCoreConfig_Copy(): copy also install_signal_handlers, coerce_c_locale and coerce_c_locale_warn * _PyCoreConfig.install_signal_handlers default is now 1: install signals by default * Fix also a compiler warning: don't define _PyPathConfig type twice.
* bpo-34170: Add _PyCoreConfig.bytes_warning (GH-8447)Victor Stinner2018-07-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add more fields to _PyCoreConfig: * _check_hash_pycs_mode * bytes_warning * debug * inspect * interactive * legacy_windows_fs_encoding * legacy_windows_stdio * optimization_level * quiet * unbuffered_stdio * user_site_directory * verbose * write_bytecode Changes: * Remove pymain_get_global_config() and pymain_set_global_config() which became useless. These functions have been replaced by _PyCoreConfig_GetGlobalConfig() and _PyCoreConfig_SetGlobalConfig(). * sys.flags.dont_write_bytecode value is now restricted to 1 even if -B option is specified multiple times on the command line. * PyThreadState_Clear() now uses the config from the current interpreter rather than using global Py_VerboseFlag
* Revert "bpo-33671: Add support.MS_WINDOWS and support.MACOS (GH-7800)" (GH-7919)Victor Stinner2018-06-26
| | | This reverts commit 8fbbdf0c3107c3052659e166f73990b466eacbb0.
* bpo-33671: Add support.MS_WINDOWS and support.MACOS (GH-7800)Victor Stinner2018-06-22
| | | | | | | | * Add support.MS_WINDOWS: True if Python is running on Microsoft Windows. * Add support.MACOS: True if Python is running on Apple macOS. * Replace support.is_android with support.ANDROID * Replace support.is_jython with support.JYTHON * Cleanup code to initialize unix_shell