4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * Contributor(s): Campbell Barton
22 * ***** END GPL LICENSE BLOCK *****
25 /* This file is only to contain definitions to functions that enable
26 * the python api to compile with different python versions.
27 * no utility functions please
30 #ifndef BPY_COMPAT_H__
31 #define BPY_COMPAT_H__
33 /* if you are NOT using python 3.0 - define these */
34 #if PY_VERSION_HEX < 0x03000000
35 #define _PyUnicode_AsString PyString_AsString
37 #undef PyUnicode_Check
38 #define PyUnicode_Check PyString_Check
40 #define PyLong_FromSize_t PyInt_FromLong
41 #define PyLong_AsSsize_t PyInt_AsLong
44 #define PyLong_Check PyInt_Check
46 #define PyUnicode_FromString PyString_FromString
47 #define PyUnicode_FromFormat PyString_FromFormat
51 /* older then python 2.6 - define these */
52 // #if (PY_VERSION_HEX < 0x02060000)
55 /* older then python 2.5 - define these */
56 #if (PY_VERSION_HEX < 0x02050000)
57 #define Py_ssize_t ssize_t
60 #endif /* BPY_COMPAT_H__ */