-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsystem-py.h
79 lines (64 loc) · 2.23 KB
/
system-py.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/** \ingroup py_c
* \file python/system.h
*/
#ifndef H_SYSTEM_PYTHON
#define H_SYSTEM_PYTHON
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#if defined(__APPLE__)
#include <sys/types.h>
#endif
#define uuid_t __darwin_uuid_t /* XXX Mac OS X dares to be different. */
#include <Python.h>
#undef __darwin_uuid_t /* XXX Mac OS X dares to be different. */
#include <structmember.h>
#if ((PY_MAJOR_VERSION << 8) | (PY_MINOR_VERSION << 0)) < 0x0204
#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
#define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
#endif
#ifdef __LCLINT__
#undef PyObject_HEAD
#define PyObject_HEAD int _PyObjectHead;
#endif
#if ((PY_MAJOR_VERSION << 8) | (PY_MINOR_VERSION << 0)) < 0x0205
typedef int Py_ssize_t;
typedef Py_ssize_t (*lenfunc)(PyObject *);
#endif
/* Compatibility macros for Python < 2.6 */
#ifndef PyVarObject_HEAD_INIT
#define PyVarObject_HEAD_INIT(type, size) \
PyObject_HEAD_INIT(type) size,
#endif
#ifndef Py_TYPE
#define Py_TYPE(o) ((o)->ob_type)
#endif
#if ((PY_MAJOR_VERSION << 8) | (PY_MINOR_VERSION << 0)) < 0x0206
#define PyBytes_Check PyString_Check
#define PyBytes_FromString PyString_FromString
#define PyBytes_FromStringAndSize PyString_FromStringAndSize
#define PyBytes_Size PyString_Size
#define PyBytes_AsString PyString_AsString
#endif
#if ((PY_MAJOR_VERSION << 8) | (PY_MINOR_VERSION << 0)) >= 0x0207
#define CAPSULE_BUILD(ptr,name) PyCapsule_New(ptr, name, NULL)
#define CAPSULE_CHECK(obj) PyCapsule_CheckExact(obj)
#define CAPSULE_EXTRACT(obj,name) PyCapsule_GetPointer(obj, name)
#else
#define CAPSULE_BUILD(ptr,name) PyCObject_FromVoidPtr(ptr, NULL)
#define CAPSULE_CHECK(obj) PyCObject_Check(obj)
#define CAPSULE_EXTRACT(obj,name) PyCObject_AsVoidPtr(obj)
#endif
/* For Python 3, use the PyLong type throughout in place of PyInt */
#if PY_MAJOR_VERSION >= 3
#define PyInt_Check PyLong_Check
#define PyInt_AsLong PyLong_AsLong
#define PyInt_FromLong PyLong_FromLong
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#define PyInt_AsSsize_t PyLong_AsSsize_t
#endif
#define DEPRECATED_METHOD(_msg) \
PyErr_WarnEx(PyExc_PendingDeprecationWarning, (_msg), 2);
#include "../system.h"
#endif /* H_SYSTEM_PYTHON */