python3 couldn't generate epydocs because python3 needs richcompare functions for C defined PyTypes (it seems).
This commit is contained in:
@@ -278,7 +278,7 @@ PyObject *pyop_base_dir(PyObject *self)
|
||||
/*-----------------------BPy_OperatorBase method def------------------------------*/
|
||||
PyTypeObject pyop_base_Type = {
|
||||
#if (PY_VERSION_HEX >= 0x02060000)
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
#else
|
||||
/* python 2.5 and below */
|
||||
PyObject_HEAD_INIT( NULL ) /* required py macro */
|
||||
@@ -364,7 +364,7 @@ PyTypeObject pyop_base_Type = {
|
||||
/*-----------------------BPy_OperatorBase method def------------------------------*/
|
||||
PyTypeObject pyop_func_Type = {
|
||||
#if (PY_VERSION_HEX >= 0x02060000)
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
#else
|
||||
/* python 2.5 and below */
|
||||
PyObject_HEAD_INIT( NULL ) /* required py macro */
|
||||
|
||||
@@ -36,12 +36,12 @@ extern PyTypeObject pyop_base_Type;
|
||||
extern PyTypeObject pyop_func_Type;
|
||||
|
||||
typedef struct {
|
||||
PyObject_VAR_HEAD /* required python macro */
|
||||
PyObject_HEAD /* required python macro */
|
||||
bContext *C;
|
||||
} BPy_OperatorBase;
|
||||
|
||||
typedef struct {
|
||||
PyObject_VAR_HEAD /* required python macro */
|
||||
PyObject_HEAD /* required python macro */
|
||||
char name[OP_MAX_TYPENAME];
|
||||
bContext *C;
|
||||
} BPy_OperatorFunc;
|
||||
|
||||
@@ -43,6 +43,28 @@ static int pyrna_prop_compare( BPy_PropertyRNA * a, BPy_PropertyRNA * b )
|
||||
return (a->prop==b->prop && a->ptr.data==b->ptr.data ) ? 0 : -1;
|
||||
}
|
||||
|
||||
|
||||
/* For some reason python3 needs these :/ */
|
||||
static PyObject *pyrna_struct_richcmp(BPy_StructRNA * a, BPy_StructRNA * b, int op)
|
||||
{
|
||||
int cmp_result= -1; /* assume false */
|
||||
if (BPy_StructRNA_Check(a) && BPy_StructRNA_Check(b)) {
|
||||
cmp_result= pyrna_struct_compare(a, b);
|
||||
}
|
||||
|
||||
return Py_CmpToRich(op, cmp_result);
|
||||
}
|
||||
|
||||
static PyObject *pyrna_prop_richcmp(BPy_PropertyRNA * a, BPy_PropertyRNA * b, int op)
|
||||
{
|
||||
int cmp_result= -1; /* assume false */
|
||||
if (BPy_PropertyRNA_Check(a) && BPy_PropertyRNA_Check(b)) {
|
||||
cmp_result= pyrna_prop_compare(a, b);
|
||||
}
|
||||
|
||||
return Py_CmpToRich(op, cmp_result);
|
||||
}
|
||||
|
||||
/*----------------------repr--------------------------------------------*/
|
||||
static PyObject *pyrna_struct_repr( BPy_StructRNA * self )
|
||||
{
|
||||
@@ -954,7 +976,7 @@ static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *k
|
||||
/*-----------------------BPy_StructRNA method def------------------------------*/
|
||||
PyTypeObject pyrna_struct_Type = {
|
||||
#if (PY_VERSION_HEX >= 0x02060000)
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
#else
|
||||
/* python 2.5 and below */
|
||||
PyObject_HEAD_INIT( NULL ) /* required py macro */
|
||||
@@ -1001,7 +1023,7 @@ PyTypeObject pyrna_struct_Type = {
|
||||
|
||||
/*** Assigned meaning in release 2.1 ***/
|
||||
/*** rich comparisons ***/
|
||||
NULL, /* richcmpfunc tp_richcompare; */
|
||||
(richcmpfunc)pyrna_struct_richcmp, /* richcmpfunc tp_richcompare; */
|
||||
|
||||
/*** weak reference enabler ***/
|
||||
0, /* long tp_weaklistoffset; */
|
||||
@@ -1039,7 +1061,7 @@ PyTypeObject pyrna_struct_Type = {
|
||||
/*-----------------------BPy_PropertyRNA method def------------------------------*/
|
||||
PyTypeObject pyrna_prop_Type = {
|
||||
#if (PY_VERSION_HEX >= 0x02060000)
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
#else
|
||||
/* python 2.5 and below */
|
||||
PyObject_HEAD_INIT( NULL ) /* required py macro */
|
||||
@@ -1087,7 +1109,7 @@ PyTypeObject pyrna_prop_Type = {
|
||||
|
||||
/*** Assigned meaning in release 2.1 ***/
|
||||
/*** rich comparisons ***/
|
||||
NULL, /* richcmpfunc tp_richcompare; */
|
||||
(richcmpfunc)pyrna_prop_richcmp, /* richcmpfunc tp_richcompare; */
|
||||
|
||||
/*** weak reference enabler ***/
|
||||
0, /* long tp_weaklistoffset; */
|
||||
|
||||
@@ -33,14 +33,17 @@
|
||||
extern PyTypeObject pyrna_struct_Type;
|
||||
extern PyTypeObject pyrna_prop_Type;
|
||||
|
||||
#define BPy_StructRNA_Check(v) (PyObject_TypeCheck(v, &pyrna_struct_Type))
|
||||
#define BPy_PropertyRNA_Check(v) (PyObject_TypeCheck(v, &pyrna_prop_Type))
|
||||
|
||||
typedef struct {
|
||||
PyObject_VAR_HEAD /* required python macro */
|
||||
PyObject_HEAD /* required python macro */
|
||||
PointerRNA ptr;
|
||||
int freeptr; /* needed in some cases if ptr.data is created on the fly, free when deallocing */
|
||||
} BPy_StructRNA;
|
||||
|
||||
typedef struct {
|
||||
PyObject_VAR_HEAD /* required python macro */
|
||||
PyObject_HEAD /* required python macro */
|
||||
PointerRNA ptr;
|
||||
PropertyRNA *prop;
|
||||
} BPy_PropertyRNA;
|
||||
|
||||
Reference in New Issue
Block a user