mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Minimize Python startup imports (#292)
* get_exports_list should return list * remove unintentional `CC=clang` in makefile * avoid importing sysconfig during startup site.py requires only a couple of functions from sysconfig, but needs to load the entirety of sysconfig to get those functions. This commit makes it such that sysconfig is imported only when sys.platform is darwin. * remove redundant constants from stat module The constants are only there in case the C implementation (ie the _stat module) is not available. With Cosmopolitan the _stat module is always available. The entire Lib/stat.py file can be removed if the Windows-based constants can be moved into the Modules/_stat.c. * minimal changes to os.py python checks os-based assumptions at startup, some of which can be bypassed since this is Cosmopolitan Python.
This commit is contained in:
parent
253ac31a64
commit
49db877fbe
8 changed files with 47 additions and 185 deletions
7
third_party/python/Lib/test/test_stat.py
vendored
7
third_party/python/Lib/test/test_stat.py
vendored
|
@ -4,10 +4,8 @@ import sys
|
|||
from test.support import TESTFN, import_fresh_module
|
||||
|
||||
c_stat = import_fresh_module('stat', fresh=['_stat'])
|
||||
py_stat = import_fresh_module('stat', blocked=['_stat'])
|
||||
|
||||
assert c_stat
|
||||
assert py_stat
|
||||
|
||||
class TestFilemode:
|
||||
statmod = None
|
||||
|
@ -228,11 +226,6 @@ class TestFilemodeCStat(TestFilemode, unittest.TestCase):
|
|||
format_funcs = TestFilemode.format_funcs | {'S_ISDOOR', 'S_ISPORT',
|
||||
'S_ISWHT'}
|
||||
|
||||
|
||||
class TestFilemodePyStat(TestFilemode, unittest.TestCase):
|
||||
statmod = py_stat
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue