FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python/include/boost/python/detail/wrap_python.hpp at develop · shelltdf/python · GitHub
shelltdf
/
python
Public
forked from
boostorg/python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python
/
include
/
boost
/
python
/
detail
/
wrap_python.hpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
251 lines (206 loc) · 6.39 KB
Breadcrumbs
python
/
include
/
boost
/
python
/
detail
/
wrap_python.hpp
Copy path
File metadata and controls
251 lines (206 loc) · 6.39 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
//
(C) Copyright David Abrahams 2000.
//
Distributed under the Boost Software License, Version 1.0. (See
//
accompanying file LICENSE_1_0.txt or copy at
//
http://www.boost.org/LICENSE_1_0.txt)
//
//
The author gratefully acknowleges the support of Dragon Systems, Inc., in
//
producing this work.
//
This file serves as a wrapper around <Python.h> which allows it to be
//
compiled with GCC 2.95.2 under Win32 and which disables the default MSVC
//
behavior so that a program may be compiled in debug mode without requiring a
//
special debugging build of the Python library.
//
To use the Python debugging library, #define BOOST_DEBUG_PYTHON on the
//
compiler command-line.
//
Revision History:
//
05 Mar 01 Suppress warnings under Cygwin with Python 2.0 (Dave Abrahams)
//
04 Mar 01 Rolled in some changes from the Dragon fork (Dave Abrahams)
//
01 Mar 01 define PyObject_INIT() for Python 1.x (Dave Abrahams)
#
ifdef
_DEBUG
#
ifndef
BOOST_DEBUG_PYTHON
#
ifdef
_MSC_VER
//
VC8.0 will complain if system headers are #included both with
//
and without _DEBUG defined, so we have to #include all the
//
system headers used by pyconfig.h right here.
#
include
<
stddef.h
>
#
include
<
stdarg.h
>
#
include
<
stdio.h
>
#
include
<
stdlib.h
>
#
include
<
assert.h
>
#
include
<
errno.h
>
#
include
<
ctype.h
>
#
include
<
wchar.h
>
#
include
<
basetsd.h
>
#
include
<
io.h
>
#
include
<
limits.h
>
#
include
<
float.h
>
#
include
<
string.h
>
#
include
<
math.h
>
#
include
<
time.h
>
#
endif
#
undef
_DEBUG
//
Don't let Python force the debug library just because we're debugging.
#
define
DEBUG_UNDEFINED_FROM_WRAP_PYTHON_H
#
endif
#
endif
//
pyconfig.h defines a macro with hypot name, what breaks libstdc++ math headers
//
that Python.h tries to include afterwards.
#
if
defined(__MINGW32__)
#
include
<
cmath
>
#
include
<
math.h
>
#
endif
#
include
<
pyconfig.h
>
#
if
defined(_SGI_COMPILER_VERSION) && _SGI_COMPILER_VERSION >= 740
#
undef
_POSIX_C_SOURCE
#
undef
_XOPEN_SOURCE
#
undef
HAVE_STDINT_H
//
undo Python 2.5.1 define
#
endif
//
//
Python's LongObject.h helpfully #defines ULONGLONG_MAX for us,
//
which confuses Boost's config
//
#
include
<
limits.h
>
#
ifndef
ULONG_MAX
#
define
BOOST_PYTHON_ULONG_MAX_UNDEFINED
#
endif
#
ifndef
LONGLONG_MAX
#
define
BOOST_PYTHON_LONGLONG_MAX_UNDEFINED
#
endif
#
ifndef
ULONGLONG_MAX
#
define
BOOST_PYTHON_ULONGLONG_MAX_UNDEFINED
#
endif
//
//
Get ahold of Python's version number
//
#
include
<
patchlevel.h
>
#
if
PY_MAJOR_VERSION<2 || PY_MAJOR_VERSION==2 && PY_MINOR_VERSION<2
#
error
Python 2.2 or higher is required for this version of Boost.Python.
#
endif
//
//
Some things we need in order to get Python.h to work with compilers other
//
than MSVC on Win32
//
#
if
defined(_WIN32) || defined(__CYGWIN__)
#
if
defined(__GNUC__) && defined(__CYGWIN__)
#
if
defined(__LP64__)
#
define
SIZEOF_LONG
8
#
else
#
define
SIZEOF_LONG
4
#
endif
#
if
PY_MAJOR_VERSION < 2 || PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION <= 2
typedef
int
pid_t
;
#
if
defined(__LP64__)
#
define
WORD_BIT
64
#
else
#
define
WORD_BIT
32
#
endif
#
define
hypot
_hypot
#
include
<
stdio.h
>
#
if
PY_MAJOR_VERSION < 2
#
define
HAVE_CLOCK
#
define
HAVE_STRFTIME
#
define
HAVE_STRERROR
#
endif
#
define
NT_THREADS
#
ifndef
NETSCAPE_PI
#
define
USE_SOCKET
#
endif
#
ifdef
USE_DL_IMPORT
#
define
DL_IMPORT
(
RTYPE
) __declspec(dllimport)
RTYPE
#
endif
#
ifdef
USE_DL_EXPORT
#
define
DL_IMPORT
(
RTYPE
) __declspec(dllexport)
RTYPE
#
define
DL_EXPORT
(
RTYPE
) __declspec(dllexport)
RTYPE
#
endif
#
define
HAVE_LONG_LONG
1
#
define
LONG_LONG
long
long
#
endif
#
elif
defined(__MWERKS__)
#
ifndef
_MSC_VER
#
define
PY_MSC_VER_DEFINED_FROM_WRAP_PYTHON_H
1
#
define
_MSC_VER
900
#
endif
#
undef
hypot
//
undo the evil #define left by Python.
#
elif
defined(__BORLANDC__) && !defined(__clang__)
#
undef
HAVE_HYPOT
#
define
HAVE_HYPOT
1
#
endif
#
endif
//
_WIN32
#
if
defined(__GNUC__)
#
if
defined(__has_warning)
#
define
BOOST_PYTHON_GCC_HAS_WREGISTER
__has_warning
(
"
-Wregister
"
)
#
else
#
define
BOOST_PYTHON_GCC_HAS_WREGISTER
__GNUC__ >=
7
#
endif
#
else
#
define
BOOST_PYTHON_GCC_HAS_WREGISTER
0
#
endif
//
Python.h header uses `register` keyword until Python 3.4
#
if
BOOST_PYTHON_GCC_HAS_WREGISTER
#
pragma
GCC diagnostic push
#
pragma
GCC diagnostic ignored "-Wregister"
#
elif
defined(_MSC_VER)
#
pragma
warning(push)
#
pragma
warning(disable : 5033)
//
'register' is no longer a supported storage class
#
endif
#
if
PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 2 && PY_MICRO_VERSION < 2
#
include
<
boost/python/detail/python22_fixed.h
>
#
else
#
include
<
Python.h
>
#
endif
#
if
BOOST_PYTHON_GCC_HAS_WREGISTER
#
pragma
GCC diagnostic pop
#
elif
defined(_MSC_VER)
#
pragma
warning(pop)
#
endif
#
undef
BOOST_PYTHON_GCC_HAS_WREGISTER
#
ifdef
BOOST_PYTHON_ULONG_MAX_UNDEFINED
#
undef
ULONG_MAX
#
undef
BOOST_PYTHON_ULONG_MAX_UNDEFINED
#
endif
#
ifdef
BOOST_PYTHON_LONGLONG_MAX_UNDEFINED
#
undef
LONGLONG_MAX
#
undef
BOOST_PYTHON_LONGLONG_MAX_UNDEFINED
#
endif
#
ifdef
BOOST_PYTHON_ULONGLONG_MAX_UNDEFINED
#
undef
ULONGLONG_MAX
#
undef
BOOST_PYTHON_ULONGLONG_MAX_UNDEFINED
#
endif
#
ifdef
PY_MSC_VER_DEFINED_FROM_WRAP_PYTHON_H
#
undef
_MSC_VER
#
endif
#
ifdef
DEBUG_UNDEFINED_FROM_WRAP_PYTHON_H
#
undef
DEBUG_UNDEFINED_FROM_WRAP_PYTHON_H
#
ifdef
_CRT_NOFORCE_MANIFEST_DEFINED_FROM_WRAP_PYTHON_H
#
undef
_CRT_NOFORCE_MANIFEST_DEFINED_FROM_WRAP_PYTHON_H
#
undef
_CRT_NOFORCE_MANIFEST
#
endif
#
endif
#
if
!defined(PY_MAJOR_VERSION) || PY_MAJOR_VERSION < 2
#
define
PyObject_INIT
(
op, typeobj
) \
( (op)->ob_type = (typeobj), _Py_NewReference((PyObject *)(op)), (op) )
#
endif
//
Define Python 3 macros for Python 2.x
#
if
PY_VERSION_HEX < 0x02060000
#
define
Py_TYPE
(
o
) (((PyObject*)(o))->ob_type)
#
define
Py_REFCNT
(
o
) (((PyObject*)(o))->ob_refcnt)
#
define
Py_SIZE
(
o
) (((PyVarObject*)(o))->ob_size)
#
define
PyVarObject_HEAD_INIT
(
type, size
) \
PyObject_HEAD_INIT
(type) size,
#
endif
#
if
PY_VERSION_HEX < 0x030900A4
#
define
Py_SET_TYPE
(
obj, type
) ((Py_TYPE(obj) = (type)), (
void
)
0
)
#
define
Py_SET_SIZE
(
obj, size
) ((Py_SIZE(obj) = (size)), (
void
)
0
)
#
endif
#
ifdef
__MWERKS__
#
pragma
warn_possunwant off
#
elif
_MSC_VER
#
pragma
warning(disable:4786)
#
endif
#
if
defined(HAVE_LONG_LONG)
#
if
defined(PY_LONG_LONG)
#
define
BOOST_PYTHON_LONG_LONG
PY_LONG_LONG
#
elif
defined(LONG_LONG)
#
define
BOOST_PYTHON_LONG_LONG
LONG_LONG
#
else
#
error
"HAVE_LONG_LONG defined but not PY_LONG_LONG or LONG_LONG"
#
endif
#
endif
Back
|
FazBrowse Home
|
New Git URL