+//--------------------------------
+// Part of patch from Tim Hochberg
+static inline bool wxPointFromObjects(PyObject* o1, PyObject* o2, wxPoint* point) {
+ if (PyInt_Check(o1) && PyInt_Check(o2)) {
+ point->x = PyInt_AS_LONG(o1);
+ point->y = PyInt_AS_LONG(o2);
+ return true;
+ }
+ if (PyFloat_Check(o1) && PyFloat_Check(o2)) {
+ point->x = (int)PyFloat_AS_DOUBLE(o1);
+ point->y = (int)PyFloat_AS_DOUBLE(o2);
+ return true;
+ }
+ if (PyInstance_Check(o1) || PyInstance_Check(o2)) {
+ // Disallow instances because they can cause havok
+ return false;
+ }
+ if (PyNumber_Check(o1) && PyNumber_Check(o2)) {
+ // I believe this excludes instances, so this should be safe without INCREFFing o1 and o2
+ point->x = PyInt_AsLong(o1);
+ point->y = PyInt_AsLong(o2);
+ return true;
+ }
+ return false;
+}