Commit 9d89299f authored by Thomas Heller's avatar Thomas Heller

Fix refcounting.

This makes 'import ctypes; reload(ctypes)' no longer leak reference counts.
parent a4ebc135
......@@ -1283,6 +1283,7 @@ static PyObject *CreateSwappedType(PyTypeObject *type, PyObject *args, PyObject
suffix = PyString_FromString("_be");
#endif
Py_INCREF(name);
PyString_Concat(&name, suffix);
if (name == NULL)
return NULL;
......@@ -1459,6 +1460,7 @@ SimpleType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
PyObject_SetAttrString(swapped, "__ctype_le__", (PyObject *)result);
PyObject_SetAttrString(swapped, "__ctype_be__", swapped);
#endif
Py_DECREF(swapped);
};
return (PyObject *)result;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment