File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,7 +76,10 @@ PyObject *WinObj_New(WindowPtr itself)
7676}
7777WinObj_Convert (PyObject * v , WindowPtr * p_itself )
7878{
79- #if 1
79+
80+ if (v == Py_None ) { * p_itself = NULL ; return 1 ; }
81+ if (PyInt_Check (v )) { * p_itself = (WindowPtr )PyInt_AsLong (v ); return 1 ; }
82+
8083 {
8184 DialogRef dlg ;
8285 if (DlgObj_Convert (v , & dlg ) && dlg ) {
@@ -85,16 +88,6 @@ WinObj_Convert(PyObject *v, WindowPtr *p_itself)
8588 }
8689 PyErr_Clear ();
8790 }
88- #else
89- if (DlgObj_Check (v )) {
90- * p_itself = DlgObj_ConvertToWindow (v );
91- return 1 ;
92- }
93- #endif
94-
95- if (v == Py_None ) { * p_itself = NULL ; return 1 ; }
96- if (PyInt_Check (v )) { * p_itself = (WindowPtr )PyInt_AsLong (v ); return 1 ; }
97-
9891 if (!WinObj_Check (v ))
9992 {
10093 PyErr_SetString (PyExc_TypeError , "Window required" );
Original file line number Diff line number Diff line change @@ -137,7 +137,10 @@ def outputInitStructMembers(self):
137137 Output ("it->ob_freeit = PyMac_AutoDisposeWindow;" )
138138 OutRbrace ()
139139 def outputCheckConvertArg (self ):
140- Output ("#if 1" )
140+ Out ("""
141+ if (v == Py_None) { *p_itself = NULL; return 1; }
142+ if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; }
143+ """ )
141144 OutLbrace ()
142145 Output ("DialogRef dlg;" )
143146 OutLbrace ("if (DlgObj_Convert(v, &dlg) && dlg)" )
@@ -146,16 +149,6 @@ def outputCheckConvertArg(self):
146149 OutRbrace ()
147150 Output ("PyErr_Clear();" )
148151 OutRbrace ()
149- Output ("#else" )
150- OutLbrace ("if (DlgObj_Check(v))" )
151- Output ("*p_itself = DlgObj_ConvertToWindow(v);" )
152- Output ("return 1;" )
153- OutRbrace ()
154- Output ("#endif" )
155- Out ("""
156- if (v == Py_None) { *p_itself = NULL; return 1; }
157- if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; }
158- """ )
159152 def outputCleanupStructMembers (self ):
160153 Output ("if (self->ob_freeit && self->ob_itself)" )
161154 OutLbrace ()
You can’t perform that action at this time.
0 commit comments