]> granicus.if.org Git - python/commitdiff
Issue #9566: Fix a compiler warning on Windows 64-bit in namespace_init()
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 4 Jun 2013 22:13:51 +0000 (00:13 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Tue, 4 Jun 2013 22:13:51 +0000 (00:13 +0200)
The result type is int, return -1 to avoid a compiler warning (cast Py_ssize_t
to int).  PyObject_Size() can only fail with -1, and anyway a constructor
should return -1 on error, not an arbitrary negative number.

Objects/namespaceobject.c

index 7e9107a744608c224cc656b3727ebdaebde4db91..8c51b07fc1e03c1005bb2b93425ac57958cfa216 100644 (file)
@@ -44,7 +44,7 @@ namespace_init(_PyNamespaceObject *ns, PyObject *args, PyObject *kwds)
     if (args != NULL) {
         Py_ssize_t argcount = PyObject_Size(args);
         if (argcount < 0)
-            return argcount;
+            return -1;
         else if (argcount > 0) {
             PyErr_Format(PyExc_TypeError, "no positional arguments expected");
             return -1;