diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-08-06 11:32:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-06 11:32:37 (GMT) |
commit | a11158ecef8cff795f7db8f4047cbd20cc9cf37e (patch) | |
tree | d2bb78bba2629fca01ef6666a80360ed537b06cb /Lib/test/test_threading.py | |
parent | 0a642d57736be6802c712bdbf2dcff39fe8a39b7 (diff) | |
download | cpython-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 'Lib/test/test_threading.py')
-rw-r--r-- | Lib/test/test_threading.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index 23fe2d3..c51de6f 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -32,6 +32,9 @@ from test import support # on platforms known to behave badly. platforms_to_skip = ('netbsd5', 'hp-ux11') +# Is Python built with Py_DEBUG macro defined? +Py_DEBUG = hasattr(sys, 'gettotalrefcount') + def restore_default_excepthook(testcase): testcase.addCleanup(setattr, threading, 'excepthook', threading.excepthook) @@ -915,6 +918,16 @@ class ThreadTests(BaseTestCase): threading.Thread(target=noop).start() # Thread.join() is not called + @unittest.skipUnless(Py_DEBUG, 'need debug build (Py_DEBUG)') + def test_debug_deprecation(self): + # bpo-44584: The PYTHONTHREADDEBUG environment variable is deprecated + rc, out, err = assert_python_ok("-Wdefault", "-c", "pass", + PYTHONTHREADDEBUG="1") + msg = (b'DeprecationWarning: The threading debug ' + b'(PYTHONTHREADDEBUG environment variable) ' + b'is deprecated and will be removed in Python 3.12') + self.assertIn(msg, err) + class ThreadJoinOnShutdown(BaseTestCase): |