mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
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 4d77691172)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
0a642d5773
commit
a11158ecef
7 changed files with 49 additions and 1 deletions
|
|
@ -32,6 +32,9 @@
|
|||
# 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 @@ def noop(): pass
|
|||
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):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue