I am hacking CPython base struct, ie., the struct _object {}
in Include/object.h. I added an extra field for my need, nothing else is changed. However, when trying to install other packages from source, and the customized python failed to import those libraries. For example, for the pyperformance
project:
lyuze@wukong1: ~/pyperformance$ /home/lyuze/workspace/cpython_org/python -m pip install .
lyuze@wukong1:~/pyperformance$ /home/lyuze/workspace/cpython_org/python
Python 3.13.0a4+ (heads/main-dirty:c688c0f130, Feb 23 2024, 18:03:52) [GCC 11.4.0]
>>> import pyperf
Segmentation fault (core dumped)
gdb shows:
(gdb) bt
#0 __strcmp_evex () at ../sysdeps/x86_64/multiarch/strcmp-evex.S:132
#1 0x00005555557c754a in _PyImport_ResolveNameWithPackageContext (name=name@entry=0x0) at Python/import.c:723
#2 0x00005555556a87b6 in _PyModule_CreateInitialized (module=module@entry=0x7ffff719f3a0 <moduledef>, module_api_version=module_api_version@entry=3)
at Objects/moduleobject.c:213
[...]
I also tried to reinstall setuptools
but not helping. I was thinking the although the changed PyObject memory layout will cause the packages installed from pypi
deprecated, but when installing from source should work. So I’m not sure why this happens? Thanks.