How to make a modules built-in, instead dynamic loading

In CPython/Modules/Setup file, i saw a comment about how to make a module built-in, it told me to uncomment the some lines and it will compile modules statically into the Python binary, so i tried, here is my modify:

# math mathmodule.c
math mathmodule.c

I just uncomment 1 line to make math module built-in, But when I executed the python interpreter I compiled, I found that the mah module was still loaded dynamically.

╰─$ ./python    
Python 3.13.0a6+ (heads/main-dirty:6078f2033ea, Apr 18 2024, 11:51:49) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> print(math.__file__)

Can any body explain?

Did you then rerun configure, and completely clean out the compile results?

yes of course, i clear the build environment , in the cpython root dir, i re-run the follwing command: rm -rf build && mkdir build && cd build && ../configure && make

It depends on *static* vs *shared* markers in the “Setup” files.

Example of Modules/Setup.local file to build the math extension as a built-in module:

math mathmodule.c