Bug#1009240: esys-particle: autopkgtest regression since rebuild for python3.10 as default

Stefano Rivera stefanor at debian.org
Wed Apr 13 22:07:26 BST 2022


I did some digging:

The issue here is that sys.path is not being correctly configured

It is being initialized to:
['', '/tmp/cpython/lib/python310.zip', '/tmp/cpython/lib/python3.10', '/tmp/cpython/lib/python3.10/lib-dynload']

not:
['', '/tmp/cpython/lib/python310.zip', '/tmp/cpython/lib/python3.10', '/tmp/cpython/lib/python3.10/lib-dynload', '/tmp/cpython/lib/python3.10/site-packages']

You can verify this by running:
esysparticle -c 'import sys; print(sys.path)'

More digging showed that it is actually being correctly initialized in
Py_Initialize(), but then re-initialized to be incorrect in Py_Main().

A git bisect got me to
https://github.com/python/cpython/commit/af1d64d9f7a7cf673279725fdbaf4adcca51d41f
as being the commit that made that change.

I haven't got to the bottom of exactly why that reinitialization is
going wrong, but these bugs hint at this code as being unsupported:
https://bugs.python.org/issue36204
https://bugs.python.org/issue34008

The easy answer here is to stop calling Py_Initialize(), as it's not
necessary.

The "right" long-term approach would be to migrate to Py_RunMain().

SR

-- 
Stefano Rivera
  http://tumbleweed.org.za/
  +1 415 683 3272



More information about the debian-science-maintainers mailing list