diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-11-30 10:40:24 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-30 10:40:24 (GMT) |
commit | 5e3806f8cfd84722fc55d4299dc018ad9b0f8401 (patch) | |
tree | 436f0a963001f590a1193dba5c84627ba59513c2 /Doc | |
parent | 706e10b186992e086e661a62d2c8ec9588525b31 (diff) | |
download | cpython-5e3806f8cfd84722fc55d4299dc018ad9b0f8401.zip cpython-5e3806f8cfd84722fc55d4299dc018ad9b0f8401.tar.gz cpython-5e3806f8cfd84722fc55d4299dc018ad9b0f8401.tar.bz2 |
bpo-32101: Add PYTHONDEVMODE environment variable (#4624)
* 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.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/development.rst | 3 | ||||
-rw-r--r-- | Doc/library/sys.rst | 4 | ||||
-rw-r--r-- | Doc/using/cmdline.rst | 12 | ||||
-rw-r--r-- | Doc/whatsnew/3.7.rst | 11 |
4 files changed, 26 insertions, 4 deletions
diff --git a/Doc/library/development.rst b/Doc/library/development.rst index d2b5fa2..ab34e1f 100644 --- a/Doc/library/development.rst +++ b/Doc/library/development.rst @@ -24,3 +24,6 @@ The list of modules described in this chapter is: unittest.mock-examples.rst 2to3.rst test.rst + +See also the Python development mode: the :option:`-X` ``dev`` option and +:envvar:`PYTHONDEVMODE` environment variable. diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index faf540c..9e47681 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -334,6 +334,7 @@ always available. :const:`bytes_warning` :option:`-b` :const:`quiet` :option:`-q` :const:`hash_randomization` :option:`-R` + :const:`dev_mode` :option:`-X` ``dev`` ============================= ============================= .. versionchanged:: 3.2 @@ -345,6 +346,9 @@ always available. .. versionchanged:: 3.3 Removed obsolete ``division_warning`` attribute. + .. versionchanged:: 3.7 + Added ``dev_mode`` attribute for the new :option:`-X` ``dev`` flag. + .. data:: float_info diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst index e6189fd..d110ae3 100644 --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -411,7 +411,7 @@ Miscellaneous options nested imports). Note that its output may be broken in multi-threaded application. Typical usage is ``python3 -X importtime -c 'import asyncio'``. See also :envvar:`PYTHONPROFILEIMPORTTIME`. - * ``-X dev``: enable CPython's "developer mode", introducing additional + * ``-X dev``: enable CPython's "development mode", introducing additional runtime checks which are too expensive to be enabled by default. It should not be more verbose than the default if the code is correct: new warnings are only emitted when an issue is detected. Effect of the developer mode: @@ -426,6 +426,8 @@ Miscellaneous options * Enable the :mod:`faulthandler` module to dump the Python traceback on a crash. * Enable :ref:`asyncio debug mode <asyncio-debug-mode>`. + * Set the :attr:`~sys.flags.dev_mode` attribute of :attr:`sys.flags` to + ``True`` It also allows passing arbitrary values and retrieving them through the :data:`sys._xoptions` dictionary. @@ -796,6 +798,14 @@ conflict. .. versionadded:: 3.7 See :pep:`538` for more details. + +.. envvar:: PYTHONDEVMODE + + If this environment variable is set to a non-empty string, enable the + CPython "development mode". See the :option:`-X` ``dev`` option. + + .. versionadded:: 3.7 + Debug-mode variables ~~~~~~~~~~~~~~~~~~~~ diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst index 5c00159..6545a18 100644 --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -185,10 +185,10 @@ resolution on Linux and Windows. PEP written and implemented by Victor Stinner -New Developer Mode: -X dev --------------------------- +New Development Mode: -X dev +---------------------------- -Add a new "developer mode": ``-X dev`` command line option to enable debug +Add a new "development mode": ``-X dev`` command line option to enable debug checks at runtime. In short, ``python3 -X dev ...`` behaves as ``PYTHONMALLOC=debug python3 -W @@ -371,6 +371,11 @@ string expression pattern for braced placeholders and non-braced placeholders separately. (Contributed by Barry Warsaw in :issue:`1198569`.) +sys +--- + +Added :attr:`sys.flags.dev_mode` flag for the new development mode. + time ---- |