Skip to content

BUG: Distutils patch to allow for 2 as a minor version (!)#20155

Merged
charris merged 1 commit intonumpy:mainfrom
matthew-brett:fix-mscver-version
Oct 21, 2021
Merged

BUG: Distutils patch to allow for 2 as a minor version (!)#20155
charris merged 1 commit intonumpy:mainfrom
matthew-brett:fix-mscver-version

Conversation

@matthew-brett
Copy link
Copy Markdown
Contributor

I found this one testing build with Mingw-w64.

The float representation of e.g. 14.2 is not exact, leading to a minor
version number of int(1.999999) == 1 in the original code.

Turn to string and split on decimal point instead.

The float representation of e.g. 14.2 is not exact, leading to a minor
version number of int(1.999999) == 1 in the original code.
@charris charris merged commit 7f61ddb into numpy:main Oct 21, 2021
@charris
Copy link
Copy Markdown
Member

charris commented Oct 21, 2021

Thanks Matthew. The use of a float is a bit flaky, but that problems lies elsewhere.

@charris charris changed the title MRG: Distuils patch to allow for 2 as a minor version (!) BUG: Distuils patch to allow for 2 as a minor version (!) Oct 21, 2021
@charris charris added the 09 - Backport-Candidate PRs tagged should be backported label Oct 21, 2021
@matthew-brett
Copy link
Copy Markdown
Contributor Author

matthew-brett commented Oct 22, 2021

For my reference:

PS C:\> .\Python36\python.exe .\check_versions.py
sys.version 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)]
distutils build version 14.0
msvcrt.CRT_ASSEMBLY_VERSION 14.0.24210.0
PS C:\> .\Python37\python.exe .\check_versions.py
sys.version 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
distutils build version 14.1
msvcrt.CRT_ASSEMBLY_VERSION 14.14.26428.1
PS C:\> .\Python38\python.exe .\check_versions.py
sys.version 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)]
distutils build version 14.1
msvcrt.CRT_ASSEMBLY_VERSION 14.16.27023.1
PS C:\> .\Python39\python.exe .\check_versions.py
sys.version 3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)]
distutils build version 14.2
msvcrt.CRT_ASSEMBLY_VERSION 14.27.29110.0
PS C:\> .\Python310\python.exe .\check_versions.py
C:\check_versions.py:7: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptoo
ls or check PEP 632 for potential alternatives
  from distutils.msvccompiler import get_build_version
sys.version 3.10.0 (tags/v3.10.0:b494f59, Oct  4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)]
distutils build version 14.2
msvcrt.CRT_ASSEMBLY_VERSION 14.29.30133.0

The distutils code takes the major version number from the first two character of:

1929

(above), and then subtracts (effectively) 5, and takes only the third digit as the minor version number.

matthew-brett added a commit to matthew-brett/numpy that referenced this pull request Oct 22, 2021
The comment in the original code came about because of the bug fixed in
numpygh-20155.  The fixed subsequent clause should now give the correct
assembly version for the given Python.

In fact, the original clause matches the MSVC for Python 3.7.1:

```
PS C:\> .\Python37\python.exe .\io\check_versions.py
sys.version 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)]
distutils build version 14.1
msvcrt.CRT_ASSEMBLY_VERSION 14.15.26726.0
```
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Nov 3, 2021
@charris charris changed the title BUG: Distuils patch to allow for 2 as a minor version (!) BUG: Distutils patch to allow for 2 as a minor version (!) Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants