Stefan Behnel ha scritto:
Note that there is the type() builtin function which returns the type given
an instance. So you can't hide the type.
Argh! Yes, you are right.
So I'd better have a look to Cython, right?
L-
--
http://mail.python.org/mailman/listinfo/python-list
Mr.M, 30.01.2010 14:24:
> Could I allocate my resources in a "static" object linked to my module?
Sure, but you will have to let CPython know about it so that it can see
that the reference is only held by the module that it is cleaning up.
Otherwise it can't collect the reference. This works easil
Stefan Behnel ha scritto:
Gabriel already pointed you to the module cleanup support in Py3, which can
be used to provide reload capabilities to your module.
In Py2, there are at least some ways to free resources when terminating the
interpreter. See the "atexit" module and the Py_AtExit() functi
Mr.M, 29.01.2010 23:50:
> I can't figure out if there is a way to run a specialized cleanup
> function when a module needs to be "unloaded" (i.e. just before a
> reload() or when i quit the interpreter).
>
> I'm thinking of something like tp_dealloc.
>
> If I call Py_InitModule3 and look at modul
Gabriel Genellina ha scritto:
I think what you want to do isn't possible with Python 2, and it's one
of the reasons the module handling was redesigned in Python 3.x; see PEP
3121.
Thank you Gabriel for your help. Unlucky I can't use Python 3.x in my
project, sob!
Luca.
--
http://mail.python
En Fri, 29 Jan 2010 19:50:52 -0300, Mr.M escribió:
I can't figure out if there is a way to run a specialized cleanup
function when a module needs to be "unloaded" (i.e. just before a
reload() or when i quit the interpreter).
I think what you want to do isn't possible with Python 2, and it'
Hi,
I can't figure out if there is a way to run a specialized cleanup
function when a module needs to be "unloaded" (i.e. just before a
reload() or when i quit the interpreter).
I'm thinking of something like tp_dealloc.
If I call Py_InitModule3 and look at module->ob_type->tp_dealloc, I fin