Skip to content

Commit e14adc4

Browse files
authored
Merge pull request #1936 from RustPython/coolreader18/_thread-start_new_thread
Add _thread.start_new_thread
2 parents b2cd95c + 90223d8 commit e14adc4

15 files changed

+1491
-77
lines changed

Cargo.lock

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Lib/_rp_thread.py

-7
This file was deleted.

Lib/_weakrefset.py

+3
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,6 @@ def union(self, other):
194194

195195
def isdisjoint(self, other):
196196
return len(self.intersection(other)) == 0
197+
198+
def __repr__(self):
199+
return repr(self.data)

Lib/importlib/_bootstrap.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -1149,12 +1149,21 @@ def _setup(sys_module, _imp_module):
11491149

11501150
# Directly load built-in modules needed during bootstrap.
11511151
self_module = sys.modules[__name__]
1152-
for builtin_name in ('_thread', '_warnings', '_weakref'):
1152+
for builtin_name in ('_warnings', '_weakref'):
11531153
if builtin_name not in sys.modules:
11541154
builtin_module = _builtin_from_name(builtin_name)
11551155
else:
11561156
builtin_module = sys.modules[builtin_name]
11571157
setattr(self_module, builtin_name, builtin_module)
1158+
# _thread was part of the above loop, but other parts of the code allow for it
1159+
# to be None, so we handle it separately here
1160+
builtin_name = '_thread'
1161+
if builtin_name in sys.modules:
1162+
builtin_module = sys.modules[builtin_name]
1163+
else:
1164+
builtin_spec = BuiltinImporter.find_spec(builtin_name)
1165+
builtin_module = builtin_spec and _load_unlocked(builtin_spec)
1166+
setattr(self_module, builtin_name, builtin_module)
11581167

11591168

11601169
def _install(sys_module, _imp_module):

0 commit comments

Comments
 (0)