A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-April/119110.html below:

[Python-Dev] questions about memory management

[Python-Dev] questions about memory managementJulia Lawall julia.lawall at lip6.fr
Sat Apr 28 10:06:52 CEST 2012
In Python-3.2.3/Python/import.c, in the function 
_PyImport_FixupExtensionUnicode, is any call to PyDict_DelItemString 
needed before the final failure returns?

     modules = PyImport_GetModuleDict();
     if (PyDict_SetItemString(modules, name, mod) < 0)
         return -1;
     if (_PyState_AddModule(mod, def) < 0) {
         PyDict_DelItemString(modules, name);
         return -1;
     }
     if (def->m_size == -1) {
         if (def->m_base.m_copy) {
             /* Somebody already imported the module,
                likely under a different name.
                XXX this should really not happen. */
             Py_DECREF(def->m_base.m_copy);
             def->m_base.m_copy = NULL;
         }
         dict = PyModule_GetDict(mod);
         if (dict == NULL)
             return -1;
         def->m_base.m_copy = PyDict_Copy(dict);
         if (def->m_base.m_copy == NULL)
             return -1;
     }

In Python-3.2.3/Modules/ossaudiodev.c, in the function build_namelists, is 
it intentional that labels is not freed in the last failure case:

     if (PyModule_AddObject(module, "control_labels", labels) == -1)
         goto error2;
     if (PyModule_AddObject(module, "control_names", names) == -1)
         goto error1;

     return 0;

error2:
     Py_XDECREF(labels);
error1:
     Py_XDECREF(names);
     return -1;

thanks,
julia
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4