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:
Gregory P. Smith 2022-05-09 16:03:46 -07:00 committed by GitHub
parent 22bddc864d
commit 6ed7c353b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 5 additions and 107 deletions

View file

@ -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"