summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfsbs <fsbs@users.noreply.github.com>2021-11-01 21:38:32 +0000
committerfsbs <fsbs@users.noreply.github.com>2021-11-01 22:38:32 +0100
commit6beb8325eb269e1f24a0fd58bc6d776bf988da3a (patch)
treedfc8de5d9e97df9fffc9deec571e55da8123f8e0
parent0082a89bcd6531c83126d6ae1b1d8067d5825946 (diff)
downloadpycurl-6beb8325eb269e1f24a0fd58bc6d776bf988da3a.tar.gz
duphandle: allocate subtype instead of Curl_Type
-rw-r--r--src/easy.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/easy.c b/src/easy.c
index 05f24c7..2b1e296 100644
--- a/src/easy.c
+++ b/src/easy.c
@@ -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;