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.

classification
Title: Use "ll" for PY_FORMAT_SIZE_T on Win64
Type: behavior Stage:
Components: Interpreter Core Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: scoder
Priority: normal Keywords:

Created on 2012-08-31 05:01 by scoder, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg169500 - (view) Author: Stefan Behnel (scoder) * (Python committer) Date: 2012-08-31 05:01
Formatting support for "lld"/"llu" was added (I think) in issue 7228, but the definition of PY_FORMAT_SIZE_T wasn't adapted. We are getting test output failures in Cython on Win64 when formatting error messages using the "Id" format, as defined by pyport.h:

"""
#ifndef PY_FORMAT_SIZE_T
#   if SIZEOF_SIZE_T == SIZEOF_INT && !defined(__APPLE__)
#       define PY_FORMAT_SIZE_T ""
#   elif SIZEOF_SIZE_T == SIZEOF_LONG
#       define PY_FORMAT_SIZE_T "l"
#   elif defined(MS_WINDOWS)
#       define PY_FORMAT_SIZE_T "I"
#   else
#       error "This platform's pyconfig.h needs to define PY_FORMAT_SIZE_T"
#   endif
#endif
"""

The "%Id" format is not being resolved in the error messages and shows up in the output instead.

NumPy uses "lld" when available, starting with Py2.7:

https://github.com/numpy/numpy/blob/master/numpy/core/include/numpy/npy_common.h#L66

Shouldn't PY_FORMAT_SIZE_T become "ll" on Win64 directly?
msg169501 - (view) Author: Stefan Behnel (scoder) * (Python committer) Date: 2012-08-31 05:49
I just saw that we were misusing PY_FORMAT_SIZE_T according to the documentation (reading that sometimes helps...). It is not supposed to be used with the Python formatting functions, only with low-level functions.

Closing, sorry for the noise.
History
Date User Action Args
2022-04-11 14:57:35adminsetgithub: 60031
2012-08-31 05:49:57scodersetstatus: open -> closed
resolution: not a bug
messages: + msg169501
2012-08-31 05:01:20scodercreate