diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2011-11-07 12:00:05 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2011-11-07 12:00:05 (GMT) |
commit | d10759f6edb713e945d1caf19d74ea4e12da7894 (patch) | |
tree | 81ca1ffcbe397faaa4119100a44dc3c21668da9c /Objects/object.c | |
parent | e9b11c1cd8ad68e829ae627ef48bdbc940f8e7fb (diff) | |
download | cpython-d10759f6edb713e945d1caf19d74ea4e12da7894.zip cpython-d10759f6edb713e945d1caf19d74ea4e12da7894.tar.gz cpython-d10759f6edb713e945d1caf19d74ea4e12da7894.tar.bz2 |
Make _PyUnicode_FromId return borrowed references.
http://mail.python.org/pipermail/python-dev/2011-November/114347.html
Diffstat (limited to 'Objects/object.c')
-rw-r--r-- | Objects/object.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Objects/object.c b/Objects/object.c index 7db60f3..51188b7 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -814,11 +814,10 @@ PyObject * _PyObject_GetAttrId(PyObject *v, _Py_Identifier *name) { PyObject *result; - PyObject *oname = _PyUnicode_FromId(name); + PyObject *oname = _PyUnicode_FromId(name); /* borrowed */ if (!oname) return NULL; result = PyObject_GetAttr(v, oname); - Py_DECREF(oname); return result; } @@ -826,11 +825,10 @@ int _PyObject_HasAttrId(PyObject *v, _Py_Identifier *name) { int result; - PyObject *oname = _PyUnicode_FromId(name); + PyObject *oname = _PyUnicode_FromId(name); /* borrowed */ if (!oname) return -1; result = PyObject_HasAttr(v, oname); - Py_DECREF(oname); return result; } @@ -838,11 +836,10 @@ int _PyObject_SetAttrId(PyObject *v, _Py_Identifier *name, PyObject *w) { int result; - PyObject *oname = _PyUnicode_FromId(name); + PyObject *oname = _PyUnicode_FromId(name); /* borrowed */ if (!oname) return -1; result = PyObject_SetAttr(v, oname, w); - Py_DECREF(oname); return result; } |