GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — bpo-37207: Use vectorcall for range() by encukou · Pull Request #18464 · python/cpython Conversation
|
| range_vectorcall(PyTypeObject *type, PyObject *const *args, | ||
| size_t nargsf, PyObject *kwnames) | ||
| { | ||
| size_t nargs = PyVectorcall_NARGS(nargsf); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Oh, I didn't expect a size_t here. I opened an issue to discuss PyVectorcall_NARGS() return type: https://bugs.python.org/issue39611
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The return type already is Py_ssize_t. The bug was only in this patch.
(When Mark was originally writing the patch, there was a discussion of Py_ssize_t vs. size_t. Mark is a big proponent of the unsigned type, which is more correct. But also much less compatible with the existing codebase.)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| */ | ||
| static PyObject * | ||
| range_new(PyTypeObject *type, PyObject *args, PyObject *kw) | ||
| range_from_array(PyTypeObject *type, PyObject *const *args, size_t num_args) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to use Py_ssize_t type for num_args. Usually, it's called "nargs", but I'm fine with "num_args" ;-)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Right, Py_ssize_t is more consistent.
But I find num_args more descriptive, so I'll keep that name.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Codecov Report
@@ Coverage Diff @@ ## master #18464 +/- ## =========================================== + Coverage 82.11% 83.20% +1.08% =========================================== Files 1955 1571 -384 Lines 588958 414749 -174209 Branches 44428 44456 +28 =========================================== - Hits 483632 345077 -138555 + Misses 95677 60024 -35653 + Partials 9649 9648 -1
Continue to review full report at Codecov.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| PyErr_Format(PyExc_TypeError, | ||
| "range expected at most 3 arguments, got %zd", | ||
| "range expected at most 3 arguments, got %zu", | ||
| num_args); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It should be reset to %zd, since num_args is signed, no?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
You're right.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.