]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Don't incref on new reference key_style
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 22 May 2020 14:13:02 +0000 (10:13 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 22 May 2020 14:19:57 +0000 (10:19 -0400)
in 4550983e0ce2f35b3585e53894c941c23693e71d we
added a new attribute key_style.  remove an erroneous
Py_INCREF when we acquire it from PyLong_FromLong
as we already own the reference.    since this
is a new reference we actualy need to Py_DECREF
it because we aren't returning it.

Change-Id: I61470513a173c76863ec6f7f5ff9b2ec13582f08

lib/sqlalchemy/cextension/resultproxy.c

index 244379116d24e55589e5cf66f0e0a102a8f977bc..8511d4223d85d87c53e984b832215f0cbe3b232a 100644 (file)
@@ -241,11 +241,11 @@ BaseRow_filter_on_values(BaseRow *self, PyObject *filters)
     row_class = PyObject_GetAttrString(sqlalchemy_engine_row, "Row");
 
     key_style = PyLong_FromLong(self->key_style);
-    Py_INCREF(key_style);
 
     new_obj = PyObject_CallFunction(
         row_class, "OOOOO", self->parent, filters, self->keymap,
         key_style, self->row);
+    Py_DECREF(key_style);
     Py_DECREF(row_class);
     if (new_obj == NULL) {
         return NULL;