VirtualBox

Changeset 64330 in vbox for trunk/src


Ignore:
Timestamp:
Oct 20, 2016 12:11:23 PM (8 years ago)
Author:
vboxsync
Message:

libs/xpcom/python: fixes when compiling against Python 3.2 or newer

Location:
trunk/src/libs/xpcom18a4/python/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/python/src/PyIID.cpp

    r59809 r64330  
    319319}
    320320
     321#if PY_VERSION_HEX >= 0x03020000
     322/* static */Py_hash_t
     323Py_nsIID::PyTypeMethod_hash(PyObject *self)
     324#else
    321325/* static */long
    322326Py_nsIID::PyTypeMethod_hash(PyObject *self)
     327#endif
    323328{
    324329        const nsIID &iid = ((Py_nsIID *)self)->m_iid;
    325330
     331#if PY_VERSION_HEX >= 0x03020000
     332        Py_hash_t ret = iid.m0 + iid.m1 + iid.m2;
     333#else
    326334        long ret = iid.m0 + iid.m1 + iid.m2;
     335#endif
    327336        for (int i=0;i<7;i++)
    328337                ret += iid.m3[i];
  • trunk/src/libs/xpcom18a4/python/src/PyXPCOM.h

    r59798 r64330  
    287287        static int Py_cmp(PyObject *ob1, PyObject *ob2);
    288288        static PyObject *Py_richcmp(PyObject *ob1, PyObject *ob2, int op);
     289#if PY_VERSION_HEX >= 0x03020000
     290        static Py_hash_t Py_hash(PyObject *self);
     291#else
    289292        static long Py_hash(PyObject *self);
     293#endif
    290294};
    291295
     
    443447        static PyObject *PyTypeMethod_richcompare(PyObject *self, PyObject *ob, int op);
    444448        static PyObject *PyTypeMethod_repr(PyObject *self);
     449#if PY_VERSION_HEX >= 0x03020000
     450        static Py_hash_t PyTypeMethod_hash(PyObject *self);
     451#else
    445452        static long PyTypeMethod_hash(PyObject *self);
     453#endif
    446454        static PyObject *PyTypeMethod_str(PyObject *self);
    447455        static void PyTypeMethod_dealloc(PyObject *self);
  • trunk/src/libs/xpcom18a4/python/src/TypeObject.cpp

    r62377 r64330  
    156156
    157157// @pymethod int|Py_nsISupports|__hash__|Implement a hash-code for the XPCOM object using XPCOM identity rules.
     158#if PY_VERSION_HEX >= 0x03020000
     159/*static*/Py_hash_t PyXPCOM_TypeObject::Py_hash(PyObject *self)
     160#else
    158161/*static*/long PyXPCOM_TypeObject::Py_hash(PyObject *self)
     162#endif
    159163{
    160164        // We always return the value of the nsISupports *.
     
    162166        if (!Py_nsISupports::InterfaceFromPyObject(self, NS_GET_IID(nsISupports), &pUnkThis, PR_FALSE))
    163167                return -1;
     168#if PY_VERSION_HEX >= 0x03020000
     169        Py_hash_t ret = _Py_HashPointer(pUnkThis);
     170#else
    164171        long ret = _Py_HashPointer(pUnkThis);
     172#endif
    165173        pUnkThis->Release();
    166174        return ret;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette