Extension Modules
-----------------
+- Fix the leak of a dict in the time module when used in an embedded
+ interpreter that is repeatedly initialized and shutdown and reinitialized.
+
- Issue #12268: File readline, readlines and read or readall methods
no longer lose data when an underlying read system call is interrupted
within an io module object. IOError is no longer raised due to a read
static double floattime(void);
/* For Y2K check */
-static PyObject *moddict;
+static PyObject *moddict = NULL;
/* Exposed in timefuncs.h. */
time_t
/* Accept 2-digit dates unless PYTHONY2K is set and non-empty */
p = Py_GETENV("PYTHONY2K");
PyModule_AddIntConstant(m, "accept2dyear", (long) (!p || !*p));
+ /* If an embedded interpreter is shutdown and reinitialized the old
+ moddict was not decrefed on shutdown and the next import of this
+ module leads to a leak. Conditionally decref here to prevent that.
+ */
+ Py_XDECREF(moddict);
/* Squirrel away the module's dictionary for the y2k check */
moddict = PyModule_GetDict(m);
Py_INCREF(moddict);
return 0;
}
-
-