comparison CodeAnalysis/Enumeration.mustache @ 131:c55b0583084b

integration fix-leak->mainline
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 30 Aug 2023 11:52:45 +0200
parents 65ec5597ec70 5b59ebc267e1
children 71d305c29cfa
comparison
equal deleted inserted replaced
130:a3f77cf16396 131:c55b0583084b
63 * dictionary with these attributes before calling PyType_Ready() 63 * dictionary with these attributes before calling PyType_Ready()
64 * (in your module initialization function)." 64 * (in your module initialization function)."
65 **/ 65 **/
66 66
67 {{#values}} 67 {{#values}}
68 PyDict_SetItemString(sdk_{{name}}_Type.tp_dict, "{{key}}", PyLong_FromLong({{value}})); 68 {
69 PyObject* tmp = PyLong_FromLong({{value}});
70 PyDict_SetItemString(sdk_{{name}}_Type.tp_dict, "{{key}}", tmp);
71 Py_DECREF(tmp);
72 }
73
69 {{/values}} 74 {{/values}}
70 75
71 Py_INCREF(&sdk_{{name}}_Type); 76 Py_INCREF(&sdk_{{name}}_Type);
72 if (PyModule_AddObject(module, "{{short_name}}", (PyObject *)&sdk_{{name}}_Type) < 0) 77 if (PyModule_AddObject(module, "{{short_name}}", (PyObject *)&sdk_{{name}}_Type) < 0)
73 { 78 {