]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Reversed the order of the checks for None or a Dialog where a Window is expected...
authorJack Jansen <jack.jansen@cwi.nl>
Wed, 20 Jun 2001 21:20:22 +0000 (21:20 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Wed, 20 Jun 2001 21:20:22 +0000 (21:20 +0000)
Mac/Modules/win/Winmodule.c
Mac/Modules/win/winsupport.py

index 639844a8bed932692916a85a42e936d99a577fbf..d8072513c208c87683f55eb61691cc6d1f847b14 100644 (file)
@@ -76,7 +76,10 @@ PyObject *WinObj_New(WindowPtr itself)
 }
 WinObj_Convert(PyObject *v, WindowPtr *p_itself)
 {
-#if 1
+
+       if (v == Py_None) { *p_itself = NULL; return 1; }
+       if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; }
+
        {
                DialogRef dlg;
                if (DlgObj_Convert(v, &dlg) && dlg) {
@@ -85,16 +88,6 @@ WinObj_Convert(PyObject *v, WindowPtr *p_itself)
                }
                PyErr_Clear();
        }
-#else
-       if (DlgObj_Check(v)) {
-               *p_itself = DlgObj_ConvertToWindow(v);
-               return 1;
-       }
-#endif
-
-       if (v == Py_None) { *p_itself = NULL; return 1; }
-       if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; }
-
        if (!WinObj_Check(v))
        {
                PyErr_SetString(PyExc_TypeError, "Window required");
index 92d1f47d638b01835672f0116367278928df4f64..cc1c312fa7773e57653434f186e78cdfde42706c 100644 (file)
@@ -137,7 +137,10 @@ class MyObjectDefinition(GlobalObjectDefinition):
                Output("it->ob_freeit = PyMac_AutoDisposeWindow;")
                OutRbrace()
        def outputCheckConvertArg(self):
-               Output("#if 1")
+               Out("""
+               if (v == Py_None) { *p_itself = NULL; return 1; }
+               if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; }
+               """)
                OutLbrace()
                Output("DialogRef dlg;")
                OutLbrace("if (DlgObj_Convert(v, &dlg) && dlg)")
@@ -146,16 +149,6 @@ class MyObjectDefinition(GlobalObjectDefinition):
                OutRbrace()
                Output("PyErr_Clear();")
                OutRbrace()
-               Output("#else")
-               OutLbrace("if (DlgObj_Check(v))")
-               Output("*p_itself = DlgObj_ConvertToWindow(v);")
-               Output("return 1;")
-               OutRbrace()
-               Output("#endif")
-               Out("""
-               if (v == Py_None) { *p_itself = NULL; return 1; }
-               if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; }
-               """)
        def outputCleanupStructMembers(self):
                Output("if (self->ob_freeit && self->ob_itself)")
                OutLbrace()