_testcapi.run_in_subinterp makes a questionable PyImport_Cleanup(),
which we work around by having a separate cleanup function for the
lookup tables.
also added a separate initialization function for the lookup tables
for symmetry.
some commented out code in the previous commit messed with GC, it was
made visible again.
- the identifiers were used only in 1 function each
- stinfo risks getting mixed in between different imports
- stinfo was carrying over values from previous calls
- malloc+qsort table entries for frozen modules
- malloc+qsort table entries for builtin modules
- static+qsort table entries for zip cdir modules used in startup
- use bsearch instead of linear search for module names
- use zip cdir table entries to avoid wasting stat calls
- SourcelessFileLoader can't rely on stat when loading code
test_cmd_line did not consider that sys.meta_path would have a different
starting entry, and so what would happen in the isolated mode test is
that CosmoImporter would pick up uuid.pyc from the zip store, and claim
no errors in both cases.
Now the test removes CosmoImporter from sys.meta_path and so the
expected behavior occurs again.
CosmoImporter.find_spec is a function similar to the find_spec methods
found in _bootstrap.py and _bootstrap_external.py. It checks for
built-in modules, frozen modules, and modules that may be within the zip
store of the APE. For looking within the zip store, it performs upto two
additional stat calls, but this is balanced by the fact that no more
stat calls need to occur when loading a pyc file from the zip store.
CosmoImporter calls small functions written within _bootstrap.py to
create the correct ModuleSpec objects. This is done because the
ModuleSpec.__init__ requires origin and is_package to be specified as
kwargs, which is not easy to do from within C.
This change hardens the code for opening /zip/ files using the system
call interface. Thread safety and signal safety has been improved for
file descriptors in general. We now document fixed addresses that are
needed for low level allocations.
- Fix Makefile flaking due to ZIPOBJ_FLAGS generation
- Make printf() floating point and gdtoa thread safe
- Polish up the runit / runitd programs some more
- Prune some more makefile dependencies
Calls to lock/unlock functions are now NOPs by default. The first time
clone() is called, they get turned into CALL instructions. Doing this
caused funcctions like fputc() to shrink from 85 bytes to 45+4 bytes.
Since the ANSI solution of `(__threaded && lock())` inlines os much
superfluous binary content into functions all over the place.
- Finish cleaning up the stdio unlocked APIs
- Make __cxa_finalize() properly thread safe
- Don't log locks if threads aren't being used
- Add some more mutex guards to places using _mmi
- Specific lock names now appear in the --ftrace logs
- Fix mkdeps.com generating invalid Makefiles sometimes
- Simplify and fix bugs in the test runner infrastructure
- Fix issue where sometimes some functions wouldn't be logged
These releases are really exciting since they contained the patches we
worked to get upstreamed. It means that their /bin/sh interpreters all
work fine with Actually Portable Executable now.
Microsoft's version of Linux requires that the ELF program headers say
that the executable has 4096 byte alignment. However, it doesn't force
us to pad the binary with NOPs to a page-aligned size.
This change switches most of the core locks to be re-entrant, in order
to reduce the chance of deadlocking code that does, clever things with
asynchronous signal handlers. This change implements it it in pthreads
so we're one step closer to having a standardized threading primitives