Skip to content

Conversation

@tiran
Copy link
Member

@tiran tiran commented Oct 23, 2021

Modules/Setup used to put shared extensions into ./Modules/
directory. Now it puts the shared extensions in the same directory
library directory ./build/lib.$plat-$ver as distutils.

The change makes the shared modules importable and fixes build issues.

Signed-off-by: Christian Heimes [email protected]

https://bugs.python.org/issue45548

@tiran
Copy link
Member Author

tiran commented Oct 23, 2021

Modules/Setup

*shared*
cmath cmathmodule.c _math.c
math mathmodule.c _math.c

without fix

$ make
*** WARNING: renaming "_zoneinfo" since importing it failed: PyCapsule_Import could not import module "datetime"
*** WARNING: renaming "_asyncio" since importing it failed: No module named 'math'

The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
_abc                  cmath                 math               
pwd                   time                                     


Following modules built successfully but were removed because they could not be imported:
_asyncio              _zoneinfo          

$ ./python -c "import math"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'math'

$ find -name '*math*.so'
./Modules/math.cpython-311-x86_64-linux-gnu.so
./Modules/cmath.cpython-311-x86_64-linux-gnu.so

with fix

$ make
...
The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
_abc                  cmath                 math               
pwd                   time    

$ ./python -c "import math"
$ echo $?
0

$ find -name '*math*.so'
./build/lib.linux-x86_64-3.11/math.cpython-311-x86_64-linux-gnu.so
./build/lib.linux-x86_64-3.11/cmath.cpython-311-x86_64-linux-gnu.so

@tiran tiran marked this pull request as ready for review October 25, 2021 08:29
tiran added 2 commits October 25, 2021 20:19
Modules/Setup used to put shared extensions into ``./Modules/``
directory. Now it puts the shared extensions in the same directory
library directory ``./build/lib.$plat-$ver`` as distutils.

The change makes the shared modules importable and fixes build issues.

Signed-off-by: Christian Heimes <[email protected]>
@tiran tiran marked this pull request as draft October 25, 2021 21:09
@brettcannon brettcannon removed their request for review November 16, 2021 19:36
@brettcannon
Copy link
Member

If this leaves draft and my review is still desired, please feel free to add me back.

@tiran
Copy link
Member Author

tiran commented Nov 23, 2021

I have landed the fix with another commit.

@tiran tiran closed this Nov 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants