chiark
/
gitweb
/
~mdw
/
catacomb-python
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
*.c: Be more careful about `PySequence_Size'.
[catacomb-python]
/
catacomb.c
diff --git
a/catacomb.c
b/catacomb.c
index daa404a4e29620dc748442d580c765468c3295dc..e24e5ec9f47e033f27129b1b002da90a2b68c273 100644
(file)
--- a/
catacomb.c
+++ b/
catacomb.c
@@
-76,7
+76,8
@@
PyObject *mexp_common(PyObject *me, PyObject *arg,
arg = PyTuple_GetItem(arg, 0);
Py_INCREF(arg);
if (!PySequence_Check(arg)) TYERR("not a sequence");
arg = PyTuple_GetItem(arg, 0);
Py_INCREF(arg);
if (!PySequence_Check(arg)) TYERR("not a sequence");
- n = PySequence_Size(arg); if (!n) { z = id(me); goto end; }
+ n = PySequence_Size(arg); if (n < 0) goto end;
+ if (!n) { z = id(me); goto end; }
x = PySequence_GetItem(arg, 0);
if (PySequence_Check(x))
flat = 0;
x = PySequence_GetItem(arg, 0);
if (PySequence_Check(x))
flat = 0;