Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] wrong EXT_SUFFIX on python 3.7 on Windows #3219

Closed
axnsan12 opened this issue Mar 27, 2022 · 5 comments
Closed

[BUG] wrong EXT_SUFFIX on python 3.7 on Windows #3219

axnsan12 opened this issue Mar 27, 2022 · 5 comments
Labels
bug Needs Triage Issues that need to be evaluated for severity and status.

Comments

@axnsan12
Copy link

axnsan12 commented Mar 27, 2022

setuptools version

>=61

Python version

3.7

OS

Windows

Additional environment information

No response

Description

This setuptools commit changed the bundled distutils.sysconfig to transparently forward get_config_var to the interpreter builtin sysconfig: 4b313f0

However, as mentioned in this python bug, sysconfig is (was) broken and returns a bad EXT_SUFFIX on python >=3.7. The issue was fixed in 3.10, with a backport into 3.8 and 3.9, however 3.7 was completely left behind.

This problem was mentioned on the setuptools issue tracker in the past, but the knowledge seems to since have slipped the collective mind.

Since setuptools hijacks import distutils by default, this means that anyone using python 3.7, or an older 3.8 or 3.9 installation, will suddenly start getting a wrong EXT_SUFFIX by simply updating to setuptools>=61, and the only way to get back the correct behavior is to set SETUPTOOLS_USE_DISTUTILS=stdlib to prevent the hijacking. Given this overarching impact I believe it's unfair to impose such a breaking change on users unsuspectingly using older python versions.

Notably, this completely breaks CMake builds of extension modules with FindPython when using affected python versions, since they use distutils.sysconfig to determine the required EXT_SUFFIX.

Expected behavior

Return proper EXT_SUFFIX on any python version >=3.7 (e.g. .cp37-win_amd64.pyd)

How to Reproduce

  1. Install setuptools>=61
  2. py -3.7 -c "from distutils import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))"

Output

.pyd
@axnsan12 axnsan12 added bug Needs Triage Issues that need to be evaluated for severity and status. labels Mar 27, 2022
@abravalheri
Copy link
Contributor

Hi @axnsan12 thank you very much for opening this issue and providing some preliminary investigation. It helps a lot!

Would you like to file a similar issue (or even copy this one) to the pypa/distutils repository? Once the issue is solved there, we can merge it back here.

@axnsan12
Copy link
Author

Hello @abravalheri, done as requested. Appears a fix has already been merged into distutils.

@abravalheri
Copy link
Contributor

Hi @axnsan12, I am not familiar with the procedure to merge distutils, but usually Jason (the main developer behind setuptools and distutils) does it very frequently. So I am sure this change will be available soon.

@abravalheri
Copy link
Contributor

Hi @axnsan12 can you confirm the latest release fixes this issue?

@axnsan12
Copy link
Author

axnsan12 commented Apr 11, 2022

Yep, seems good!

> py -3.7 -c "from distutils import sysconfig; import setuptools; print(setuptools.__version__); from setuptools._distutils import sysconfig as st_sysconfig; print(sysconfig is st_sysconfig); print(sysconfig.get_config_var('EXT_SUFFIX'))"
62.1.0
True
.cp37-win_amd64.pyd

Thanks to everyone for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Needs Triage Issues that need to be evaluated for severity and status.
Projects
None yet
Development

No branches or pull requests

2 participants