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:
ahgamut 2023-02-23 10:08:42 +05:30 committed by Justine Tunney
parent a808b3e738
commit 60eb34509b
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
16 changed files with 166 additions and 34 deletions

View file

@ -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 #####################################################################

View file

@ -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())

View file

@ -1323,7 +1323,7 @@ def enumerate():
return list(_active.values()) + list(_limbo.values())
from _dummy_thread import stack_size
from _thread import stack_size
# Create the main thread object,
# and make it available for the interpreter
@ -1371,7 +1371,7 @@ def main_thread():
# module, or from the python fallback
try:
from _dummy_thread import _local as local
from _thread import _local as local
except ImportError:
from _threading_local import local