summaryrefslogtreecommitdiffstats
path: root/Python/thread.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-08-06 11:32:37 (GMT)
committerGitHub <noreply@github.com>2021-08-06 11:32:37 (GMT)
commita11158ecef8cff795f7db8f4047cbd20cc9cf37e (patch)
treed2bb78bba2629fca01ef6666a80360ed537b06cb /Python/thread.c
parent0a642d57736be6802c712bdbf2dcff39fe8a39b7 (diff)
downloadcpython-a11158ecef8cff795f7db8f4047cbd20cc9cf37e.zip
cpython-a11158ecef8cff795f7db8f4047cbd20cc9cf37e.tar.gz
cpython-a11158ecef8cff795f7db8f4047cbd20cc9cf37e.tar.bz2
bpo-44584: Deprecate PYTHONTHREADDEBUG env var (GH-27065)
The threading debug (PYTHONTHREADDEBUG environment variable) is deprecated in Python 3.10 and will be removed in Python 3.12. This feature requires a debug build of Python. (cherry picked from commit 4d77691172aae81bdcbb0ea75839d0e896c43781) Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Python/thread.c')
-rw-r--r--Python/thread.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/Python/thread.c b/Python/thread.c
index a10f572..dfe28b6 100644
--- a/Python/thread.c
+++ b/Python/thread.c
@@ -75,6 +75,25 @@ PyThread_init_thread(void)
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"