From efe3cd22610ec1db6fbdd376774677c1c25cfc66 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Thu, 21 May 2026 12:09:27 +0000 Subject: [PATCH] update secp256k1 extmod for free-threaded Python builds --- extmod/secp256k1mod.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/extmod/secp256k1mod.c b/extmod/secp256k1mod.c index 8fdea24c..bd1a7dc1 100755 --- a/extmod/secp256k1mod.c +++ b/extmod/secp256k1mod.c @@ -428,12 +428,19 @@ PyMODINIT_FUNC PyInit_secp256k1(void) { if (module == NULL) INITERROR; + struct module_state *st = GETSTATE(module); st->error = PyErr_NewException("secp256k1.Error", NULL, NULL); + if (st->error == NULL) { Py_DECREF(module); INITERROR; } + +#ifdef Py_GIL_DISABLED + PyUnstable_Module_SetGIL(module, Py_MOD_GIL_NOT_USED); +#endif + return module; }