diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-16 22:55:52 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-16 22:55:52 +0000 |
commit | cd47c2446f1a9dee96610f298989848f8986a8be (patch) | |
tree | 02c30d62a9164987d0aaba2f72c58a50053205d6 /src/libs/xpcom18a4/python/src/PyIID.cpp | |
parent | Releasing progress-linux version 7.0.14-dfsg-4~progress7.99u1. (diff) | |
download | virtualbox-cd47c2446f1a9dee96610f298989848f8986a8be.tar.xz virtualbox-cd47c2446f1a9dee96610f298989848f8986a8be.zip |
Merging upstream version 7.0.16-dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/libs/xpcom18a4/python/src/PyIID.cpp')
-rw-r--r-- | src/libs/xpcom18a4/python/src/PyIID.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/libs/xpcom18a4/python/src/PyIID.cpp b/src/libs/xpcom18a4/python/src/PyIID.cpp index f24ae20e..9825db88 100644 --- a/src/libs/xpcom18a4/python/src/PyIID.cpp +++ b/src/libs/xpcom18a4/python/src/PyIID.cpp @@ -236,13 +236,14 @@ PyTypeObject *Py_nsIID::GetTypeObject(void) { Py_tp_hash, (void *)(uintptr_t)&Py_nsIID::PyTypeMethod_hash }, { Py_tp_str, (void *)(uintptr_t)&Py_nsIID::PyTypeMethod_str }, { Py_tp_richcompare, (void *)(uintptr_t)&Py_nsIID::PyTypeMethod_richcompare }, + { Py_tp_is_gc, (void *)(uintptr_t)&Py_nsIID::PyTypeMethod_is_gc }, { 0, NULL } /* terminator */ }; PyType_Spec TypeSpec = { /* .name: */ "IID", /* .basicsize: */ sizeof(Py_nsIID), /* .itemsize: */ 0, - /* .flags: */ 0, + /* .flags: */ Py_TPFLAGS_DEFAULT, /* .slots: */ aTypeSlots, }; @@ -319,10 +320,22 @@ Py_nsIID::PyTypeMethod_compare(PyObject *self, PyObject *other) /* static */ PyObject * Py_nsIID::PyTypeMethod_richcompare(PyObject *self, PyObject *other, int op) { + nsIID iid; + if (!Py_nsIID::IIDFromPyObject(other, &iid)) + { + /* Can't do comparison besides equality/inequality if the other object does not contain an IID. */ + if (op == Py_EQ) + Py_RETURN_FALSE; + else if (op == Py_NE) + Py_RETURN_TRUE; + + PyErr_SetString(PyExc_TypeError, "Comparison between different object types is not defined"); + return NULL; + } + PyObject *result = NULL; Py_nsIID *s_iid = (Py_nsIID *)self; - Py_nsIID *o_iid = (Py_nsIID *)other; - int rc = memcmp(&s_iid->m_iid, &o_iid->m_iid, sizeof(s_iid->m_iid)); + int rc = memcmp(&s_iid->m_iid, &iid, sizeof(s_iid->m_iid)); switch (op) { case Py_LT: @@ -408,3 +421,11 @@ Py_nsIID::PyTypeMethod_dealloc(PyObject *ob) { delete (Py_nsIID *)ob; } + +#ifdef Py_LIMITED_API +/* static */ int +Py_nsIID::PyTypeMethod_is_gc(PyObject *self) +{ + return 0; +} +#endif |