mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-24 00:29:58 -05:00
- Fix python modules with multiple scripts, by incrementing reference
counts.
This commit is contained in:
parent
bea61fc37c
commit
7696074fa9
2 changed files with 12 additions and 0 deletions
|
|
@ -1,3 +1,7 @@
|
||||||
|
29 June 2023: Wouter
|
||||||
|
- Fix python modules with multiple scripts, by incrementing reference
|
||||||
|
counts.
|
||||||
|
|
||||||
27 June 2023: George
|
27 June 2023: George
|
||||||
- Merge #892: Add cachedb hit stat. Introduces 'num.query.cachedb' as
|
- Merge #892: Add cachedb hit stat. Introduces 'num.query.cachedb' as
|
||||||
a new statistical counter.
|
a new statistical counter.
|
||||||
|
|
|
||||||
|
|
@ -440,24 +440,28 @@ int pythonmod_init(struct module_env* env, int id)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Py_XINCREF(pe->func_init);
|
||||||
if ((pe->func_deinit = PyDict_GetItemString(pe->dict, "deinit")) == NULL)
|
if ((pe->func_deinit = PyDict_GetItemString(pe->dict, "deinit")) == NULL)
|
||||||
{
|
{
|
||||||
log_err("pythonmod: function deinit is missing in %s", pe->fname);
|
log_err("pythonmod: function deinit is missing in %s", pe->fname);
|
||||||
PyGILState_Release(gil);
|
PyGILState_Release(gil);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Py_XINCREF(pe->func_deinit);
|
||||||
if ((pe->func_operate = PyDict_GetItemString(pe->dict, "operate")) == NULL)
|
if ((pe->func_operate = PyDict_GetItemString(pe->dict, "operate")) == NULL)
|
||||||
{
|
{
|
||||||
log_err("pythonmod: function operate is missing in %s", pe->fname);
|
log_err("pythonmod: function operate is missing in %s", pe->fname);
|
||||||
PyGILState_Release(gil);
|
PyGILState_Release(gil);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Py_XINCREF(pe->func_operate);
|
||||||
if ((pe->func_inform = PyDict_GetItemString(pe->dict, "inform_super")) == NULL)
|
if ((pe->func_inform = PyDict_GetItemString(pe->dict, "inform_super")) == NULL)
|
||||||
{
|
{
|
||||||
log_err("pythonmod: function inform_super is missing in %s", pe->fname);
|
log_err("pythonmod: function inform_super is missing in %s", pe->fname);
|
||||||
PyGILState_Release(gil);
|
PyGILState_Release(gil);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Py_XINCREF(pe->func_inform);
|
||||||
|
|
||||||
if (init_standard)
|
if (init_standard)
|
||||||
{
|
{
|
||||||
|
|
@ -513,6 +517,10 @@ void pythonmod_deinit(struct module_env* env, int id)
|
||||||
Py_XDECREF(res);
|
Py_XDECREF(res);
|
||||||
/* Free shared data if any */
|
/* Free shared data if any */
|
||||||
Py_XDECREF(pe->data);
|
Py_XDECREF(pe->data);
|
||||||
|
Py_XDECREF(pe->func_init);
|
||||||
|
Py_XDECREF(pe->func_deinit);
|
||||||
|
Py_XDECREF(pe->func_inform);
|
||||||
|
Py_XDECREF(pe->func_operate);
|
||||||
PyGILState_Release(gil);
|
PyGILState_Release(gil);
|
||||||
|
|
||||||
if(--py_mod_count==0) {
|
if(--py_mod_count==0) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue