Michele De Stefano's C++ Utilities
common.hpp
Go to the documentation of this file.
1 // common.hpp
2 //
3 // Copyright (c) 2012 - Michele De Stefano (micdestefano@users.sourceforge.net)
4 //
5 // Distributed under the MIT License (See accompanying file LICENSE)
6 
7 #ifndef MDS_UTILS_PYTHON_COMMON_HPP_INCLUDED
8 #define MDS_UTILS_PYTHON_COMMON_HPP_INCLUDED
9 
10 #include <Python.h>
11 
29 // Workaround for code that uses the Python >= 2.5 Py_ssize_t, built against Python < 2.5
30 #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MAX)
31 typedef int Py_ssize_t;
32 #define PY_SSIZE_T_MAX INT_MAX
33 #define PY_SSIZE_T_MIN INT_MIN
34 #define PY_FORMAT_SIZE_T ""
35 #endif
36 
37 #endif