diff options
author | Thomas Heller <theller@ctypes.org> | 2006-04-18 14:57:39 (GMT) |
---|---|---|
committer | Thomas Heller <theller@ctypes.org> | 2006-04-18 14:57:39 (GMT) |
commit | 9d89299feab30c530d2ee756ea8da2e54234bc97 (patch) | |
tree | fa7fa92ae10e65d21af9057dba3c78ff981f6ef6 | |
parent | a4ebc135ac2bbf1f74327dc37a12a4928b871dd8 (diff) | |
download | cpython-9d89299feab30c530d2ee756ea8da2e54234bc97.zip cpython-9d89299feab30c530d2ee756ea8da2e54234bc97.tar.gz cpython-9d89299feab30c530d2ee756ea8da2e54234bc97.tar.bz2 |
Fix refcounting.
This makes 'import ctypes; reload(ctypes)' no longer leak reference counts.
-rw-r--r-- | Modules/_ctypes/_ctypes.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index d751841..3f2e7a0 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -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; |