This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients pitrou, vstinner
Date 2016-03-19.13:07:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAMpsgwZ3Vnpn3kwjag2fn=cCg9VZPd4hLOVSvzs0aL0p+gry_Q@mail.gmail.com>
In-reply-to <1458381905.27.0.290915671908.issue26590@psf.upfronthosting.co.za>
Content
2016-03-19 11:05 GMT+01:00 Antoine Pitrou <report@bugs.python.org>:
> sock_finalize() is only called explicitly if there is a reference cycle. This is why sock_dealloc() has to call it.

I'm fine with keeping sock_dealloc() to call sock_finalize(), but I
would like to understand.

Example:
---
import socket
s=socket.socket()
s=None
---

With this code, sock_finalize() is called before sock_dealloc():

#0  sock_finalize (s=0x7ffff0730c28) at
/home/haypo/prog/python/default/Modules/socketmodule.c:4172
#1  0x00000000004d8f59 in PyObject_CallFinalizer (self=<socket at
remote 0x7ffff0730c28>) at Objects/object.c:294
#2  0x00000000004d8fcd in PyObject_CallFinalizerFromDealloc
(self=<socket at remote 0x7ffff0730c28>) at Objects/object.c:311
#3  0x00000000004f2c8f in subtype_dealloc (self=<socket at remote
0x7ffff0730c28>) at Objects/typeobject.c:1154
#4  0x00000000004dc8ae in _Py_Dealloc (op=<socket at remote
0x7ffff0730c28>) at Objects/object.c:1783
History
Date User Action Args
2016-03-19 13:07:01vstinnersetrecipients: + vstinner, pitrou
2016-03-19 13:07:01vstinnerlinkissue26590 messages
2016-03-19 13:07:01vstinnercreate