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.

classification
Title: sock_type doesn't have GC although it can contain a PyObject*
Type: behavior Stage:
Components: Extension Modules Versions: Python 3.0, Python 2.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, christian.heimes
Priority: normal Keywords:

Created on 2007-12-07 11:49 by christian.heimes, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg58270 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2007-12-07 11:49
The socket object is defined in socketmodule.h as

typedef struct {
        PyObject_HEAD
        SOCKET_T sock_fd;       /* Socket file descriptor */
        int sock_family;        /* Address family, e.g., AF_INET */
        int sock_type;          /* Socket type, e.g., SOCK_STREAM */
        int sock_proto;         /* Protocol type, usually 0 */
        PyObject *(*errorhandler)(void); /* Error handler; checks
                                            errno, returns NULL and
                                            sets a Python exception */
        double sock_timeout;             /* Operation timeout in seconds;
                                            0.0 means non-blocking */
} PySocketSockObject;

The PyTypeObject sock_type doesn't have support for cyclic GC. Shouldn't
types that can contain a PyObject* use GC?
msg58271 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2007-12-07 12:23
But there is not PyObject* in this struct. errorhandler is a pointer to
a C function returning a PyObject*; it cannot create a reference cycle.
msg58273 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2007-12-07 13:27
uhm ... yeah, you are right.

I saw PyObject* and didn't though about the rest.
History
Date User Action Args
2022-04-11 14:56:28adminsetgithub: 45907
2007-12-07 13:27:26christian.heimessetstatus: open -> closed
resolution: not a bug
messages: + msg58273
2007-12-07 12:23:23amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg58271
2007-12-07 11:49:59christian.heimescreate