Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e4bc7f6

Browse files
committed
Issue #4838: When a module is deallocated, free the memory backing the optional module state data.
1 parent 0c3f8a4 commit e4bc7f6

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ What's New in Python 3.1 alpha 0
1212
Core and Builtins
1313
-----------------
1414

15+
- Issue #4838: When a module is deallocated, free the memory backing the
16+
optional module state data.
17+
1518
- Issue #4910: Rename nb_long slot to nb_reserved, and change its
1619
type to (void *).
1720

Objects/moduleobject.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ module_dealloc(PyModuleObject *m)
315315
_PyModule_Clear((PyObject *)m);
316316
Py_DECREF(m->md_dict);
317317
}
318+
if (m->md_state != NULL)
319+
PyMem_FREE(m->md_state);
318320
Py_TYPE(m)->tp_free((PyObject *)m);
319321
}
320322

0 commit comments

Comments
 (0)