The issue seems to be with the definition for PyMethodDef Integer_methods[] in integermodule.c. Somehow Python versions 3.8 and above do not like specifying METH_O | METH_NOARGS in the method testCoPrime. With this, when trying to finalise the type object through PyType_Ready(&IntegerType), it always returns a negative status code and fails silently.
A solution is to replace either METH_NOARGS or METH_O instead of the above. I also notice that no other file is using the method testCoPrime.
I have tested Python 3.7, 3.8, 3.9, and 3.10 on Ubuntu 22.04 WSL for Windows 11, Ubuntu 22.04 on Raspberry Pi, and Ubuntu 20.04. All worked except for Python 3.10 on Ubuntu 20.04, but the issue was with an outdated pip.
The issue seems to be with the definition for
PyMethodDef Integer_methods[]
in integermodule.c. Somehow Python versions 3.8 and above do not like specifyingMETH_O | METH_NOARGS
in the method testCoPrime. With this, when trying to finalise the type object throughPyType_Ready(&IntegerType)
, it always returns a negative status code and fails silently.A solution is to replace either
METH_NOARGS
orMETH_O
instead of the above. I also notice that no other file is using the methodtestCoPrime
.I have tested Python 3.7, 3.8, 3.9, and 3.10 on Ubuntu 22.04 WSL for Windows 11, Ubuntu 22.04 on Raspberry Pi, and Ubuntu 20.04. All worked except for Python 3.10 on Ubuntu 20.04, but the issue was with an outdated pip.