Skip to content

Commit 9d77664

Browse files
committed
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.
1 parent a2d5698 commit 9d77664

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Objects/namespaceobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace_init(_PyNamespaceObject *ns, PyObject *args, PyObject *kwds)
4444
if (args != NULL) {
4545
Py_ssize_t argcount = PyObject_Size(args);
4646
if (argcount < 0)
47-
return argcount;
47+
return -1;
4848
else if (argcount > 0) {
4949
PyErr_Format(PyExc_TypeError, "no positional arguments expected");
5050
return -1;

0 commit comments

Comments
 (0)