Blob Blame History Raw
--- swipl-9.2.3/packages/swipy/janus/janus.c.orig	2024-04-04 08:11:51.000000000 -0600
+++ swipl-9.2.3/packages/swipy/janus/janus.c	2024-04-05 12:02:46.639224747 -0600
@@ -426,7 +426,6 @@ py_register_module(term_t name, term_t o
       goto out;
 
     m = check_error(PyImport_Import(idobj));
-    Py_DECREF(idobj);
     if ( m )
     { PyObject *old = NULL;
       if ( mod )
@@ -434,12 +433,11 @@ py_register_module(term_t name, term_t o
       rc = py_add_hashmap(py_module_table, as, m, &old);
       if ( old )
 	Py_DECREF(old);
-      return rc;
     }
+out:
+    Py_DECREF(idobj);
   }
 
-out:
-  Py_CLEAR(idobj);
   return rc;
 }