Issue #3740: Null-initialize module state.
Reviewed by Benjamin Peterson.
diff --git a/Misc/NEWS b/Misc/NEWS
index 1c58097..2505bfa 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -15,6 +15,8 @@
 Core and Builtins
 -----------------
 
+- Issue #3740: Null-initialize module state.
+
 - Issue #3946: PyObject_CheckReadBuffer crashed on a memoryview object.
 
 - Issue #1688: On Windows, the input() prompt was not correctly displayed if it
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index ae01651..7f81ce4 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -113,6 +113,7 @@
 			Py_DECREF(m);
 			return NULL;
 		}
+		memset(m->md_state, 0, module->m_size);
 	}
 			
 	d = PyModule_GetDict((PyObject*)m);