Mantid
Loading...
Searching...
No Matches
VersionCompat.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
10
11// Macros for 2/3 compatability
12#if PY_VERSION_HEX >= 0x03000000
13#define IS_PY3K
14#define INT_CHECK PyLong_Check
15#define TO_LONG PyLong_AsLong
16#define FROM_LONG PyLong_FromLong
17#define STR_CHECK PyUnicode_Check
18#define TO_CSTRING _PyUnicode_AsString
19#define FROM_CSTRING PyUnicode_FromString
20#define CODE_OBJECT(x) x
21#else
22#define IS_PY2K
23#define INT_CHECK PyInt_Check
24#define TO_LONG PyInt_AsLong
25#define STR_CHECK PyString_Check
26#define TO_CSTRING PyString_AsString
27#define FROM_CSTRING PyString_FromString
28#define CODE_OBJECT(x) (PyCodeObject *)x
29#define FROM_LONG PyInt_FromLong
30#endif