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

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

Merged
merged 2 commits into from Dec 5, 2019

Conversation

sir-sigurd
Copy link
Contributor

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

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
Member

vstinner commented Aug 22, 2019

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
Contributor Author

sir-sigurd commented Aug 22, 2019

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
Member

vstinner commented Aug 22, 2019

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
Copy link
Member

vstinner commented Dec 5, 2019

Thanks @sir-sigurd !

@sir-sigurd sir-sigurd deleted the llong-defines branch Dec 6, 2019
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.

None yet

4 participants