mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
_thread compatibility using frozen _dummy_thread
This commit is contained in:
1 parent
8f683b94d5
commit
9daeaecd6c
6 files changed
+7
-13
No files matched your search
Vendored
+1
-4
@@ -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
|
||||
|
||||
|
||||
|
||||
Vendored
+1
-4
@@ -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'
|
||||
|
||||
Vendored
+1
-4
@@ -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
|
||||
|
||||
Vendored
+1
-1
@@ -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
@@ -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