summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_cmd_line.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-29240, bpo-32030: Py_Main() re-reads config if encoding changes (#4899)Victor Stinner2017-12-161-1/+1
| | | | | | | | | | | | | | | | | | bpo-29240, bpo-32030: If the encoding change (C locale coerced or UTF-8 Mode changed), Py_Main() now reads again the configuration with the new encoding. Changes: * Add _Py_UnixMain() called by main(). * Rename pymain_free_pymain() to pymain_clear_pymain(), it can now be called multipled times. * Rename pymain_parse_cmdline_envvars() to pymain_read_conf(). * Py_Main() now clears orig_argc and orig_argv at exit. * Remove argv_copy2, Py_Main() doesn't modify argv anymore. There is no need anymore to get two copies of the wchar_t** argv. * _PyCoreConfig: add coerce_c_locale and coerce_c_locale_warn. * Py_UTF8Mode is now initialized to -1. * Locale coercion (PEP 538) now respects -I and -E options.
* bpo-32329: Fix -R option for hash randomization (#4873)Victor Stinner2017-12-141-2/+10
| | | | | | | | | | | | bpo-32329, bpo-32030: * The -R option now turns on hash randomization when the PYTHONHASHSEED environment variable is set to 0 Previously, the option was ignored. * sys.flags.hash_randomization is now properly set to 0 when hash randomization is turned off by PYTHONHASHSEED=0. * _PyCoreConfig_ReadEnv() now reads the PYTHONHASHSEED environment variable. _Py_HashRandomization_Init() now only apply the configuration, it doesn't read PYTHONHASHSEED anymore.
* bpo-32230: Set sys.warnoptions with -X dev (#4820)Victor Stinner2017-12-121-21/+60
| | | | | | | | | | | | | | Rather than supporting dev mode directly in the warnings module, this instead adjusts the initialisation code to add an extra 'default' entry to sys.warnoptions when dev mode is enabled. This ensures that dev mode behaves *exactly* as if `-Wdefault` had been passed on the command line, including in the way it interacts with `sys.warnoptions`, and with other command line flags like `-bb`. Fix also bpo-20361: have -b & -bb options take precedence over any other warnings options. Patch written by Nick Coghlan, with minor modifications of Victor Stinner.
* bpo-32101: Add PYTHONDEVMODE environment variable (#4624)Victor Stinner2017-11-301-2/+35
| | | | | | * bpo-32101: Add sys.flags.dev_mode flag Rename also the "Developer mode" to the "Development mode". * bpo-32101: Add PYTHONDEVMODE environment variable Mention it in the development chapiter.
* bpo-32030: Rework memory allocators (#4625)Victor Stinner2017-11-291-2/+50
| | | | | | | | | | | | | | | | | | | | * Fix _PyMem_SetupAllocators("debug"): always restore allocators to the defaults, rather than only caling _PyMem_SetupDebugHooks(). * Add _PyMem_SetDefaultAllocator() helper to set the "default" allocator. * Add _PyMem_GetAllocatorsName(): get the name of the allocators * main() now uses debug hooks on memory allocators if Py_DEBUG is defined, rather than calling directly malloc() * Document default memory allocators in C API documentation * _Py_InitializeCore() now fails with a fatal user error if PYTHONMALLOC value is an unknown memory allocator, instead of failing with a fatal internal error. * Add new tests on the PYTHONMALLOC environment variable * Add support.with_pymalloc() * Add the _testcapi.WITH_PYMALLOC constant and expose it as support.with_pymalloc(). * sysconfig.get_config_var('WITH_PYMALLOC') doesn't work on Windows, so replace it with support.with_pymalloc(). * pythoninfo: add _testcapi collector for pymem
* bpo-32089: Use default action for ResourceWarning (#4584)Victor Stinner2017-11-271-17/+4
| | | | | In development and debug mode, use the "default" action, rather than the "always" action, for ResourceWarning in the default warnings filters.
* bpo-32089: Fix warnings filters in dev mode (#4482)Victor Stinner2017-11-211-6/+46
| | | | | | | | | | The developer mode (-X dev) now creates all default warnings filters to order filters in the correct order to always show ResourceWarning and make BytesWarning depend on the -b option. Write a functional test to make sure that ResourceWarning is logged twice at the same location in the developer mode. Add a new 'dev_mode' field to _PyCoreConfig.
* bpo-32043: New "developer mode": "-X dev" option (#4413)Victor Stinner2017-11-161-14/+55
| | | | | | | | | | | | | Add a new "developer mode": new "-X dev" command line option to enable debug checks at runtime. Changes: * Add unit tests for -X dev * test_cmd_line: replace test.support with support. * Fix _PyRuntimeState_Fini(): Use the same memory allocator than _PyRuntimeState_Init(). * Fix _PyMem_GetDefaultRawAllocator()
* bpo-31845: Fix reading flags from environment (GH-4105)Nick Coghlan2017-10-251-1/+34
| | | | | | | | | | The startup refactoring means command line settings are now applied after settings are read from the environment. This updates the way command line settings are applied to account for that, ensures more settings are first read from the environment in _PyInitializeCore, and adds a simple test case covering the flags that are easy to check.
* bpo-30404: The -u option now makes the stdout and stderr streams totally ↵Serhiy Storchaka2017-10-041-4/+3
| | | | unbuffered. (#1667)
* bpo-28180: Implementation for PEP 538 (#659)Nick Coghlan2017-06-111-2/+4
| | | | | | | | | | - new PYTHONCOERCECLOCALE config setting - coerces legacy C locale to C.UTF-8, C.utf8 or UTF-8 by default - always uses C.UTF-8 on Android - uses `surrogateescape` on stdin and stdout in the coercion target locales - configure option to disable locale coercion at build time - configure option to disable C locale warning at build time
* bpo-22257: Small changes for PEP 432. (#1728)Eric Snow2017-05-231-1/+22
| | | PEP 432 specifies a number of large changes to interpreter startup code, including exposing a cleaner C-API. The major changes depend on a number of smaller changes. This patch includes all those smaller changes.
* Remove unused imports.Serhiy Storchaka2016-12-161-1/+0
|
* Issue #26919: On Android, operating system data is now always encoded/decodedXavier de Gaye2016-12-151-4/+5
| | | | | to/from UTF-8, instead of the locale encoding to avoid inconsistencies with os.fsencode() and os.fsdecode() which are already using UTF-8.
* Issue #28532: Show sys.version when -V option is supplied twiceINADA Naoki2016-11-211-1/+1
|
* Merge spelling and grammar fixes from 3.5Martin Panter2016-08-051-1/+1
|\
| * Fix spelling and grammar in documentation and code commentsMartin Panter2016-08-041-1/+1
| |
* | * Re-fix issue #19284: Don't generate the no-op -R command lineGregory P. Smith2015-12-141-3/+15
|\ \ | |/ | | | | | | | | | | | | parameter to "enable" the always on sys.flags.hash_randomization in _args_from_interpreter_flags() used by multiprocessing and some unittests. This simplifies the code. * assert_python_ok docstring typo fix. * Fix test_cmd_line not to fail if PYTHONHASHSEED is set to a fixed seed.
| * * Re-fix issue #19284: Don't generate the no-op -R command lineGregory P. Smith2015-12-141-3/+15
| |\ | | | | | | | | | | | | | | | | | | | | | parameter to "enable" the always on sys.flags.hash_randomization in _args_from_interpreter_flags() used by multiprocessing and some unittests. This simplifies the code. * assert_python_ok docstring typo fix. * Fix test_cmd_line not to fail if PYTHONHASHSEED is set to a fixed seed.
| | * Fix test_cmd_line not to fail if PYTHONHASHSEED is set to a fixed seedGregory P. Smith2015-12-141-3/+15
| | | | | | | | | | | | due to test_hash_randomization expecting a different seed per process.
* | | Issue #5319: New Py_FinalizeEx() API to exit with status 120 on failureMartin Panter2015-11-301-1/+2
|/ /
* | Issue #9517: Move script_helper to the support package.Berker Peksag2015-05-061-3/+3
| | | | | | | | Patch by Christie Wilson.
* | Merge: #23925: stop (eg) PYTHONSTARTUP from causing test_cmd_line failure.R David Murray2015-04-141-1/+5
|\ \ | |/
| * #23925: stop (eg) PYTHONSTARTUP from causing test_cmd_line failure.R David Murray2015-04-141-1/+5
| | | | | | | | Patch by Jamiel Almeida.
* | Suppress assert dialogs in test_cmd_line.Steve Dower2015-03-081-1/+2
| |
* | Skip some tests that require a subinterpreter launched with -E or -I when theGregory P. Smith2015-02-041-1/+3
|\ \ | |/ | | | | | | | | | | | | interpreter under test is being run in an environment that requires the use of environment variables such as PYTHONHOME in order to function at all. Adds a test.script_helper.interpreter_requires_environment() function to be used with @unittest.skipIf on stdlib test methods requiring this.
| * Skip some tests that require a subinterpreter launched with -E or -I when theGregory P. Smith2015-02-041-1/+3
|/ | | | | | | | interpreter under test is being run in an environment that requires the use of environment variables such as PYTHONHOME in order to function at all. Adds a private test.script_helper._interpreter_requires_environment() function to be used with @unittest.skipIf on stdlib test methods requiring this.
* revert 7b833bd1f509. I misread the side effect that the code was triggering.Gregory P. Smith2015-01-231-2/+4
| | | | | *any* kwarg supplied to _assert_python causes it to not append -E to the command line flags so without='-E' does effectively work.
* Remove the unimplemented but ignored without='-E' parameters being passed toGregory P. Smith2015-01-231-4/+2
| | | | | | script_helper.assert_python_failure(). No such feature has ever existed, thus it doesn't do what the comment claims. (It does add a 'without' variable to the environment of the child process but that was not intended)
* Close #18754: Run Python child processes in isolated more in the test suite.Victor Stinner2013-10-121-1/+1
|
* Issue #16400: Add command line option for isolated mode.Christian Heimes2013-08-101-0/+26
| | | | | | | | | | -I Run Python in isolated mode. This also implies -E and -s. In isolated mode sys.path contains neither the script’s directory nor the user’s site-packages directory. All PYTHON* environment variables are ignored, too. Further restrictions may be imposed to prevent the user from injecting malicious code.
* Issue #18338: `python --version` now prints version string to stdout, andSerhiy Storchaka2013-07-111-2/+4
| | | | not to stderr. Patch by Berker Peksag and Michael Dickens.
* Issue #17206: Fix test_cmd_line and test_faulthandler for my previous changeVictor Stinner2013-06-251-5/+12
| | | | | (test.regrtest and test.script_helper enable faulthandler module in subprocesses).
* Issue #17516: do not create useless tuple: remove dummy commas in testsVictor Stinner2013-03-261-2/+2
|
* #17323: The "[X refs, Y blocks]" printed by debug builds has been disabled ↵Ezio Melotti2013-03-251-0/+28
| | | | by default. It can be re-enabled with the `-X showrefcount` option.
* Merge debug print removal with 3.3.Ezio Melotti2012-11-231-4/+0
|\
| * Merge debug print removal with 3.2.Ezio Melotti2012-11-231-4/+0
| |\
| | * Remove debug print.Ezio Melotti2012-11-231-4/+0
| | |
* | | #16306: merge with 3.3.Ezio Melotti2012-11-231-3/+15
|\ \ \ | |/ /
| * | #16306: merge with 3.2.Ezio Melotti2012-11-231-3/+15
| |\ \ | | |/
| | * #16306: report only the first unknown option and add more tests. Patch by ↵Ezio Melotti2012-11-231-3/+15
| | | | | | | | | | | | Serhiy Storchaka.
* | | #16309: avoid using deprecated method and turn docstring in a comment.Ezio Melotti2012-11-221-6/+6
| | |
* | | #16306: merge with 3.3.Ezio Melotti2012-11-181-1/+8
|\ \ \ | |/ /
| * | #16306: merge with 3.2.Ezio Melotti2012-11-181-1/+8
| |\ \ | | |/
| | * #16306: Fix multiple error messages when unknown command line parameters ↵Ezio Melotti2012-11-181-1/+8
| | | | | | | | | | | | where passed to the interpreter. Patch by Hieu Nguyen.
| * | Issue #16218, #16444: Backport improvment on tests for non-ASCII charactersVictor Stinner2012-11-121-3/+3
| | |
* | | Issue #15001: fix segfault on "del sys.module['__main__']"Hynek Schlawack2012-11-071-0/+12
|\ \ \ | |/ / | | | | | | Patch by Victor Stinner.
| * | Issue #15001: fix segfault on "del sys.module['__main__']"Hynek Schlawack2012-11-071-0/+12
| |\ \ | | |/ | | | | | | Patch by Victor Stinner.
| | * Issue #15001: fix segfault on "del sys.module['__main__']"Hynek Schlawack2012-11-071-0/+12
| | | | | | | | | | | | Patch by Victor Stinner.
| | * Close #13119: use "\r\n" newline for sys.stdout/err on WindowsVictor Stinner2012-08-031-0/+17
| | | | | | | | | | | | sys.stdout and sys.stderr are now using "\r\n" newline on Windows, as Python 2.