]> granicus.if.org Git - python/commitdiff
move var declaration to top of block to fix compilation on Windows, fixes a7ec0a1b0f7c
authorChristian Heimes <christian@cheimes.de>
Sat, 6 Oct 2012 15:13:29 +0000 (17:13 +0200)
committerChristian Heimes <christian@cheimes.de>
Sat, 6 Oct 2012 15:13:29 +0000 (17:13 +0200)
Objects/abstract.c

index b6fc478595b523459ab0375b83e9c5bfb2867cf5..eb3a766c1995ab2b995f1bd169580be5ff16e3ad 100644 (file)
@@ -78,8 +78,10 @@ _PyObject_HasLen(PyObject *o) {
 Py_ssize_t
 PyObject_LengthHint(PyObject *o, Py_ssize_t defaultvalue)
 {
+    PyObject *hint;
+    Py_ssize_t res;
     _Py_IDENTIFIER(__length_hint__);
-    Py_ssize_t res = PyObject_Length(o);
+    res = PyObject_Length(o);
     if (res < 0 && PyErr_Occurred()) {
         if (!PyErr_ExceptionMatches(PyExc_TypeError)) {
             return -1;
@@ -89,7 +91,7 @@ PyObject_LengthHint(PyObject *o, Py_ssize_t defaultvalue)
     else {
         return res;
     }
-    PyObject *hint = _PyObject_LookupSpecial(o, &PyId___length_hint__);
+    hint = _PyObject_LookupSpecial(o, &PyId___length_hint__);
     if (hint == NULL) {
         if (PyErr_Occurred()) {
             return -1;