/usr/include/wx-3.0/wx/wxPython/twoitem.h is in python-wxgtk3.0-dev 3.0.2.0+dfsg-4.
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 | ////////////////////////////////////////////////////////////////////////////
// Name: twoitem.h
// Purpose: A template function to help with converting a python object
// to some wx class that takes two integer value parameters.
// Factored out of wxPython_int.h
//
// Author: Robin Dunn
//
// Created: 25-April-2006
// RCS-ID: $Id$
// Copyright: (c) 2006 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __twoitem_h__
#define __twoitem_h__
template<class T>
bool wxPyTwoIntItem_helper(PyObject* source, T** obj, const wxChar* name)
{
// If source is an object instance then it may already be the right type
if (wxPySwigInstance_Check(source)) {
T* ptr;
if (! wxPyConvertSwigPtr(source, (void **)&ptr, name))
goto error;
*obj = ptr;
return true;
}
// otherwise a 2-tuple of integers is expected
else if (PySequence_Check(source) && PyObject_Length(source) == 2) {
PyObject* o1 = PySequence_GetItem(source, 0);
PyObject* o2 = PySequence_GetItem(source, 1);
if (!PyNumber_Check(o1) || !PyNumber_Check(o2)) {
Py_DECREF(o1);
Py_DECREF(o2);
goto error;
}
**obj = T(PyInt_AsLong(o1), PyInt_AsLong(o2));
Py_DECREF(o1);
Py_DECREF(o2);
return true;
}
error:
wxString msg;
msg.Printf(wxT("Expected a 2-tuple of integers or a %s object."), name);
PyErr_SetString(PyExc_TypeError, msg.mb_str());
return false;
}
#endif
|