mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 05:42:29 +00:00
quick addition of cosmo pthreads to python.com
- enable WITH_THREAD and _POSIX_THREADS - add headers everywhere - breaks only two tests (faulthandler and signal) - disabled terminal completion because it causes segfaults for some reason (probably could not get the current thread)
This commit is contained in:
parent
a808b3e738
commit
60eb34509b
16 changed files with 166 additions and 34 deletions
40
third_party/python/Lib/importlib/_bootstrap.py
vendored
40
third_party/python/Lib/importlib/_bootstrap.py
vendored
|
@ -520,31 +520,29 @@ def _module_repr_from_spec(spec):
|
|||
else:
|
||||
return '<module {!r} ({})>'.format(spec.name, spec.origin)
|
||||
|
||||
|
||||
# Used by importlib.reload() and _load_module_shim().
|
||||
def _exec(spec, module):
|
||||
"""Execute the spec's specified module in an existing module's namespace."""
|
||||
name = spec.name
|
||||
if sys.modules.get(name) is not module:
|
||||
msg = 'module {!r} not in sys.modules'.format(name)
|
||||
raise ImportError(msg, name=name)
|
||||
if spec.loader is None:
|
||||
if spec.submodule_search_locations is None:
|
||||
raise ImportError('missing loader', name=spec.name)
|
||||
# namespace package
|
||||
with _ModuleLockManager(name):
|
||||
if sys.modules.get(name) is not module:
|
||||
msg = 'module {!r} not in sys.modules'.format(name)
|
||||
raise ImportError(msg, name=name)
|
||||
if spec.loader is None:
|
||||
if spec.submodule_search_locations is None:
|
||||
raise ImportError('missing loader', name=spec.name)
|
||||
# namespace package
|
||||
_init_module_attrs(spec, module, override=True)
|
||||
return module
|
||||
_init_module_attrs(spec, module, override=True)
|
||||
return module
|
||||
_init_module_attrs(spec, module, override=True)
|
||||
if not hasattr(spec.loader, 'exec_module'):
|
||||
# (issue19713) Once BuiltinImporter and ExtensionFileLoader
|
||||
# have exec_module() implemented, we can add a deprecation
|
||||
# warning here.
|
||||
spec.loader.load_module(name)
|
||||
else:
|
||||
spec.loader.exec_module(module)
|
||||
if not hasattr(spec.loader, 'exec_module'):
|
||||
# (issue19713) Once BuiltinImporter and ExtensionFileLoader
|
||||
# have exec_module() implemented, we can add a deprecation
|
||||
# warning here.
|
||||
spec.loader.load_module(name)
|
||||
else:
|
||||
spec.loader.exec_module(module)
|
||||
return sys.modules[name]
|
||||
|
||||
|
||||
def _load_backward_compatible(spec):
|
||||
# (issue19713) Once BuiltinImporter and ExtensionFileLoader
|
||||
# have exec_module() implemented, we can add a deprecation
|
||||
|
@ -606,8 +604,8 @@ def _load(spec):
|
|||
clobbered.
|
||||
|
||||
"""
|
||||
return _load_unlocked(spec)
|
||||
|
||||
with _ModuleLockManager(spec.name):
|
||||
return _load_unlocked(spec)
|
||||
|
||||
# Loaders #####################################################################
|
||||
|
||||
|
|
|
@ -1388,6 +1388,7 @@ def _setup(_bootstrap_module):
|
|||
"builtins",
|
||||
"marshal",
|
||||
"posix",
|
||||
"_thread",
|
||||
"_weakref",
|
||||
):
|
||||
self_mod_dict[name] = sys.modules.get(
|
||||
|
@ -1400,7 +1401,6 @@ def _setup(_bootstrap_module):
|
|||
self_mod_dict["_os"] = sys.modules.get(builtin_os, builtin_from_name(builtin_os))
|
||||
self_mod_dict["path_sep"] = path_separators[0]
|
||||
self_mod_dict["path_separators"] = "".join(path_separators)
|
||||
self_mod_dict["_thread"] = None
|
||||
# Constants
|
||||
EXTENSION_SUFFIXES.extend(_imp.extension_suffixes())
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue