| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Thanks for the PR @sir-sigurd.
This looks like a minor enough adjustment to warrant a skip issue and skip news, particularly since it's modifying internal constants. I'll notify the datetime experts (although this might not be needed, since they were automatically added as reviewers).
Sorry, something went wrong.
|
It's not clear to me:
The principle of Chesterton's Fence applies here, so I think we need to figure out whether this was actually a mistake or a deliberate choice. Looks like @vstinner added these macros in this commit. Maybe he can comment as to why he chose PY_LLONG_MIN and PY_LLONG_MAX over INT64_MIN and INT64_MAX here. |
Sorry, something went wrong.
There is no secret: it's a bug :-) I don't recall the detail, but I recall that I wasn't sure about if using int64_t would cause any portability issue. There were very old discussions about using <stdint.h> and why PY_LONG_LONG was needed, etc. I chose to attempt to use int64_t and see who is going to complain. Years later: nobody complains, so it seems like the (Python) World is ready for int64_t :-D Maybe the first iteration of my change used "typedef long _PyTime_t;" and then I changed my mind. |
Sorry, something went wrong.
|
Thanks @sir-sigurd for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8. |
Sorry, something went wrong.
|
Sorry @sir-sigurd and @vstinner, I had trouble checking out the 3.8 backport branch. |
Sorry, something went wrong.
|
GH-15425 is a backport of this pull request to the 3.7 branch. |
Sorry, something went wrong.
_PyTime_t type is defined as int64_t, and so min/max are INT64_MIN/INT64_MAX, not PY_LLONG_MIN/PY_LLONG_MAX. (cherry picked from commit 8e76c45) Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
|
If you are curious about _PyTime API, I wrote two articles about its history :-) |
Sorry, something went wrong.
|
GH-15426 is a backport of this pull request to the 3.8 branch. |
Sorry, something went wrong.
_PyTime_t type is defined as int64_t, and so min/max are INT64_MIN/INT64_MAX, not PY_LLONG_MIN/PY_LLONG_MAX. (cherry picked from commit 8e76c45) Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
|
@vstinner Thanks for the detailed explanation and context!
Are there still any use cases for Py_LONG_LONG types at this point (within the Python C-API)? |
Sorry, something went wrong.
long long is now always avaialble and PY_LONG_LONG is always defined as "long long". The macro is no more used in the Python code base, except in dict_get_version() of _testcapimodule.c. Maybe this function can be updated. |
Sorry, something went wrong.
@vstinner I've been looking to get more experience with C-API development, perhaps this would serve as a decent introductory project for me to work on. |
Sorry, something went wrong.
|
@aeros167 there is already #15386. |
Sorry, something went wrong.
Ah okay, thanks for letting me know. |
Sorry, something went wrong.
_PyTime_t type is defined as int64_t, and so min/max are INT64_MIN/INT64_MAX, not PY_LLONG_MIN/PY_LLONG_MAX.
_PyTime_t type is defined as int64_t, and so min/max are INT64_MIN/INT64_MAX, not PY_LLONG_MIN/PY_LLONG_MAX.
_PyTime_t type is defined as int64_t, and so min/max are INT64_MIN/INT64_MAX, not PY_LLONG_MIN/PY_LLONG_MAX.
| Back | FazBrowse Home | New Git URL |
No description provided.