Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-02-26 08:50:19 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-02-26 08:50:19 +0300
commitb49b02842a9f13975b5735183afdae273c9fd616 (patch)
treece3f118808bc42204ab8fb883fc05548fcea6743 /source/blender/python/intern/bpy_operator.c
parent9ac7c8e91a9e699ff3490881c554e08fc348f442 (diff)
update to build with python 3.0.1 which removed Py_InitModule3, added richcompare functions to the operator api.
Diffstat (limited to 'source/blender/python/intern/bpy_operator.c')
-rw-r--r--source/blender/python/intern/bpy_operator.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index 72f4d7fb11e..3947dc8ab1e 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -115,6 +115,18 @@ static int pyop_func_compare( BPy_OperatorFunc * a, BPy_OperatorFunc * b )
return (strcmp(a->name, b->name)==0) ? 0 : -1;
}
+/* For some reason python3 needs these :/ */
+static PyObject *pyop_func_richcmp(BPy_StructRNA * a, BPy_StructRNA * b, int op)
+{
+ int cmp_result= -1; /* assume false */
+ if (BPy_OperatorFunc_Check(a) && BPy_OperatorFunc_Check(b)) {
+ cmp_result= pyop_func_compare(a, b);
+ }
+
+ return Py_CmpToRich(op, cmp_result);
+}
+
+
/*----------------------repr--------------------------------------------*/
static PyObject *pyop_base_repr( BPy_OperatorBase * self )
{
@@ -379,7 +391,7 @@ PyTypeObject pyop_func_Type = {
NULL, /* printfunc tp_print; */
NULL, /* getattrfunc tp_getattr; */
NULL, /* setattrfunc tp_setattr; */
- ( cmpfunc ) pyop_func_compare, /* tp_compare */
+ NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
( reprfunc ) pyop_func_repr, /* tp_repr */
/* Method suites for standard classes */
@@ -412,7 +424,7 @@ PyTypeObject pyop_func_Type = {
/*** Assigned meaning in release 2.1 ***/
/*** rich comparisons ***/
- NULL, /* richcmpfunc tp_richcompare; */
+ (richcmpfunc)pyop_func_richcmp, /* richcmpfunc tp_richcompare; */
/*** weak reference enabler ***/
0, /* long tp_weaklistoffset; */