* make sure there are no redefinitions (I'm using py2.5 and ie PyUnicode_Check define exists

This commit is contained in:
Nathan Letwory
2008-12-01 22:20:18 +00:00
parent 23a77e7688
commit d1e75c215b
2 changed files with 14 additions and 1 deletions

View File

@@ -27,13 +27,24 @@
* no utility functions please
*/
#ifndef BPY_COMPAT_H__
#define BPY_COMPAT_H__
/* if you are NOT using python 3.0 - define these */
#if PY_VERSION_HEX < 0x03000000
#define _PyUnicode_AsString PyString_AsString
#ifndef PyUnicode_Check
#define PyUnicode_Check PyString_Check
#endif
#define PyLong_FromSize_t PyInt_FromLong
#define PyLong_AsSsize_t PyInt_AsLong
#ifndef PyLong_Check
#define PyLong_Check PyInt_Check
#endif
#define PyUnicode_FromString PyString_FromString
#define PyUnicode_FromFormat PyString_FromFormat
@@ -47,3 +58,5 @@
#if (PY_VERSION_HEX < 0x02050000)
#define Py_ssize_t ssize_t
#endif
#endif /* BPY_COMPAT_H__ */

View File

@@ -788,7 +788,7 @@ PyObject *pyrna_prop_items(BPy_PropertyRNA *self)
{
PyObject *ret;
if (RNA_property_type(&self->ptr, self->prop) != PROP_COLLECTION) {
PyErr_SetString( PyExc_TypeError, "keys() is only valid for collection types" );
PyErr_SetString( PyExc_TypeError, "items() is only valid for collection types" );
ret = NULL;
} else {
PyObject *item;