forked from Rust-related/RustPython
_thread compatibility using frozen _dummy_thread
This commit is contained in:
5
Lib/functools.py
vendored
5
Lib/functools.py
vendored
@@ -18,10 +18,7 @@ from abc import get_cache_token
|
||||
from collections import namedtuple
|
||||
# import types, weakref # Deferred to single_dispatch()
|
||||
from reprlib import recursive_repr
|
||||
try:
|
||||
from _thread import RLock
|
||||
except ModuleNotFoundError:
|
||||
from _dummy_thread import RLock
|
||||
from _thread import RLock
|
||||
from types import GenericAlias
|
||||
|
||||
|
||||
|
||||
5
Lib/reprlib.py
vendored
5
Lib/reprlib.py
vendored
@@ -4,10 +4,7 @@ __all__ = ["Repr", "repr", "recursive_repr"]
|
||||
|
||||
import builtins
|
||||
from itertools import islice
|
||||
try:
|
||||
from _thread import get_ident
|
||||
except ModuleNotFoundError:
|
||||
from _dummy_thread import get_ident
|
||||
from _thread import get_ident
|
||||
|
||||
def recursive_repr(fillvalue='...'):
|
||||
'Decorator to make a repr function return fillvalue for a recursive call'
|
||||
|
||||
5
Lib/tempfile.py
vendored
5
Lib/tempfile.py
vendored
@@ -47,10 +47,7 @@ import sys as _sys
|
||||
import types as _types
|
||||
import weakref as _weakref
|
||||
|
||||
try:
|
||||
import _thread
|
||||
except ImportError:
|
||||
import _dummy_thread as _thread
|
||||
import _thread
|
||||
_allocate_lock = _thread.allocate_lock
|
||||
|
||||
_text_openflags = _os.O_RDWR | _os.O_CREAT | _os.O_EXCL
|
||||
|
||||
2
Lib/zipfile.py
vendored
2
Lib/zipfile.py
vendored
@@ -22,7 +22,7 @@ import sys
|
||||
try:
|
||||
import threading
|
||||
except ImportError:
|
||||
import _dummy_thread as threading
|
||||
import dummy_threading as threading
|
||||
import time
|
||||
import contextlib
|
||||
import pathlib
|
||||
|
||||
1
vm/Lib/python_builtins/_thread.py
Symbolic link
1
vm/Lib/python_builtins/_thread.py
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../Lib/_dummy_thread.py
|
||||
@@ -233,6 +233,8 @@ impl VirtualMachine {
|
||||
let mut essential_init = || -> PyResult {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
import::import_builtin(self, "_signal")?;
|
||||
#[cfg(not(feature = "threading"))]
|
||||
import::import_frozen(self, "_thread")?;
|
||||
let importlib = import::init_importlib_base(self)?;
|
||||
self.import_utf8_encodings()?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user