Skip to content

Commit 99ed302

Browse files
authored
gh-118761: Always lazy import warnings in threading (#129428)
1 parent 49f2465 commit 99ed302

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Lib/threading.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import os as _os
44
import sys as _sys
55
import _thread
6-
import warnings
76

87
from time import monotonic as _time
98
from _weakrefset import WeakSet
@@ -133,6 +132,7 @@ def RLock(*args, **kwargs):
133132
134133
"""
135134
if args or kwargs:
135+
import warnings
136136
warnings.warn(
137137
'Passing arguments to RLock is deprecated and will be removed in 3.15',
138138
DeprecationWarning,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Always lazy import ``warnings`` in :mod:`threading`. Patch by Taneli
2+
Hukkinen.

0 commit comments

Comments
 (0)