mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-02-03 20:29:28 -05:00
Initialize per-query qdata and per-module mod_env
The python module used to assign None to the per-query (qdata argument) and per-module (mod_env variable) data stores. Hence, there was no obvious way for python code to use these data stores. This commit initializes both data stores with a dict instance.
This commit is contained in:
parent
dfe8e0dfa2
commit
7cc4ff05ad
1 changed files with 2 additions and 4 deletions
|
|
@ -317,8 +317,7 @@ int pythonmod_init(struct module_env* env, int id)
|
|||
/* Load file */
|
||||
pe->module = PyImport_AddModule("__main__");
|
||||
pe->dict = PyModule_GetDict(pe->module);
|
||||
pe->data = Py_None;
|
||||
Py_INCREF(pe->data);
|
||||
pe->data = PyDict_New();
|
||||
PyModule_AddObject(pe->module, "mod_env", pe->data);
|
||||
|
||||
/* TODO: deallocation of pe->... if an error occurs */
|
||||
|
|
@ -485,8 +484,7 @@ void pythonmod_operate(struct module_qstate* qstate, enum module_ev event,
|
|||
pq = qstate->minfo[id] = malloc(sizeof(struct pythonmod_qstate));
|
||||
|
||||
/* Initialize per query data */
|
||||
pq->data = Py_None;
|
||||
Py_INCREF(pq->data);
|
||||
pq->data = PyDict_New();
|
||||
}
|
||||
|
||||
/* Call operate */
|
||||
|
|
|
|||
Loading…
Reference in a new issue