Skip to content

Commit 8198419

Browse files
committed
Follow up of a290f25:
Also check validity of python objects in traverse() function, since they might be closed/deleted before.
1 parent a290f25 commit 8198419

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mariadb/mariadb_cursor.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,10 @@ static int MrdbCursor_traverse(
344344

345345
static int MrdbCursor_tpclear(MrdbCursor *self)
346346
{
347-
Py_CLEAR(self->connection);
348-
Py_CLEAR(self->data);
347+
if (self->connection)
348+
Py_CLEAR(self->connection);
349+
if (self->data)
350+
Py_CLEAR(self->data);
349351
return 0;
350352
}
351353

0 commit comments

Comments
 (0)