Skip to content

bpo-27961: Replace PY_LLONG_MAX, PY_LLONG_MIN and PY_ULLONG_MAX with standard macros#15385

Merged
vstinner merged 2 commits into
python:masterfrom
sir-sigurd:llong-defines
Dec 5, 2019
Merged

bpo-27961: Replace PY_LLONG_MAX, PY_LLONG_MIN and PY_ULLONG_MAX with standard macros#15385
vstinner merged 2 commits into
python:masterfrom
sir-sigurd:llong-defines

Conversation

@sir-sigurd

@sir-sigurd sir-sigurd commented Aug 22, 2019

Copy link
Copy Markdown
Contributor

https://bugs.python.org/issue27961

These ones

cpython/Include/pytime.h

Lines 20 to 21 in c4106af

#define _PyTime_MIN PY_LLONG_MIN
#define _PyTime_MAX PY_LLONG_MAX

will be handled in #15384.

@vstinner

Copy link
Copy Markdown
Member

Please open a new issue on bugs.python.org for this change.

On Windows, PC/pyconfig.h does not define PY_LLONG_MIN as LLONG_MIN but _I64_MIN:

/* 64 bit ints are usually spelt __int64 unless compiler has overridden */
#ifndef PY_LONG_LONG
#       define PY_LONG_LONG __int64
#       define PY_LLONG_MAX _I64_MAX
#       define PY_LLONG_MIN _I64_MIN
#       define PY_ULLONG_MAX _UI64_MAX
#endif

Which Visual Studio versions support LLONG_MIN? I never recall what is the minimum Visual Studio version to build Python on Windows. My notes say "VS 2017" for Python 3.8 and newer: https://pythondev.readthedocs.io/windows.html#python-and-visual-studio-version-matrix

@sir-sigurd

Copy link
Copy Markdown
Contributor Author

Which Visual Studio versions support LLONG_MIN?

I don't know, but it's used on Win here:

#ifdef MS_WINDOWS
/* Windows uses long long for offsets */
typedef long long Py_off_t;
# define PyLong_AsOff_t PyLong_AsLongLong
# define PyLong_FromOff_t PyLong_FromLongLong
# define PY_OFF_T_MAX LLONG_MAX
# define PY_OFF_T_MIN LLONG_MIN

since 47ff073.

@vstinner

Copy link
Copy Markdown
Member

Ok. Visual Studio seems to be fine. Again, please open a new issue for this change.

@vstinner vstinner merged commit 1f9f69d into python:master Dec 5, 2019
@vstinner

vstinner commented Dec 5, 2019

Copy link
Copy Markdown
Member

Thanks @sir-sigurd !

@sir-sigurd sir-sigurd deleted the llong-defines branch December 6, 2019 08:07
sir-sigurd added a commit to sir-sigurd/cpython that referenced this pull request Dec 9, 2019
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
…standard macros (pythonGH-15385)

Use standard constants LLONG_MIN, LLONG_MAX and ULLONG_MAX.
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