mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Fix bootstrap issues when building without threads
This commit is contained in:
parent
39a6591507
commit
db1bad2d70
2 changed files with 9 additions and 5 deletions
|
@ -16,12 +16,14 @@ Suggested usage is::
|
||||||
__all__ = ['error', 'start_new_thread', 'exit', 'get_ident', 'allocate_lock',
|
__all__ = ['error', 'start_new_thread', 'exit', 'get_ident', 'allocate_lock',
|
||||||
'interrupt_main', 'LockType']
|
'interrupt_main', 'LockType']
|
||||||
|
|
||||||
import traceback as _traceback
|
|
||||||
import time
|
|
||||||
|
|
||||||
# A dummy value
|
# A dummy value
|
||||||
TIMEOUT_MAX = 2**31
|
TIMEOUT_MAX = 2**31
|
||||||
|
|
||||||
|
# NOTE: this module can be imported early in the extension building process,
|
||||||
|
# and so top level imports of other modules should be avoided. Instead, all
|
||||||
|
# imports are done when needed on a function-by-function basis. Since threads
|
||||||
|
# are disabled, the import lock should not be an issue anyway (??).
|
||||||
|
|
||||||
class error(Exception):
|
class error(Exception):
|
||||||
"""Dummy implementation of _thread.error."""
|
"""Dummy implementation of _thread.error."""
|
||||||
|
|
||||||
|
@ -52,7 +54,8 @@ def start_new_thread(function, args, kwargs={}):
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
pass
|
pass
|
||||||
except:
|
except:
|
||||||
_traceback.print_exc()
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
_main = True
|
_main = True
|
||||||
global _interrupt
|
global _interrupt
|
||||||
if _interrupt:
|
if _interrupt:
|
||||||
|
@ -116,6 +119,7 @@ class LockType(object):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
if timeout > 0:
|
if timeout > 0:
|
||||||
|
import time
|
||||||
time.sleep(timeout)
|
time.sleep(timeout)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import builtins
|
||||||
from itertools import islice
|
from itertools import islice
|
||||||
try:
|
try:
|
||||||
from _thread import get_ident
|
from _thread import get_ident
|
||||||
except AttributeError:
|
except ImportError:
|
||||||
from _dummy_thread import get_ident
|
from _dummy_thread import get_ident
|
||||||
|
|
||||||
def recursive_repr(fillvalue='...'):
|
def recursive_repr(fillvalue='...'):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue