File tree Expand file tree Collapse file tree 1 file changed +0
-31
lines changed Expand file tree Collapse file tree 1 file changed +0
-31
lines changed Original file line number Diff line number Diff line change 9
9
import copy
10
10
import threading
11
11
import time
12
- import types
13
12
import random
14
13
import textwrap
15
14
@@ -2253,36 +2252,6 @@ def test_names(self):
2253
2252
self .assertEqual (obj .__name__ , name )
2254
2253
self .assertEqual (obj .__qualname__ , name )
2255
2254
2256
- @threading_helper .requires_working_threading ()
2257
- @unittest .skipUnless (support .Py_GIL_DISABLED , 'only used under free-threaded build' )
2258
- def test_module_weakref (self ):
2259
- # gh-135607: Avoid potential races on module weaklist under free-threaded build
2260
- mod = types .ModuleType ("temp_mod" )
2261
- common_ref = weakref .ref (mod )
2262
- threads = []
2263
- n_threads = 10
2264
- b = threading .Barrier (n_threads )
2265
-
2266
- def weakref_mod_worker ():
2267
- b .wait ()
2268
- r = weakref .ref (mod )
2269
- rr = r ()
2270
- self .assertIs (rr , mod )
2271
- self .assertIs (rr , common_ref ())
2272
-
2273
- for i in range (n_threads ):
2274
- t = threading .Thread (target = weakref_mod_worker )
2275
- threads .append (t )
2276
- t .start ()
2277
-
2278
- for t in threads :
2279
- t .join ()
2280
-
2281
- r = weakref .ref (mod )
2282
- self .assertIsNotNone (r , "weak ref to a module should not be None" )
2283
- self .assertIs (r (), common_ref ())
2284
- del mod
2285
-
2286
2255
2287
2256
libreftest = """ Doctest for examples in the library reference: weakref.rst
2288
2257
You can’t perform that action at this time.
0 commit comments