--- a/Modules/posixmodule.c (index) +++ b/Modules/posixmodule.c (working tree) @@ -288,6 +288,7 @@ corresponding Unix manual entries for more information on calls."); #endif #ifdef HAVE_GETRANDOM_SYSCALL # include +# include #endif #if defined(MS_WINDOWS) --- a/Lib/doctest.py (index) +++ b/Lib/doctest.py (working tree) @@ -957,7 +957,7 @@ class DocTestFinder: return module.__dict__ is object.__globals__ elif (inspect.ismethoddescriptor(object) or inspect.ismethodwrapper(object)): - if hasattr(object, '__objclass__'): + if hasattr(object, '__objclass__') and hasattr(object.__objclass__, '__module__'): obj_mod = object.__objclass__.__module__ elif hasattr(object, '__module__'): obj_mod = object.__module__ @@ -965,7 +965,10 @@ class DocTestFinder: return True # [XX] no easy way to tell otherwise return module.__name__ == obj_mod elif inspect.isclass(object): - return module.__name__ == object.__module__ + try: + return module.__name__ == object.__module__ + except: + return True elif hasattr(object, '__module__'): return module.__name__ == object.__module__ elif isinstance(object, property): --- a/Lib/multiprocessing/popen_spawn_win32.py (index) +++ b/Lib/multiprocessing/popen_spawn_win32.py (working tree) @@ -65,5 +65,6 @@ class Popen(object): env["__PYVENV_LAUNCHER__"] = sys.executable else: - env = None + env = os.environ.copy() + env['Y_PYTHON_ENTRY_POINT'] = ':main' cmd = ' '.join('"%s"' % x for x in cmd) --- a/Lib/multiprocessing/spawn.py (index) +++ b/Lib/multiprocessing/spawn.py (working tree) @@ -82,7 +82,7 @@ def get_command_line(**kwds): ''' Returns prefix of command line used for spawning a child process ''' - if getattr(sys, 'frozen', False): + if False and getattr(sys, 'frozen', False): return ([sys.executable, '--multiprocessing-fork'] + ['%s=%r' % item for item in kwds.items()]) else: --- a/Lib/multiprocessing/util.py (index) +++ b/Lib/multiprocessing/util.py (working tree) @@ -383,8 +383,11 @@ class ForkAwareThreadLock(object): class ForkAwareLocal(threading.local): - def __init__(self): - register_after_fork(self, lambda obj : obj.__dict__.clear()) + def __new__(cls): + self = threading.local.__new__(cls) + register_after_fork(self, lambda obj: obj.__dict__.clear()) + return self + def __reduce__(self): return type(self), () @@ -444,14 +447,26 @@ def _flush_std_streams(): # Start a program with only specified fds kept open # + +def _env_list(): + # Based on fork_exec in subprocess.py. + env = os.environ.copy() + env['Y_PYTHON_ENTRY_POINT'] = ':main' + env_list = [] + for k, v in env.items(): + if '=' not in k: + env_list.append(os.fsencode(k) + b'=' + os.fsencode(v)) + return env_list + + def spawnv_passfds(path, args, passfds): import _posixsubprocess import subprocess passfds = tuple(sorted(map(int, passfds))) errpipe_read, errpipe_write = os.pipe() try: return _posixsubprocess.fork_exec( - args, [path], True, passfds, None, None, + args, [path], True, passfds, None, _env_list(), -1, -1, -1, -1, -1, -1, errpipe_read, errpipe_write, False, False, -1, None, None, None, -1, None, subprocess._USE_VFORK) --- a/Modules/_decimal/libmpdec/io.c (index) +++ b/Modules/_decimal/libmpdec/io.c (working tree) @@ -37,7 +37,7 @@ #include #include -#include "io.h" +#include "mpd_io.h" #include "typearith.h" --- a/Modules/_decimal/libmpdec/mpdecimal.h (index) +++ b/Modules/_decimal/libmpdec/mpdecimal.h (working tree) @@ -96,17 +96,17 @@ const char *mpd_version(void); /* Configuration */ /******************************************************************************/ -#if defined(UNIVERSAL) +#if 1 #if defined(CONFIG_64) || defined(CONFIG_32) #error "cannot use CONFIG_64 or CONFIG_32 with UNIVERSAL." #endif - #if defined(__ppc__) - #define CONFIG_32 - #define ANSI - #elif defined(__ppc64__) + #if defined(__powerpc64__) || defined(_M_AMD64) || defined(__aarch64__) #define CONFIG_64 #define ANSI - #elif defined(__i386__) + #elif defined(__powerpc__) + #define CONFIG_32 + #define ANSI + #elif defined(__i386__) || defined(_M_IX86) #define CONFIG_32 #define ANSI #elif defined(__x86_64__) --- a/Modules/getpath.c (index) +++ b/Modules/getpath.c (working tree) @@ -1,3 +1,4 @@ +#define PYTHONPATH ":" /* Return the initial module search path. */ #include "Python.h" --- a/Modules/main.c (index) +++ b/Modules/main.c (working tree) @@ -51,6 +51,7 @@ pymain_init(const _PyArgv *args) PyConfig config; PyConfig_InitPythonConfig(&config); + config.pathconfig_warnings = 0; /* Suppress errors from getpath.c */ /* pass NULL as the config: config is read from command line arguments, environment variables, configuration files */ --- a/Python/initconfig.c (index) +++ b/Python/initconfig.c (working tree) @@ -163,7 +163,7 @@ int Py_InspectFlag = 0; /* Needed to determine whether to exit at SystemExit */ int Py_OptimizeFlag = 0; /* Needed by compile.c */ int Py_NoSiteFlag = 0; /* Suppress 'import site' */ int Py_BytesWarningFlag = 0; /* Warn on str(bytes) and str(buffer) */ -int Py_FrozenFlag = 0; /* Needed by getpath.c */ +int Py_FrozenFlag = 1; /* Needed by getpath.c */ int Py_IgnoreEnvironmentFlag = 0; /* e.g. PYTHONPATH, PYTHONHOME */ int Py_DontWriteBytecodeFlag = 0; /* Suppress writing bytecode files (*.pyc) */ int Py_NoUserSiteDirectory = 0; /* for -s and site.py */ --- a/Python/import.c (index) +++ b/Python/import.c (working tree) @@ -2101,6 +2101,13 @@ init_importlib_external(PyInterpreterState *interp) return -1; } Py_DECREF(value); + + value = PyImport_ImportModule("__res"); + if (value == NULL) { + return -1; + } + Py_DECREF(value); + return 0; }