]> granicus.if.org Git - python/commitdiff
eval_code2(): In the extended calling syntax opcodes, you must check
authorBarry Warsaw <barry@python.org>
Wed, 29 Mar 2000 18:30:03 +0000 (18:30 +0000)
committerBarry Warsaw <barry@python.org>
Wed, 29 Mar 2000 18:30:03 +0000 (18:30 +0000)
the return value of PySequence_Length().  If an exception occurred,
the returned length will be -1.  Make sure this doesn't get obscurred,
and that the bogus length isn't used.

Python/ceval.c

index 7a97771327b5bed6f3f896ee5ab2d8f18ed1cc86..7a0895f194a1cfa678afb77e1ace378f1751d445 100644 (file)
@@ -1636,6 +1636,14 @@ eval_code2(co, globals, locals,
                                break;
                            }
                            nstar = PySequence_Length(stararg);
+                           if (nstar < 0) {
+                                   if (!PyErr_Occurred)
+                                           PyErr_SetString(
+                                                   PyExc_TypeError,
+                                                   "len() of unsized object");
+                                   x = NULL;
+                                   break;
+                           }
                        }
                        if (nk > 0) {
                            if (kwdict == NULL) {