/usr/include/wx-3.0/wx/wxPython/i_files/pyfragments.swg is in python-wxgtk3.0-dev 3.0.2.0+dfsg-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | //----------------------------------------------------------------------
// The standard t_output_helper has been changed to return a list rather than
// a tuple, we'll replace it with the old implementation here. In SWIG 1.3.27
// and earlier it is implemented as a $fragment, so it is only inserted into
// the modules that need it. For SWIG 1.3.28+ we just need to add a -D on the
// compile command line to turn on the tuple version of the AppendOuput
// function.
#if SWIG_VERSION < 0x010328
%fragment("t_output_helper","header")
%{
static PyObject* t_output_helper(PyObject* result, PyObject* obj)
{
PyObject* o2;
PyObject* o3;
if (!result) {
result = obj;
} else if (result == Py_None) {
Py_DECREF(result);
result = obj;
} else {
if (!PyTuple_Check(result)) {
o2 = result;
result = PyTuple_New(1);
PyTuple_SET_ITEM(result, 0, o2);
}
o3 = PyTuple_New(1);
PyTuple_SetItem(o3, 0, obj);
o2 = result;
result = PySequence_Concat(o2, o3);
Py_DECREF(o2);
Py_DECREF(o3);
}
return result;
}
%}
#endif
//----------------------------------------------------------------------
// These fragments are inserted in modules that need to convert PyObjects to
// integer values, my versions allow any numeric type to be used, as long as
// it can be converted to a PyInt. (Specifically, I allow floats where the
// default SWIG_AsVal_long would just raise an exception.
//
#if SWIG_VERSION < 0x010328
%fragment(SWIG_AsVal_frag(long), "header") {
SWIGINTERN int
SWIG_AsVal(long)(PyObject* obj, long* val)
{
if (PyNumber_Check(obj)) {
if (val) *val = PyInt_AsLong(obj);
return 1;
}
else {
SWIG_Python_TypeError("number", obj);
}
return 0;
}
}
%fragment(SWIG_AsVal_frag(unsigned long), "header",
fragment=SWIG_AsVal_frag(long)) {
SWIGINTERN int
SWIG_AsVal(unsigned long)(PyObject* obj, unsigned long* val)
{
long v = 0;
if (SWIG_AsVal_long(obj, &v) && v < 0) {
SWIG_Python_TypeError("unsigned number", obj);
}
else if (val)
*val = (unsigned long)v;
return 1;
}
}
%fragment(SWIG_AsVal_frag(double), "header") {
SWIGINTERN int
SWIG_AsVal(double)(PyObject *obj, double* val)
{
if (PyNumber_Check(obj)) {
if (val) *val = PyFloat_AsDouble(obj);
return 1;
}
else {
SWIG_Python_TypeError("number", obj);
}
return 0;
}
}
#else // SWIG_VERSION >= 1.3.28
%fragment(SWIG_AsVal_frag(long), "header") {
SWIGINTERN int
SWIG_AsVal(long)(PyObject* obj, long* val)
{
if (PyNumber_Check(obj)) {
if (val) *val = PyInt_AsLong(obj);
return SWIG_OK;
}
return SWIG_TypeError;
}
}
%fragment(SWIG_AsVal_frag(unsigned long), "header",
fragment=SWIG_AsVal_frag(long)) {
SWIGINTERN int
SWIG_AsVal(unsigned long)(PyObject* obj, unsigned long* val)
{
long v = 0;
int res = SWIG_AsVal_long(obj, &v);
if (SWIG_IsOK(res)) {
if ( v < 0) {
return SWIG_ValueError;
}
else if (val)
*val = (unsigned long)v;
}
return res;
}
}
%fragment(SWIG_AsVal_frag(double), "header") {
SWIGINTERN int
SWIG_AsVal(double)(PyObject *obj, double* val)
{
if (PyNumber_Check(obj)) {
if (val) *val = PyFloat_AsDouble(obj);
return SWIG_OK;
}
return SWIG_TypeError;
}
}
#endif // SWIG_VERSION
|