diff --git a/third_party/python/Lib/os.py b/third_party/python/Lib/os.py index e15133af6..48b7bda6e 100644 --- a/third_party/python/Lib/os.py +++ b/third_party/python/Lib/os.py @@ -38,24 +38,15 @@ def _exists(name): return name in globals() def _get_exports_list(module): - try: - return list(module.__all__) - except AttributeError: - return [n for n in dir(module) if n[0] != '_'] + return getattr(module, "__all__", (n for n in dir(module) if n[0] != '_')) name = 'posix' linesep = '\n' from posix import * -try: - from posix import _exit - __all__.append('_exit') -except ImportError: - pass +from posix import _exit +__all__.append('_exit') import posixpath as path -try: - from posix import _have_functions -except ImportError: - pass +from posix import _have_functions import posix __all__.extend(_get_exports_list(posix)) del posix @@ -67,7 +58,7 @@ from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep, del _names -if _exists("_have_functions"): +if True or _exists("_have_functions"): _globals = globals() def _add(str, fn): if (fn in _globals) and (str in _have_functions): diff --git a/third_party/python/Modules/posixmodule.c b/third_party/python/Modules/posixmodule.c index 6a67f4c3d..2bb79f0cd 100644 --- a/third_party/python/Modules/posixmodule.c +++ b/third_party/python/Modules/posixmodule.c @@ -78,6 +78,8 @@ PYTHON_PROVIDE("posix"); PYTHON_PROVIDE("posix._getfinalpathname"); +PYTHON_PROVIDE("posix._exit"); +PYTHON_PROVIDE("posix._have_functions"); /* POSIX module implementation */