Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit aed6c66

Browse files
committed
patch python#1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
1 parent 2da0fce commit aed6c66

5 files changed

Lines changed: 45 additions & 5 deletions

File tree

Doc/using/cmdline.rst

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,8 @@ Miscellaneous options
335335
Environment variables
336336
---------------------
337337

338+
These environment variables influence Python's behavior.
339+
338340
.. envvar:: PYTHONHOME
339341

340342
Change the location of the standard Python libraries. By default, the
@@ -350,7 +352,7 @@ Environment variables
350352

351353
.. envvar:: PYTHONPATH
352354

353-
Augments the default search path for module files. The format is the same as
355+
Augment the default search path for module files. The format is the same as
354356
the shell's :envvar:`PATH`: one or more directory pathnames separated by
355357
colons. Non-existent directories are silently ignored.
356358

@@ -400,6 +402,9 @@ Environment variables
400402
If this is set to a non-empty string it is equivalent to specifying the
401403
:option:`-i` option.
402404

405+
This variable can also be modified by Python code using :data:`os.environ`
406+
to force inspect mode on program termination.
407+
403408

404409
.. envvar:: PYTHONUNBUFFERED
405410

@@ -422,7 +427,40 @@ Environment variables
422427

423428
.. envvar:: PYTHONDONTWRITEBYTECODE
424429

425-
If given, Python won't try to write ``.pyc`` or ``.pyo`` files on the
430+
If this is set, Python won't try to write ``.pyc`` or ``.pyo`` files on the
426431
import of source modules.
427432

428433
.. versionadded:: 2.6
434+
435+
436+
.. envvar:: PYTHONEXECUTABLE
437+
438+
If this environment variable is set, ``sys.argv[0]`` will be set to its
439+
value instead of the value got through the C runtime. Only works on
440+
MacOS X.
441+
442+
443+
Debug-mode variables
444+
^^^^^^^^^^^^^^^^^^^^
445+
446+
Setting these variables only has an effect in a debug build of Python, that is,
447+
if Python was configured with the :opt:`--with-pydebug` build option.
448+
449+
.. envvar:: PYTHONTHREADDEBUG
450+
451+
If set, Python will print debug threading debug info.
452+
453+
.. versionchanged:: 2.6
454+
Previously, this variable was called ``THREADDEBUG``.
455+
456+
.. envvar:: PYTHONDUMPREFS
457+
458+
If set, Python will dump objects and reference counts still alive after
459+
shutting down the interpreter.
460+
461+
462+
.. envvar:: PYTHONMALLOCSTATS
463+
464+
If set, Python will print memory allocation statistics every time a new
465+
object arena is created, and on shutdown.
466+

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ What's New in Python 2.6 alpha 1?
1212
Core and builtins
1313
-----------------
1414

15+
- Patch #1668: renamed THREADDEBUG envvar to PYTHONTHREADDEBUG.
16+
1517
- Patch #602345: Add -B command line option, PYTHONDONTWRITEBYTECODE envvar
1618
and sys.dont_write_bytecode attribute. All these can be set to forbid Python
1719
to attempt to write compiled bytecode files.

Modules/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Options and arguments (and corresponding environment variables):\n\
6262
-B : don't write .py[co] files on import; also PYTHONDONTWRITEBYTECODE=x\n\
6363
-c cmd : program passed in as string (terminates option list)\n\
6464
-d : debug output from parser; also PYTHONDEBUG=x\n\
65-
-E : ignore environment variables (such as PYTHONPATH)\n\
65+
-E : ignore PYTHON* environment variables (such as PYTHONPATH)\n\
6666
-h : print this help message and exit (also --help)\n\
6767
-i : inspect interactively after running script; forces a prompt even\n\
6868
";

Python/import.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1630,7 +1630,7 @@ case_ok(char *buf, Py_ssize_t len, Py_ssize_t namelen, char *name)
16301630
FILEFINDBUF3 ffbuf;
16311631
APIRET rc;
16321632

1633-
if (getenv("PYTHONCASEOK") != NULL)
1633+
if (Py_GETENV("PYTHONCASEOK") != NULL)
16341634
return 1;
16351635

16361636
rc = DosFindFirst(buf,

Python/thread.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void
7979
PyThread_init_thread(void)
8080
{
8181
#ifdef Py_DEBUG
82-
char *p = getenv("THREADDEBUG");
82+
char *p = Py_GETENV("PYTHONTHREADDEBUG");
8383

8484
if (p) {
8585
if (*p)

0 commit comments

Comments
 (0)