You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gh-140824: Build the math module as an extension package
Build math as an extension package (math/__init__ and math/integer) so
that math.integer is a genuine extension submodule instead of the
_math_integer extension module patched at runtime to look like one. This
drops the sys.modules['_math_integer'] leak and gives math.integer's
functions a correct __module__.
Modules/makesetup now accepts dotted module names, mapping each to its
registration name, on-disk path and init symbol; a package initializer is
written with an explicit __init__ leaf (math.__init__). Makefile.pre.in
keeps sub-directories when staging and installing shared modules, and
check_extension_modules.py and generate_stdlib_module_names.py handle
package and dotted submodule names.
The package works both for shared builds and for builds where math is a
builtin (Windows, WebAssembly): math's exec slot sets __path__ when the
import machinery does not, and the static inittab uses a symbol derived
from the full dotted name (PyInit_math_integer) to stay unique, selected
with Py_BUILD_CORE_BUILTIN.
ExtensionFileLoader.is_package() now mirrors FileLoader by returning False
for the "__init__" name itself, so that modulefinder (used by
Tools/freeze) does not recurse on an extension package.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments