mirror of
https://github.com/python/cpython.git
synced 2025-10-06 15:11:58 +00:00
gh-88750: Remove the PYTHONTHREADDEBUG env var support. (#92509)
Remove the `PYTHONTHREADDEBUG` env var support. Remove no-op dprintf() macro calls.
This commit is contained in:
parent
22bddc864d
commit
6ed7c353b8
9 changed files with 5 additions and 107 deletions
|
@ -42,14 +42,6 @@
|
|||
|
||||
#endif /* _POSIX_THREADS */
|
||||
|
||||
|
||||
#ifdef Py_DEBUG
|
||||
static int thread_debug = 0;
|
||||
# define dprintf(args) (void)((thread_debug & 1) && printf args)
|
||||
#else
|
||||
# define dprintf(args)
|
||||
#endif
|
||||
|
||||
static int initialized;
|
||||
|
||||
static void PyThread__init_thread(void); /* Forward */
|
||||
|
@ -57,42 +49,12 @@ static void PyThread__init_thread(void); /* Forward */
|
|||
void
|
||||
PyThread_init_thread(void)
|
||||
{
|
||||
#ifdef Py_DEBUG
|
||||
const char *p = Py_GETENV("PYTHONTHREADDEBUG");
|
||||
|
||||
if (p) {
|
||||
if (*p)
|
||||
thread_debug = atoi(p);
|
||||
else
|
||||
thread_debug = 1;
|
||||
}
|
||||
#endif /* Py_DEBUG */
|
||||
if (initialized)
|
||||
return;
|
||||
initialized = 1;
|
||||
dprintf(("PyThread_init_thread called\n"));
|
||||
PyThread__init_thread();
|
||||
}
|
||||
|
||||
void
|
||||
_PyThread_debug_deprecation(void)
|
||||
{
|
||||
#ifdef Py_DEBUG
|
||||
if (thread_debug) {
|
||||
// Flush previous dprintf() logs
|
||||
fflush(stdout);
|
||||
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||
"The threading debug (PYTHONTHREADDEBUG environment "
|
||||
"variable) is deprecated and will be removed "
|
||||
"in Python 3.12",
|
||||
0))
|
||||
{
|
||||
_PyErr_WriteUnraisableMsg("at Python startup", NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(_POSIX_THREADS)
|
||||
# define PYTHREAD_NAME "pthread"
|
||||
# include "thread_pthread.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue