From 318e32cbc058e31ec509668c0f56853c9926f8de Mon Sep 17 00:00:00 2001 From: ahgamut <41098605+ahgamut@users.noreply.github.com> Date: Fri, 17 Jun 2022 01:37:46 +0530 Subject: [PATCH] make test_atexit pass in MODE= --- third_party/python/Python/import.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/third_party/python/Python/import.c b/third_party/python/Python/import.c index 0f9036a36..626c5d044 100644 --- a/third_party/python/Python/import.c +++ b/third_party/python/Python/import.c @@ -2816,7 +2816,10 @@ PyInit_imp(void) goto failure; if (PyModule_AddObject(m, "CosmoImporter", (PyObject*)&CosmoImporterType) < 0) goto failure; - + /* test_atexit segfaults without the below incref, but + * I'm not supposed to Py_INCREF a static PyTypeObject, so + * what's going on? */ + Py_INCREF(&CosmoImporterType); return m; failure: Py_XDECREF(m);