Skip to content

Commit 2f28106

Browse files
authored
Merge pull request #178 from hoefling/pyxmlsec-error-callback-2
Reinstall custom error callback after xmlSecCryptoInit()
2 parents efced9f + 94f0fef commit 2f28106

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/main.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ static int PyXmlSec_Init(void) {
8787
PyXmlSec_Free(_PYXMLSEC_FREE_ALL);
8888
return -1;
8989
}
90+
// xmlsec will install default callback in xmlSecCryptoInit,
91+
// overwriting any custom callbacks.
92+
// We thus reinstall our callback now.
93+
PyXmlSec_InstallErrorCallback();
94+
9095
free_mode = _PYXMLSEC_FREE_ALL;
9196
return 0;
9297
}
@@ -239,11 +244,6 @@ PYENTRY_FUNC_NAME(void)
239244

240245
if (PyXmlSec_Init() < 0) goto ON_FAIL;
241246

242-
// xmlsec will install default callback in PyXmlSec_Init,
243-
// overwriting any custom callbacks.
244-
// We thus install our callback again now.
245-
PyXmlSec_InstallErrorCallback();
246-
247247
if (PyModule_AddStringConstant(module, "__version__", STRINGIFY(MODULE_VERSION)) < 0) goto ON_FAIL;
248248

249249
if (PyXmlSec_InitLxmlModule() < 0) goto ON_FAIL;

tests/test_xmlsec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ def test_reinitialize_module(self):
1010
tests don't fail, we know that the ``init()``/``shutdown()``
1111
function pair doesn't break anything.
1212
"""
13-
# xmlsec.shutdown()
14-
# xmlsec.init()
13+
xmlsec.shutdown()
14+
xmlsec.init()

0 commit comments

Comments
 (0)