Import stuck at _imp.create_dynamic while using cpython

Python version is 3.8.10

When I type the import dataflow_py which is a binding for C++ project dataflow in python shell

it will stuck at _imp.create_dynamic.

I found this by pdb:

> <frozen importlib._bootstrap_external>(1164)create_module()
(Pdb)
> <frozen importlib._bootstrap_external>(1166)create_module()
(Pdb)
> <frozen importlib._bootstrap_external>(1167)create_module()
(Pdb)
> <frozen importlib._bootstrap_external>(1166)create_module()
(Pdb) spec
ModuleSpec(name='dataflow_py38', loader=<_frozen_importlib_external.ExtensionFileLoader object at 0xffffa1ebceb0>, origin='/home/admin/test/install/lib/dataflow_py38.cpython-38-aarch64-linux-gnu.so')
(Pdb)
ModuleSpec(name='dataflow_py38', loader=<_frozen_importlib_external.ExtensionFileLoader object at 0xffffa1ebceb0>, origin='/home/admin/test/install/lib/dataflow_py38.cpython-38-aarch64-linux-gnu.so')
(Pdb) s
--Call--
> <frozen importlib._bootstrap>(211)_call_with_frames_removed()
(Pdb)
> <frozen importlib._bootstrap>(219)_call_with_frames_removed()
(Pdb)

stuck ....

the corresponding code is here

The procedure of import is successful after I build the cpython.so in debug build type. But why?

The pdb info following:

(Pdb) spec
ModuleSpec(name='dataflow_py', loader=<_frozen_importlib_external.ExtensionFileLoader object at 0xffff817c66d0>, origin='/home/admin/test/debug/install/lib/dataflow_py.cpython-38-aarch64-linux-gnu.so')
(Pdb) _imp
<module '_imp' (built-in)>
(Pdb) _imp.create_dynamic(spec)
<module 'dataflow_py' from '/home/admin/test/debug/install/lib/dataflow_py.cpython-38-aarch64-linux-gnu.so'>
(Pdb) spec.origin
'/home/admin/test/debug/install/lib/dataflow_py.cpython-38-aarch64-linux-gnu.so'
(Pdb) type(sepc.origin)
*** NameError: name 'sepc' is not defined
(Pdb) type(spec.origin)
<class 'str'>
(Pdb) sepc.origin='/home/admin/test/release/install/lib/dataflow_py.cpython-38-aarch64-linux-gnu.so'--KeyboardInterrupt--
(Pdb) rel_spec = spec
(Pdb) rel_spec
ModuleSpec(name='dataflow_py', loader=<_frozen_importlib_external.ExtensionFileLoader object at 0xffff817c66d0>, origin='/home/admin/test/debug/install/lib/dataflow_py.cpython-38-aarch64-linux-gnu.so')
(Pdb) rel_spec.origin = '/home/admin/test/release/install/lib/dataflow_py.cpython-38-aarch64-linux-gnu.so'
(Pdb) spec
ModuleSpec(name='dataflow_py', loader=<_frozen_importlib_external.ExtensionFileLoader object at 0xffff817c66d0>, origin='/home/admin/test/release/install/lib/dataflow_py.cpython-38-aarch64-linux-gnu.so')
(Pdb) rel_spec
ModuleSpec(name='dataflow_py', loader=<_frozen_importlib_external.ExtensionFileLoader object at 0xffff817c66d0>, origin='/home/admin/test/release/install/lib/dataflow_py.cpython-38-aarch64-linux-gnu.so')
(Pdb) _imp.create_dynamic(rel_spec)

stuck ...

the spec.origin='/home/admin/test/debug/install/lib/dataflow_py.cpython-38-aarch64-linux-gnu.so' can be import by _imp.create_dynamic, but stucking when using spec.origin='/home/admin/test/release/install/lib/dataflow_py.cpython-38-aarch64-linux-gnu.so'