summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfsbs <fsbs@users.noreply.github.com>2021-10-19 17:13:10 +0000
committerfsbs <fsbs@users.noreply.github.com>2021-10-19 19:13:10 +0200
commit3bb6a3d13bf0b19d3f45ca8c758a1f02395dc688 (patch)
tree8785d489a5ddd09d88ca67379199593403c0a3e2
parent2d672b6a6cfdbb55d54c7d07c2ef829eb64acbba (diff)
downloadpycurl-3bb6a3d13bf0b19d3f45ca8c758a1f02395dc688.tar.gz
add CurlMulti subclassing
-rw-r--r--src/multi.c4
-rw-r--r--src/threadsupport.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/multi.c b/src/multi.c
index d7677c5..850eabb 100644
--- a/src/multi.c
+++ b/src/multi.c
@@ -11,7 +11,7 @@ static void
assert_multi_state(const CurlMultiObject *self)
{
assert(self != NULL);
- assert(Py_TYPE(self) == p_CurlMulti_Type);
+ assert(PyObject_IsInstance((PyObject *) self, (PyObject *) p_CurlMulti_Type) == 1);
#ifdef WITH_THREAD
if (self->state != NULL) {
assert(self->multi_handle != NULL);
@@ -56,7 +56,7 @@ do_multi_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
}
/* Allocate python curl-multi object */
- self = (CurlMultiObject *) p_CurlMulti_Type->tp_alloc(p_CurlMulti_Type, 0);
+ self = (CurlMultiObject *) subtype->tp_alloc(subtype, 0);
if (!self) {
return NULL;
}
diff --git a/src/threadsupport.c b/src/threadsupport.c
index 4408161..b188872 100644
--- a/src/threadsupport.c
+++ b/src/threadsupport.c
@@ -43,7 +43,7 @@ pycurl_get_thread_state_multi(const CurlMultiObject *self)
*/
if (self == NULL)
return NULL;
- assert(Py_TYPE(self) == p_CurlMulti_Type);
+ assert(PyObject_IsInstance((PyObject *) self, (PyObject *) p_CurlMulti_Type) == 1);
if (self->state != NULL)
{
/* inside multi_perform() */