mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-06 20:10:08 +01:00
Tighten up allowed types in auto sequence conversions
Instead of allowing generic sequences to be convertible to wxPoint, wxSize, and others, explicitly allow only tuples and lists. This is needed because these types also have methods that make them look like sequences, which meant that you could pass a wxSize where a wxPoint is expected, and so on.
Even worse is nonsense stuff like:
wx.Point(10,20) == wx.Size(10,20)
evaluating to True.
This commit is contained in:
@@ -626,7 +626,7 @@ def convertTwoIntegersTemplate(CLASS):
|
||||
if (sipCanConvertToType(sipPy, sipType_{CLASS}, SIP_NO_CONVERTORS))
|
||||
return 1;
|
||||
|
||||
if (PySequence_Check(sipPy) && PySequence_Size(sipPy) == 2) {{
|
||||
if ((PyTuple_Check(sipPy) || PyList_Check(sipPy)) && PySequence_Size(sipPy) == 2) {{
|
||||
int rval = 1;
|
||||
PyObject* o1 = PySequence_ITEM(sipPy, 0);
|
||||
PyObject* o2 = PySequence_ITEM(sipPy, 1);
|
||||
@@ -666,7 +666,7 @@ def convertFourIntegersTemplate(CLASS):
|
||||
if (sipCanConvertToType(sipPy, sipType_{CLASS}, SIP_NO_CONVERTORS))
|
||||
return 1;
|
||||
|
||||
if (PySequence_Check(sipPy) && PySequence_Size(sipPy) == 4) {{
|
||||
if ((PyTuple_Check(sipPy) || PyList_Check(sipPy)) && PySequence_Size(sipPy) == 4) {{
|
||||
int rval = 1;
|
||||
PyObject* o1 = PySequence_ITEM(sipPy, 0);
|
||||
PyObject* o2 = PySequence_ITEM(sipPy, 1);
|
||||
@@ -713,7 +713,7 @@ def convertTwoDoublesTemplate(CLASS):
|
||||
if (sipCanConvertToType(sipPy, sipType_{CLASS}, SIP_NO_CONVERTORS))
|
||||
return 1;
|
||||
|
||||
if (PySequence_Check(sipPy) && PySequence_Size(sipPy) == 2) {{
|
||||
if ((PyTuple_Check(sipPy) || PyList_Check(sipPy)) && PySequence_Size(sipPy) == 2) {{
|
||||
int rval = 1;
|
||||
PyObject* o1 = PySequence_ITEM(sipPy, 0);
|
||||
PyObject* o2 = PySequence_ITEM(sipPy, 1);
|
||||
@@ -753,7 +753,7 @@ def convertFourDoublesTemplate(CLASS):
|
||||
if (sipCanConvertToType(sipPy, sipType_{CLASS}, SIP_NO_CONVERTORS))
|
||||
return 1;
|
||||
|
||||
if (PySequence_Check(sipPy) && PySequence_Size(sipPy) == 4) {{
|
||||
if ((PyTuple_Check(sipPy) || PyList_Check(sipPy)) && PySequence_Size(sipPy) == 4) {{
|
||||
int rval = 1;
|
||||
PyObject* o1 = PySequence_ITEM(sipPy, 0);
|
||||
PyObject* o2 = PySequence_ITEM(sipPy, 1);
|
||||
|
||||
Reference in New Issue
Block a user