From 2c9df6000e93158e14cf279e0cf3ee19acad11d0 Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Sun, 27 Jul 2008 09:49:13 +0000 Subject: Add a Py_TYPE macro for accessing ob_type. 2008-07-27 Johan Dahlin * glib/pyglib-python-compat.h: Add a Py_TYPE macro for accessing ob_type. * glib/glibmodule.c (pyglib_register_constants): * gobject/gobjectmodule.c (pygobject__g_instance_init), (pyg_integer_richcompare): * gobject/pygenum.c (pyg_enum_repr), (pyg_enum_from_gtype), (pyg_enum_add), (pyg_enum_get_value_name), (pyg_enum_get_value_nick): * gobject/pygflags.c (pyg_flags_repr), (pyg_flags_from_gtype), (pyg_flags_add), (pyg_flags_and), (pyg_flags_or), (pyg_flags_xor), (pyg_flags_get_first_value_name), (pyg_flags_get_first_value_nick), (pyg_flags_get_value_names), (pyg_flags_get_value_nicks): Use Py_TYPE and PyLong macros to access struct fields svn path=/trunk/; revision=885 --- glib/pyglib-python-compat.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'glib/pyglib-python-compat.h') diff --git a/glib/pyglib-python-compat.h b/glib/pyglib-python-compat.h index c36f7e4..0fb4601 100644 --- a/glib/pyglib-python-compat.h +++ b/glib/pyglib-python-compat.h @@ -28,7 +28,7 @@ typedef int Py_ssize_t; /* Compilation on Python 2.x */ #if PY_VERSION_HEX < 0x03000000 - +#define RO READONLY #define _PyUnicode_Check PyString_Check #define _PyUnicode_AsString PyString_AsString #define _PyUnicode_AsStringAndSize PyString_AsStringAndSize @@ -42,9 +42,10 @@ typedef int Py_ssize_t; #define _PyLong_Check PyInt_Check #define _PyLong_FromLong PyInt_FromLong #define _PyLong_AsLong PyInt_AsLong -#define RO READONLY #define _PyLongObject PyIntObject #define _PyLong_Type PyInt_Type +#define _PyLong_AS_LONG PyInt_AS_LONG +#define Py_TYPE(ob) (ob->ob_type) #else #undef PYGLIB_MODULE_START #undef PYGLIB_MODULE_END @@ -96,6 +97,7 @@ PyTypeObject symbol = { \ #define _PyLong_Check PyLong_Check #define _PyLong_FromLong PyLong_FromLong #define _PyLong_AsLong PyLong_AsLong +#define _PyLong_AS_LONG PyLong_AS_LONG #define _PyLongObject PyLongObject #define _PyLong_Type PyLong_Type #endif -- cgit