[Python-Dev] refcounting vs PyModule_AddObject

Michael Hudson mwh at python.net
Wed Jun 15 15:05:25 CEST 2005


Skip Montanaro <skip at pobox.com> writes:

>     Michael> So I went looking for other instances of the same problem.  I
>     Michael> didn't find any (though I don't understand how _csv.c gets away
>     Michael> with line 1579)...
>
> Same reason the Py_INCREF of ProfileError isn't necessary I think.
> PyDict_New() returns a new reference which is passed onto
> PyModule_AddObject().  No Py_DECREF of the dialects dict occurs, so it exits
> reference-neutral w.r.t. the dialects object.

Oops; I meant line 1590.

Cheers,
mwh

-- 
  Windows 2000: Smaller cow. Just as much crap.
                           -- Jim's pedigree of operating systems, asr


More information about the Python-Dev mailing list