1 //-----------------------------------------------------------------------------
3 // Copyright (c) 1998 - 2007, The Regents of the University of California
4 // Produced at the Lawrence Livermore National Laboratory
5 // All rights reserved.
7 // This file is part of PyCXX. For details,see http://cxx.sourceforge.net/. The
8 // full copyright notice is contained in the file COPYRIGHT located at the root
9 // of the PyCXX distribution.
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are met:
14 // - Redistributions of source code must retain the above copyright notice,
15 // this list of conditions and the disclaimer below.
16 // - Redistributions in binary form must reproduce the above copyright notice,
17 // this list of conditions and the disclaimer (as noted below) in the
18 // documentation and/or materials provided with the distribution.
19 // - Neither the name of the UC/LLNL nor the names of its contributors may be
20 // used to endorse or promote products derived from this software without
21 // specific prior written permission.
23 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 // ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF
27 // CALIFORNIA, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR
28 // ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
36 //-----------------------------------------------------------------------------
38 #include "CXX/IndirectPythonInterface.hxx"
42 bool _CFunction_Check( PyObject
*op
) { return op
->ob_type
== _CFunction_Type(); }
43 bool _CObject_Check( PyObject
*op
) { return op
->ob_type
== _CObject_Type(); }
44 bool _Complex_Check( PyObject
*op
) { return op
->ob_type
== _Complex_Type(); }
45 bool _Dict_Check( PyObject
*op
) { return op
->ob_type
== _Dict_Type(); }
46 bool _Float_Check( PyObject
*op
) { return op
->ob_type
== _Float_Type(); }
47 bool _Function_Check( PyObject
*op
) { return op
->ob_type
== _Function_Type(); }
48 bool _Boolean_Check( PyObject
*op
) { return op
->ob_type
== _Bool_Type(); }
49 bool _List_Check( PyObject
*op
) { return op
->ob_type
== _List_Type(); }
50 bool _Long_Check( PyObject
*op
) { return op
->ob_type
== _Long_Type(); }
51 bool _Method_Check( PyObject
*op
) { return op
->ob_type
== _Method_Type(); }
52 bool _Module_Check( PyObject
*op
) { return op
->ob_type
== _Module_Type(); }
53 bool _Range_Check( PyObject
*op
) { return op
->ob_type
== _Range_Type(); }
54 bool _Slice_Check( PyObject
*op
) { return op
->ob_type
== _Slice_Type(); }
55 bool _TraceBack_Check( PyObject
*op
) { return op
->ob_type
== _TraceBack_Type(); }
56 bool _Tuple_Check( PyObject
*op
) { return op
->ob_type
== _Tuple_Type(); }
57 bool _Type_Check( PyObject
*op
) { return op
->ob_type
== _Type_Type(); }
58 bool _Unicode_Check( PyObject
*op
) { return op
->ob_type
== _Unicode_Type(); }
59 bool _Bytes_Check( PyObject
*op
) { return op
->ob_type
== _Bytes_Type(); }
61 #if defined(PY_WIN32_DELAYLOAD_PYTHON_DLL)
63 #if defined(MS_WINDOWS)
67 static HMODULE python_dll
;
69 static PyObject
*ptr__Exc_ArithmeticError
= NULL
;
70 static PyObject
*ptr__Exc_AssertionError
= NULL
;
71 static PyObject
*ptr__Exc_AttributeError
= NULL
;
72 static PyObject
*ptr__Exc_EnvironmentError
= NULL
;
73 static PyObject
*ptr__Exc_EOFError
= NULL
;
74 static PyObject
*ptr__Exc_Exception
= NULL
;
75 static PyObject
*ptr__Exc_FloatingPointError
= NULL
;
76 static PyObject
*ptr__Exc_ImportError
= NULL
;
77 static PyObject
*ptr__Exc_IndexError
= NULL
;
78 static PyObject
*ptr__Exc_IOError
= NULL
;
79 static PyObject
*ptr__Exc_KeyboardInterrupt
= NULL
;
80 static PyObject
*ptr__Exc_KeyError
= NULL
;
81 static PyObject
*ptr__Exc_LookupError
= NULL
;
82 static PyObject
*ptr__Exc_MemoryError
= NULL
;
83 static PyObject
*ptr__Exc_NameError
= NULL
;
84 static PyObject
*ptr__Exc_NotImplementedError
= NULL
;
85 static PyObject
*ptr__Exc_OSError
= NULL
;
86 static PyObject
*ptr__Exc_OverflowError
= NULL
;
87 static PyObject
*ptr__Exc_RuntimeError
= NULL
;
88 static PyObject
*ptr__Exc_StandardError
= NULL
;
89 static PyObject
*ptr__Exc_SyntaxError
= NULL
;
90 static PyObject
*ptr__Exc_SystemError
= NULL
;
91 static PyObject
*ptr__Exc_SystemExit
= NULL
;
92 static PyObject
*ptr__Exc_TypeError
= NULL
;
93 static PyObject
*ptr__Exc_ValueError
= NULL
;
94 static PyObject
*ptr__Exc_ZeroDivisionError
= NULL
;
97 static PyObject
*ptr__Exc_WindowsError
= NULL
;
100 static PyObject
*ptr__Exc_IndentationError
= NULL
;
101 static PyObject
*ptr__Exc_TabError
= NULL
;
102 static PyObject
*ptr__Exc_UnboundLocalError
= NULL
;
103 static PyObject
*ptr__Exc_UnicodeError
= NULL
;
104 static PyObject
*ptr__PyNone
= NULL
;
105 static PyObject
*ptr__PyFalse
= NULL
;
106 static PyObject
*ptr__PyTrue
= NULL
;
107 static PyTypeObject
*ptr__CFunction_Type
= NULL
;
108 static PyTypeObject
*ptr__CObject_Type
= NULL
;
109 static PyTypeObject
*ptr__Complex_Type
= NULL
;
110 static PyTypeObject
*ptr__Dict_Type
= NULL
;
111 static PyTypeObject
*ptr__Float_Type
= NULL
;
112 static PyTypeObject
*ptr__Function_Type
= NULL
;
113 static PyTypeObject
*ptr__List_Type
= NULL
;
114 static PyTypeObject
*ptr__Long_Type
= NULL
;
115 static PyTypeObject
*ptr__Method_Type
= NULL
;
116 static PyTypeObject
*ptr__Module_Type
= NULL
;
117 static PyTypeObject
*ptr__Range_Type
= NULL
;
118 static PyTypeObject
*ptr__Slice_Type
= NULL
;
119 static PyTypeObject
*ptr__TraceBack_Type
= NULL
;
120 static PyTypeObject
*ptr__Tuple_Type
= NULL
;
121 static PyTypeObject
*ptr__Type_Type
= NULL
;
123 static int *ptr_Py_DebugFlag
= NULL
;
124 static int *ptr_Py_InteractiveFlag
= NULL
;
125 static int *ptr_Py_OptimizeFlag
= NULL
;
126 static int *ptr_Py_NoSiteFlag
= NULL
;
127 static int *ptr_Py_VerboseFlag
= NULL
;
129 static char **ptr__Py_PackageContext
= NULL
;
132 int *ptr_Py_RefTotal
;
136 //--------------------------------------------------------------------------------
137 class GetAddressException
140 GetAddressException( const char *_name
)
143 virtual ~GetAddressException() {}
148 //--------------------------------------------------------------------------------
149 static PyObject
*GetPyObjectPointer_As_PyObjectPointer( const char *name
)
151 FARPROC addr
= GetProcAddress( python_dll
, name
);
153 throw GetAddressException( name
);
155 return *(PyObject
**)addr
;
158 static PyObject
*GetPyObject_As_PyObjectPointer( const char *name
)
160 FARPROC addr
= GetProcAddress( python_dll
, name
);
162 throw GetAddressException( name
);
164 return (PyObject
*)addr
;
167 static PyTypeObject
*GetPyTypeObjectPointer_As_PyTypeObjectPointer( const char *name
)
169 FARPROC addr
= GetProcAddress( python_dll
, name
);
171 throw GetAddressException( name
);
173 return *(PyTypeObject
**)addr
;
176 static PyTypeObject
*GetPyTypeObject_As_PyTypeObjectPointer( const char *name
)
178 FARPROC addr
= GetProcAddress( python_dll
, name
);
180 throw GetAddressException( name
);
182 return (PyTypeObject
*)addr
;
185 static int *GetInt_as_IntPointer( const char *name
)
187 FARPROC addr
= GetProcAddress( python_dll
, name
);
189 throw GetAddressException( name
);
194 static char **GetCharPointer_as_CharPointerPointer( const char *name
)
196 FARPROC addr
= GetProcAddress( python_dll
, name
);
198 throw GetAddressException( name
);
200 return (char **)addr
;
205 static const char python_dll_name_format
[] = "PYTHON%1.1d%1.1d_D.DLL";
207 static const char python_dll_name_format
[] = "PYTHON%1.1d%1.1d.DLL";
210 //--------------------------------------------------------------------------------
211 bool InitialisePythonIndirectInterface()
213 char python_dll_name
[sizeof(python_dll_name_format
)];
215 sprintf( python_dll_name
, python_dll_name_format
, PY_MAJOR_VERSION
, PY_MINOR_VERSION
);
217 python_dll
= LoadLibrary( python_dll_name
);
218 if( python_dll
== NULL
)
224 ptr_Py_RefTotal
= GetInt_as_IntPointer( "_Py_RefTotal" );
226 ptr_Py_DebugFlag
= GetInt_as_IntPointer( "Py_DebugFlag" );
227 ptr_Py_InteractiveFlag
= GetInt_as_IntPointer( "Py_InteractiveFlag" );
228 ptr_Py_OptimizeFlag
= GetInt_as_IntPointer( "Py_OptimizeFlag" );
229 ptr_Py_NoSiteFlag
= GetInt_as_IntPointer( "Py_NoSiteFlag" );
230 ptr_Py_VerboseFlag
= GetInt_as_IntPointer( "Py_VerboseFlag" );
231 ptr__Py_PackageContext
= GetCharPointer_as_CharPointerPointer( "_Py_PackageContext" );
233 ptr__Exc_ArithmeticError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_ArithmeticError" );
234 ptr__Exc_AssertionError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_AssertionError" );
235 ptr__Exc_AttributeError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_AttributeError" );
236 ptr__Exc_EnvironmentError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_EnvironmentError" );
237 ptr__Exc_EOFError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_EOFError" );
238 ptr__Exc_Exception
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_Exception" );
239 ptr__Exc_FloatingPointError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_FloatingPointError" );
240 ptr__Exc_ImportError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_ImportError" );
241 ptr__Exc_IndexError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_IndexError" );
242 ptr__Exc_IOError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_IOError" );
243 ptr__Exc_KeyboardInterrupt
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_KeyboardInterrupt" );
244 ptr__Exc_KeyError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_KeyError" );
245 ptr__Exc_LookupError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_LookupError" );
246 ptr__Exc_MemoryError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_MemoryError" );
247 ptr__Exc_NameError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_NameError" );
248 ptr__Exc_NotImplementedError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_NotImplementedError" );
249 ptr__Exc_OSError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_OSError" );
250 ptr__Exc_OverflowError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_OverflowError" );
251 ptr__Exc_RuntimeError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_RuntimeError" );
252 ptr__Exc_StandardError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_StandardError" );
253 ptr__Exc_SyntaxError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_SyntaxError" );
254 ptr__Exc_SystemError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_SystemError" );
255 ptr__Exc_SystemExit
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_SystemExit" );
256 ptr__Exc_TypeError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_TypeError" );
257 ptr__Exc_ValueError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_ValueError" );
259 ptr__Exc_WindowsError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_WindowsError" );
261 ptr__Exc_ZeroDivisionError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_ZeroDivisionError" );
262 ptr__Exc_IndentationError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_IndentationError" );
263 ptr__Exc_TabError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_TabError" );
264 ptr__Exc_UnboundLocalError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_UnboundLocalError" );
265 ptr__Exc_UnicodeError
= GetPyObjectPointer_As_PyObjectPointer( "PyExc_UnicodeError" );
266 ptr__PyNone
= GetPyObject_As_PyObjectPointer( "_Py_NoneStruct" );
268 ptr__PyFalse
= GetPyObject_As_PyObjectPointer( "_Py_ZeroStruct" );
269 ptr__PyTrue
= GetPyObject_As_PyObjectPointer( "_Py_TrueStruct" );
271 ptr__CFunction_Type
= GetPyTypeObject_As_PyTypeObjectPointer( "PyCFunction_Type" );
272 ptr__CObject_Type
= GetPyTypeObject_As_PyTypeObjectPointer( "PyCObject_Type" );
273 ptr__Complex_Type
= GetPyTypeObject_As_PyTypeObjectPointer( "PyComplex_Type" );
274 ptr__Dict_Type
= GetPyTypeObject_As_PyTypeObjectPointer( "PyDict_Type" );
275 ptr__Float_Type
= GetPyTypeObject_As_PyTypeObjectPointer( "PyFloat_Type" );
276 ptr__Function_Type
= GetPyTypeObject_As_PyTypeObjectPointer( "PyFunction_Type" );
277 ptr__List_Type
= GetPyTypeObject_As_PyTypeObjectPointer( "PyList_Type" );
278 ptr__Long_Type
= GetPyTypeObject_As_PyTypeObjectPointer( "PyLong_Type" );
279 ptr__Method_Type
= GetPyTypeObject_As_PyTypeObjectPointer( "PyMethod_Type" );
280 ptr__Module_Type
= GetPyTypeObject_As_PyTypeObjectPointer( "PyModule_Type" );
281 ptr__Range_Type
= GetPyTypeObject_As_PyTypeObjectPointer( "PyRange_Type" );
282 ptr__Slice_Type
= GetPyTypeObject_As_PyTypeObjectPointer( "PySlice_Type" );
283 ptr__TraceBack_Type
= GetPyTypeObject_As_PyTypeObjectPointer( "PyTraceBack_Type" );
284 ptr__Tuple_Type
= GetPyTypeObject_As_PyTypeObjectPointer( "PyTuple_Type" );
285 ptr__Type_Type
= GetPyTypeObject_As_PyTypeObjectPointer( "PyType_Type" );
286 ptr__Unicode_Type
= GetPyTypeObject_As_PyTypeObjectPointer( "PyUnicode_Type" );
287 ptr__Bytes_Type
= GetPyTypeObject_As_PyTypeObjectPointer( "PyBytes_Type" );
289 catch( GetAddressException
&e
)
291 OutputDebugString( python_dll_name
);
292 OutputDebugString( " does not contain symbol ");
293 OutputDebugString( e
.name
);
294 OutputDebugString( "\n" );
303 // Wrap variables as function calls
305 PyObject
*_Exc_ArithmeticError() { return ptr__Exc_ArithmeticError
; }
306 PyObject
*_Exc_AssertionError() { return ptr__Exc_AssertionError
; }
307 PyObject
*_Exc_AttributeError() { return ptr__Exc_AttributeError
; }
308 PyObject
*_Exc_EnvironmentError() { return ptr__Exc_EnvironmentError
; }
309 PyObject
*_Exc_EOFError() { return ptr__Exc_EOFError
; }
310 PyObject
*_Exc_Exception() { return ptr__Exc_Exception
; }
311 PyObject
*_Exc_FloatingPointError() { return ptr__Exc_FloatingPointError
; }
312 PyObject
*_Exc_ImportError() { return ptr__Exc_ImportError
; }
313 PyObject
*_Exc_IndexError() { return ptr__Exc_IndexError
; }
314 PyObject
*_Exc_IOError() { return ptr__Exc_IOError
; }
315 PyObject
*_Exc_KeyboardInterrupt() { return ptr__Exc_KeyboardInterrupt
; }
316 PyObject
*_Exc_KeyError() { return ptr__Exc_KeyError
; }
317 PyObject
*_Exc_LookupError() { return ptr__Exc_LookupError
; }
318 PyObject
*_Exc_MemoryError() { return ptr__Exc_MemoryError
; }
319 PyObject
*_Exc_NameError() { return ptr__Exc_NameError
; }
320 PyObject
*_Exc_NotImplementedError() { return ptr__Exc_NotImplementedError
; }
321 PyObject
*_Exc_OSError() { return ptr__Exc_OSError
; }
322 PyObject
*_Exc_OverflowError() { return ptr__Exc_OverflowError
; }
323 PyObject
*_Exc_RuntimeError() { return ptr__Exc_RuntimeError
; }
324 PyObject
*_Exc_StandardError() { return ptr__Exc_StandardError
; }
325 PyObject
*_Exc_SyntaxError() { return ptr__Exc_SyntaxError
; }
326 PyObject
*_Exc_SystemError() { return ptr__Exc_SystemError
; }
327 PyObject
*_Exc_SystemExit() { return ptr__Exc_SystemExit
; }
328 PyObject
*_Exc_TypeError() { return ptr__Exc_TypeError
; }
329 PyObject
*_Exc_ValueError() { return ptr__Exc_ValueError
; }
331 PyObject
*_Exc_WindowsError() { return ptr__Exc_WindowsError
; }
333 PyObject
*_Exc_ZeroDivisionError() { return ptr__Exc_ZeroDivisionError
; }
334 PyObject
*_Exc_IndentationError() { return ptr__Exc_IndentationError
; }
335 PyObject
*_Exc_TabError() { return ptr__Exc_TabError
; }
336 PyObject
*_Exc_UnboundLocalError() { return ptr__Exc_UnboundLocalError
; }
337 PyObject
*_Exc_UnicodeError() { return ptr__Exc_UnicodeError
; }
340 // wrap items in Object.h
342 PyObject
*_None() { return ptr__PyNone
; }
344 PyObject
*_False() { return ptr__PyFalse
; }
345 PyObject
*_True() { return ptr__PyTrue
; }
347 PyTypeObject
*_CFunction_Type() { return ptr__CFunction_Type
; }
348 PyTypeObject
*_CObject_Type() { return ptr__CObject_Type
; }
349 PyTypeObject
*_Complex_Type() { return ptr__Complex_Type
; }
350 PyTypeObject
*_Dict_Type() { return ptr__Dict_Type
; }
351 PyTypeObject
*_Float_Type() { return ptr__Float_Type
; }
352 PyTypeObject
*_Function_Type() { return ptr__Function_Type
; }
353 PyTypeObject
*_Bool_Type() { return ptr__Bool_Type
; }
354 PyTypeObject
*_List_Type() { return ptr__List_Type
; }
355 PyTypeObject
*_Long_Type() { return ptr__Long_Type
; }
356 PyTypeObject
*_Method_Type() { return ptr__Method_Type
; }
357 PyTypeObject
*_Module_Type() { return ptr__Module_Type
; }
358 PyTypeObject
*_Range_Type() { return ptr__Range_Type
; }
359 PyTypeObject
*_Slice_Type() { return ptr__Slice_Type
; }
360 PyTypeObject
*_TraceBack_Type() { return ptr__TraceBack_Type
; }
361 PyTypeObject
*_Tuple_Type() { return ptr__Tuple_Type
; }
362 PyTypeObject
*_Type_Type() { return ptr__Type_Type
; }
363 PyTypeObject
*_Unicode_Type() { return ptr__Unicode_Type
; }
364 PyTypeObject
*_Bytes_Type() { return ptr__Bytes_Type
; }
366 char *__Py_PackageContext() { return *ptr__Py_PackageContext
; }
370 // wrap the Python Flag variables
372 int &_Py_DebugFlag() { return *ptr_Py_DebugFlag
; }
373 int &_Py_InteractiveFlag() { return *ptr_Py_InteractiveFlag
; }
374 int &_Py_OptimizeFlag() { return *ptr_Py_OptimizeFlag
; }
375 int &_Py_NoSiteFlag() { return *ptr_Py_NoSiteFlag
; }
376 int &_Py_VerboseFlag() { return *ptr_Py_VerboseFlag
; }
379 #define Py_INCREF(op) ( \
380 _Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \
381 ((PyObject*)(op))->ob_refcnt++)
383 #define Py_DECREF(op) \
384 if (_Py_DEC_REFTOTAL _Py_REF_DEBUG_COMMA \
385 --((PyObject*)(op))->ob_refcnt != 0) \
386 _Py_CHECK_REFCNT(op) \
388 _Py_Dealloc((PyObject *)(op))
391 void _XINCREF( PyObject
*op
)
393 // This function must match the contents of Py_XINCREF(op)
398 (*ptr_Py_RefTotal
)++;
404 void _XDECREF( PyObject
*op
)
406 // This function must match the contents of Py_XDECREF(op);
411 (*ptr_Py_RefTotal
)--;
414 if (--(op
)->ob_refcnt
== 0)
415 _Py_Dealloc((PyObject
*)(op
));
420 #error "Can only delay load under Win32"
425 //================================================================================
429 //================================================================================
432 // Wrap variables as function calls
435 PyObject
*_Exc_ArithmeticError() { return ::PyExc_ArithmeticError
; }
436 PyObject
*_Exc_AssertionError() { return ::PyExc_AssertionError
; }
437 PyObject
*_Exc_AttributeError() { return ::PyExc_AttributeError
; }
438 PyObject
*_Exc_EnvironmentError() { return ::PyExc_EnvironmentError
; }
439 PyObject
*_Exc_EOFError() { return ::PyExc_EOFError
; }
440 PyObject
*_Exc_Exception() { return ::PyExc_Exception
; }
441 PyObject
*_Exc_FloatingPointError() { return ::PyExc_FloatingPointError
; }
442 PyObject
*_Exc_ImportError() { return ::PyExc_ImportError
; }
443 PyObject
*_Exc_IndexError() { return ::PyExc_IndexError
; }
444 PyObject
*_Exc_IOError() { return ::PyExc_IOError
; }
445 PyObject
*_Exc_KeyboardInterrupt() { return ::PyExc_KeyboardInterrupt
; }
446 PyObject
*_Exc_KeyError() { return ::PyExc_KeyError
; }
447 PyObject
*_Exc_LookupError() { return ::PyExc_LookupError
; }
448 PyObject
*_Exc_MemoryError() { return ::PyExc_MemoryError
; }
449 PyObject
*_Exc_NameError() { return ::PyExc_NameError
; }
450 PyObject
*_Exc_NotImplementedError() { return ::PyExc_NotImplementedError
; }
451 PyObject
*_Exc_OSError() { return ::PyExc_OSError
; }
452 PyObject
*_Exc_OverflowError() { return ::PyExc_OverflowError
; }
453 PyObject
*_Exc_RuntimeError() { return ::PyExc_RuntimeError
; }
454 PyObject
*_Exc_SyntaxError() { return ::PyExc_SyntaxError
; }
455 PyObject
*_Exc_SystemError() { return ::PyExc_SystemError
; }
456 PyObject
*_Exc_SystemExit() { return ::PyExc_SystemExit
; }
457 PyObject
*_Exc_TypeError() { return ::PyExc_TypeError
; }
458 PyObject
*_Exc_ValueError() { return ::PyExc_ValueError
; }
459 PyObject
*_Exc_ZeroDivisionError() { return ::PyExc_ZeroDivisionError
; }
460 PyObject
*_Exc_IndentationError() { return ::PyExc_IndentationError
; }
461 PyObject
*_Exc_TabError() { return ::PyExc_TabError
; }
462 PyObject
*_Exc_UnboundLocalError() { return ::PyExc_UnboundLocalError
; }
463 PyObject
*_Exc_UnicodeError() { return ::PyExc_UnicodeError
; }
466 PyObject
*_Exc_WindowsError() { return ::PyExc_WindowsError
; }
473 // wrap items in Object.h
475 PyObject
*_None() { return &::_Py_NoneStruct
; }
477 PyObject
*_False() { return Py_False
; }
478 PyObject
*_True() { return Py_True
; }
480 PyTypeObject
*_CFunction_Type() { return &PyCFunction_Type
; }
481 PyTypeObject
*_CObject_Type() { return &PyCObject_Type
; }
482 PyTypeObject
*_Complex_Type() { return &PyComplex_Type
; }
483 PyTypeObject
*_Dict_Type() { return &PyDict_Type
; }
484 PyTypeObject
*_Float_Type() { return &PyFloat_Type
; }
485 PyTypeObject
*_Function_Type() { return &PyFunction_Type
; }
486 PyTypeObject
*_Bool_Type() { return &PyBool_Type
; }
487 PyTypeObject
*_List_Type() { return &PyList_Type
; }
488 PyTypeObject
*_Long_Type() { return &PyLong_Type
; }
489 PyTypeObject
*_Method_Type() { return &PyMethod_Type
; }
490 PyTypeObject
*_Module_Type() { return &PyModule_Type
; }
491 PyTypeObject
*_Range_Type() { return &PyRange_Type
; }
492 PyTypeObject
*_Slice_Type() { return &PySlice_Type
; }
493 PyTypeObject
*_TraceBack_Type() { return &PyTraceBack_Type
; }
494 PyTypeObject
*_Tuple_Type() { return &PyTuple_Type
; }
495 PyTypeObject
*_Type_Type() { return &PyType_Type
; }
496 PyTypeObject
*_Unicode_Type() { return &PyUnicode_Type
; }
497 PyTypeObject
*_Bytes_Type() { return &PyBytes_Type
; }
502 int &_Py_DebugFlag() { return Py_DebugFlag
; }
503 int &_Py_InteractiveFlag() { return Py_InteractiveFlag
; }
504 int &_Py_OptimizeFlag() { return Py_OptimizeFlag
; }
505 int &_Py_NoSiteFlag() { return Py_NoSiteFlag
; }
506 int &_Py_VerboseFlag() { return Py_VerboseFlag
; }
507 char *__Py_PackageContext() { return _Py_PackageContext
; }
510 // Needed to keep the abstactions for delayload interface
512 void _XINCREF( PyObject
*op
)
517 void _XDECREF( PyObject
*op
)