Author: Ronan Lamy <[email protected]>
Branch: multiphase
Changeset: r92153:14b50017ab08
Date: 2017-08-14 21:29 +0200
http://bitbucket.org/pypy/pypy/changeset/14b50017ab08/

Log:    Fix leaks in PyType_FromSpec

diff --git a/pypy/module/cpyext/typeobject.py b/pypy/module/cpyext/typeobject.py
--- a/pypy/module/cpyext/typeobject.py
+++ b/pypy/module/cpyext/typeobject.py
@@ -597,6 +597,7 @@
     if obj_pto.c_tp_flags & Py_TPFLAGS_HEAPTYPE:
         heaptype = rffi.cast(PyHeapTypeObject, obj)
         Py_DecRef(space, heaptype.c_ht_name)
+        Py_DecRef(space, heaptype.c_ht_qualname)
         Py_DecRef(space, base_pyo)
         _dealloc(space, obj)
 
@@ -925,8 +926,7 @@
         name = specname
     else:
         name = specname[dotpos + 1:]
-    res.c_ht_name = make_ref(
-        space, PyUnicode_FromString(space, rffi.str2charp(name)))
+    res.c_ht_name = make_ref(space, space.newtext(name))
     res.c_ht_qualname = res.c_ht_name
     incref(space, res.c_ht_qualname)
     typ.c_tp_name = spec.c_name
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to