[Python-checkins] cpython: Issue #9566: Fix a compiler warning on Windows 64-bit in namespace_init()

victor.stinner python-checkins at python.org
Wed Jun 5 00:14:06 CEST 2013


http://hg.python.org/cpython/rev/93f4b32fc95c
changeset:   84028:93f4b32fc95c
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Wed Jun 05 00:13:51 2013 +0200
summary:
  Issue #9566: Fix a compiler warning on Windows 64-bit in namespace_init()

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.

files:
  Objects/namespaceobject.c |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/Objects/namespaceobject.c b/Objects/namespaceobject.c
--- a/Objects/namespaceobject.c
+++ b/Objects/namespaceobject.c
@@ -44,7 +44,7 @@
     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;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list