diff options
author | fsbs <fsbs@users.noreply.github.com> | 2021-11-01 21:38:32 +0000 |
---|---|---|
committer | fsbs <fsbs@users.noreply.github.com> | 2021-11-01 22:38:32 +0100 |
commit | 6beb8325eb269e1f24a0fd58bc6d776bf988da3a (patch) | |
tree | dfc8de5d9e97df9fffc9deec571e55da8123f8e0 | |
parent | 0082a89bcd6531c83126d6ae1b1d8067d5825946 (diff) | |
download | pycurl-6beb8325eb269e1f24a0fd58bc6d776bf988da3a.tar.gz |
duphandle: allocate subtype instead of Curl_Type
-rw-r--r-- | src/easy.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -276,13 +276,14 @@ static inline PyObject* my_Py_XNewRef(PyObject *obj) PYCURL_INTERNAL CurlObject * do_curl_duphandle(CurlObject *self) { + PyTypeObject *subtype; CurlObject *dup; int res; int *ptr; /* Allocate python curl object */ - /* TODO: allocate subtype instead of Curl_Type */ - dup = (CurlObject *) p_Curl_Type->tp_alloc(p_Curl_Type, 0); + subtype = Py_TYPE(self); + dup = (CurlObject *) subtype->tp_alloc(subtype, 0); if (dup == NULL) return NULL; |