Hi Michael, On Wed, Jun 15, 2005 at 03:26:00PM +0100, Michael Hudson wrote: > > Hum, you probably don't want to know, but it works just fine to forget > > a Py_INCREF before PyModule_AddObject() for the following reason: > > No, it's more complicated than that, at least in an embedded > scenario (see bug #1220756).
Uh, yes, indeed. I guess that my explanations don't survive an interpreter shutdown, after which the reference counter of the object effectively drops to zero. I don't see how this doesn't crash Python when you exit. It could be that the gc is not called after the reference from the import mechanism was effectively removed -- type objects after a PyType_Ready() are full of ref cycles. But it's all quite obscure. Armin _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com