Skip to content

Commit 7f02431

Browse files
committed
fix: _PyArg_CheckPositional may also be when unpacking a tuple
1 parent 29b6bae commit 7f02431

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

include/pyshim.hh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ typedef struct {
4545
*/
4646
#if PY_VERSION_HEX >= 0x030d0000 // Python version is greater than 3.13
4747
inline int _PyArg_CheckPositional(const char *name, Py_ssize_t nargs, Py_ssize_t min, Py_ssize_t max) {
48+
if (!name) { // _PyArg_CheckPositional may also be when unpacking a tuple
49+
name = "unpacked tuple"; // https://github.com/python/cpython/blob/v3.13.0rc1/Python/getargs.c#L2746
50+
}
51+
4852
if (nargs < min) {
4953
PyErr_Format(
5054
PyExc_TypeError,

0 commit comments

Comments
 (0)