This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author scoder
Recipients paul.moore, scoder, steve.dower, tim.golden, zach.ware
Date 2018-10-21.08:22:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I see reports from Cython users on Windows-64 that extension modules that use "longintrepr.h" get miscompiled by MinGW. A failing setup looks as follows:

Stock 64 bit CPython on Windows, e.g.
Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)]

MinGW uses this compile time setup, i.e. 15 bit digits:
PyLong_BASE  0x8000
PyLong_SHIFT  15
sizeof(digit)  2
sizeof(sdigit)  2

Whereas CPython reports the following, indicating that it was in fact built with 30 bit digits:
sys.getsize(1, 2**14, 2**15, 2**29, 2**30, 2**63, 2**64)  (28, 28, 28, 28, 32, 36, 36)

I'm not sure if this also applies to Py2.7, but I don't think the PyLong implementations differ in this regard.

The compile time PyLong digit size is not remembered by the CPython installation and instead determined on the fly by the extension compiler. It seems that the MSVC build of the stock CPython packages differs from what MinGW decides here. This renders MinGW unusable for code that uses "longintrepr.h", which Cython does by default in order to accelerate its unpacking of PyLong values.

Is there a reason why CPython cannot store its compile time value for the PYLONG_BITS_IN_DIGIT setting somewhere?
Date User Action Args
2018-10-21 08:22:52scodersetrecipients: + scoder, paul.moore, tim.golden, zach.ware, steve.dower
2018-10-21 08:22:52scodersetmessageid: <>
2018-10-21 08:22:52scoderlinkissue35037 messages
2018-10-21 08:22:52scodercreate