Skip to content

Commit 2a88022

Browse files
committed
fix refleaks
1 parent 1c385a3 commit 2a88022

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Objects/typeobject.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7767,10 +7767,14 @@ _PyType_SharedKeysMaxSize(PyTypeObject *type)
77677767
PyObject *attrs = PyObject_GetAttr((PyObject*)type, &_Py_ID(__expected_attributes__));
77687768
if (attrs != NULL && PyTuple_Check(attrs)) {
77697769
Py_ssize_t num_keys = PyTuple_GET_SIZE(attrs);
7770+
Py_DECREF(attrs);
77707771
if (num_keys > SHARED_KEYS_MAX_SIZE) {
77717772
return 1 + num_keys;
77727773
}
77737774
}
7775+
else {
7776+
Py_XDECREF(attrs);
7777+
}
77747778
}
77757779
return SHARED_KEYS_MAX_SIZE;
77767780
}

Python/compile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2552,6 +2552,7 @@ compiler_class_body(struct compiler *c, stmt_ty s, int firstlineno)
25522552
return ERROR;
25532553
}
25542554
ADDOP_LOAD_CONST(c, NO_LOCATION, expected_attributes);
2555+
Py_CLEAR(expected_attributes);
25552556
if (compiler_nameop(c, NO_LOCATION, &_Py_ID(__expected_attributes__), Store) < 0) {
25562557
compiler_exit_scope(c);
25572558
return ERROR;

0 commit comments

Comments
 (0)