If no indexURL is provided, we throw and catch an error and
then use ErrorStackParser to calculate where pyodide.js has
been loaded from. Resolves #2290.
ENH Calculate indexURL from error stack trace. If no indexURL is provided, we throw and catch an error and
then use ErrorStackParser to calculate where pyodide.js has
been loaded from. Resolves #2290.
diff --git a/cardenc/pycard.cc b/cardenc/pycard.cc
index c4d2ead..a0a30db 100644
--- a/cardenc/pycard.cc
+++ b/cardenc/pycard.cc
@@ -11,6 +11,7 @@
 #include <setjmp.h>
 #include <signal.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <Python.h>
 
 #include "card.hh"
@@ -122,8 +123,14 @@ static struct PyModuleDef module_def = {
 	NULL,              /* m_free */
 };
 
+static volatile int *_dummy_malloc;
+
 PyMODINIT_FUNC PyInit_pycard(void)
 {
+	_dummy_malloc = (int *)malloc(sizeof(int));
+	*_dummy_malloc = 1;
+	free((void *)_dummy_malloc);
+
 	PyObject *m = PyModule_Create(&module_def);
 
 	if (m == NULL)
diff --git a/solvers/pysolvers.cc b/solvers/pysolvers.cc
index a198f43..d45639b 100644
--- a/solvers/pysolvers.cc
+++ b/solvers/pysolvers.cc
@@ -15,6 +15,7 @@
 #include <setjmp.h>
 #include <signal.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <vector>
 
 #ifdef WITH_CADICAL
@@ -643,8 +644,14 @@ static struct PyModuleDef module_def = {
 	NULL,              /* m_free */
 };
 
+static volatile int *_dummy_malloc;
+
 PyMODINIT_FUNC PyInit_pysolvers(void)
 {
+	_dummy_malloc = (int *)malloc(sizeof(int));
+	*_dummy_malloc = 1;
+	free((void *)_dummy_malloc);
+
 	PyObject *m = PyModule_Create(&module_def);
 
 	if (m == NULL)

diff --git a/cardenc/pycard.cc b/cardenc/pycard.cc
index c4d2ead..a0a30db 100644
--- a/cardenc/pycard.cc
+++ b/cardenc/pycard.cc
@@ -11,6 +11,7 @@
 #include <setjmp.h>
 #include <signal.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <Python.h>
 
 #include "card.hh"
@@ -122,8 +123,14 @@ static struct PyModuleDef module_def = {
 	NULL,              /* m_free */
 };
 
+static volatile int *_dummy_malloc;
+
 PyMODINIT_FUNC PyInit_pycard(void)
 {
+	_dummy_malloc = (int *)malloc(sizeof(int));
+	*_dummy_malloc = 1;
+	free((void *)_dummy_malloc);
+
 	PyObject *m = PyModule_Create(&module_def);
 
 	if (m == NULL)
diff --git a/solvers/pysolvers.cc b/solvers/pysolvers.cc
index a198f43..d45639b 100644
--- a/solvers/pysolvers.cc
+++ b/solvers/pysolvers.cc
@@ -15,6 +15,7 @@
 #include <setjmp.h>
 #include <signal.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <vector>
 
 #ifdef WITH_CADICAL
@@ -643,8 +644,14 @@ static struct PyModuleDef module_def = {
 	NULL,              /* m_free */
 };
 
+static volatile int *_dummy_malloc;
+
 PyMODINIT_FUNC PyInit_pysolvers(void)
 {
+	_dummy_malloc = (int *)malloc(sizeof(int));
+	*_dummy_malloc = 1;
+	free((void *)_dummy_malloc);
+
 	PyObject *m = PyModule_Create(&module_def);
 
 	if (m == NULL)
