From 81cfe5e13e9b8a2ec8374af1f7806b05a86d4d4b Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 20 Dec 2003 19:54:10 +0000 Subject: [PATCH] Aquire the GIL before raising the NotImplementedError exception git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24944 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/include/wx/wxPython/wxPython_int.h | 3 ++- wxPython/src/_app.i | 2 +- wxPython/src/_dataobj.i | 2 +- wxPython/src/_dc.i | 8 ++++---- wxPython/src/_font.i | 4 ++-- wxPython/src/_functions.i | 7 ++++++- wxPython/src/_joystick.i | 3 ++- wxPython/src/_popupwin.i | 8 ++++---- wxPython/src/_region.i | 2 +- wxPython/src/_taskbar.i | 4 ++-- wxPython/src/_tglbtn.i | 4 ++-- wxPython/src/_wave.i | 6 ++++-- wxPython/src/_window.i | 2 +- 13 files changed, 32 insertions(+), 23 deletions(-) diff --git a/wxPython/include/wx/wxPython/wxPython_int.h b/wxPython/include/wx/wxPython/wxPython_int.h index 2d42ea5e51..fd0cb3478d 100644 --- a/wxPython/include/wx/wxPython/wxPython_int.h +++ b/wxPython/include/wx/wxPython/wxPython_int.h @@ -145,7 +145,8 @@ void wxPyEndBlockThreads(); #endif // wxPyUSE_EXPORTED_API -#define wxPyBLOCK_THREADS(stmt) wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads() +#define wxPyBLOCK_THREADS(stmt) { wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads(); } +#define wxPyRaiseNotImplemented() wxPyBLOCK_THREADS(PyErr_SetNone(PyExc_NotImplementedError)) //--------------------------------------------------------------------------- // These are helpers used by the typemaps diff --git a/wxPython/src/_app.i b/wxPython/src/_app.i index e2efaa1c1a..b938ac52ef 100644 --- a/wxPython/src/_app.i +++ b/wxPython/src/_app.i @@ -257,7 +257,7 @@ public: #else %extend { static int GetComCtl32Version() - { PyErr_SetNone(PyExc_NotImplementedError); return 0; } + { wxPyRaiseNotImplemented(); return 0; } } #endif }; diff --git a/wxPython/src/_dataobj.i b/wxPython/src/_dataobj.i index 56aaaa09b9..191ca7a74b 100644 --- a/wxPython/src/_dataobj.i +++ b/wxPython/src/_dataobj.i @@ -445,7 +445,7 @@ public: class wxMetafileDataObject : public wxDataObjectSimple { public: - wxMetafileDataObject() { PyErr_SetNone(PyExc_NotImplementedError); } + wxMetafileDataObject() { wxPyRaiseNotImplemented(); } }; %} diff --git a/wxPython/src/_dc.i b/wxPython/src/_dc.i index 4b4034bcb3..d394706e8b 100644 --- a/wxPython/src/_dc.i +++ b/wxPython/src/_dc.i @@ -705,13 +705,13 @@ public: class wxMetaFile : public wxObject { public: wxMetaFile(const wxString&) - { PyErr_SetNone(PyExc_NotImplementedError); } + { wxPyRaiseNotImplemented(); } }; class wxMetaFileDC : public wxClientDC { public: wxMetaFileDC(const wxString&, int, int, const wxString&) - { PyErr_SetNone(PyExc_NotImplementedError); } + { wxPyRaiseNotImplemented(); } }; %} @@ -751,10 +751,10 @@ public: class wxPrinterDC : public wxClientDC { public: wxPrinterDC(const wxPrintData&) - { PyErr_SetNone(PyExc_NotImplementedError); } + { wxPyRaiseNotImplemented(); } // wxPrinterDC(const wxString&, const wxString&, const wxString&, bool, int) -// { PyErr_SetNone(PyExc_NotImplementedError); } +// { wxPyRaiseNotImplemented(); } }; %} diff --git a/wxPython/src/_font.i b/wxPython/src/_font.i index 997d2ede8c..13823a26fd 100644 --- a/wxPython/src/_font.i +++ b/wxPython/src/_font.i @@ -268,10 +268,10 @@ bool wxTestFontEncoding(const wxNativeEncodingInfo& info); %inline %{ wxNativeEncodingInfo* wxGetNativeFontEncoding(wxFontEncoding encoding) - { PyErr_SetNone(PyExc_NotImplementedError); return NULL; } + { wxPyRaiseNotImplemented(); return NULL; } bool wxTestFontEncoding(const wxNativeEncodingInfo& info) - { PyErr_SetNone(PyExc_NotImplementedError); return False; } + { wxPyRaiseNotImplemented(); return False; } %} #endif diff --git a/wxPython/src/_functions.i b/wxPython/src/_functions.i index 8abf2a31c8..aa33a105b9 100644 --- a/wxPython/src/_functions.i +++ b/wxPython/src/_functions.i @@ -52,7 +52,7 @@ long wxGetFreeMemory(); #else %inline %{ long wxGetFreeMemory() - { PyErr_SetNone(PyExc_NotImplementedError); return 0; } + { wxPyRaiseNotImplemented(); return 0; } %} #endif @@ -214,6 +214,11 @@ wxWindow* wxGetTopLevelParent(wxWindow *win); // This is generally most useful getting the state of // Caps Lock, Num Lock and Scroll Lock... bool wxGetKeyState(wxKeyCode key); +#else +%inline %{ + bool wxGetKeyState(wxKeyCode key) + { wxPyRaiseNotImplemented(); return False; } +%} #endif diff --git a/wxPython/src/_joystick.i b/wxPython/src/_joystick.i index 092bc34c16..fe2da5c0fd 100644 --- a/wxPython/src/_joystick.i +++ b/wxPython/src/_joystick.i @@ -49,7 +49,8 @@ class wxJoystick : public wxObject { public: wxJoystick(int joystick = wxJOYSTICK1) { wxPyBeginBlockThreads(); - PyErr_SetString(PyExc_NotImplementedError, "wxJoystick is not available on this platform."); + PyErr_SetString(PyExc_NotImplementedError, + "wxJoystick is not available on this platform."); wxPyEndBlockThreads(); } wxPoint GetPosition() { return wxPoint(-1,-1); } diff --git a/wxPython/src/_popupwin.i b/wxPython/src/_popupwin.i index bf38236452..330b1dc3cb 100644 --- a/wxPython/src/_popupwin.i +++ b/wxPython/src/_popupwin.i @@ -103,15 +103,15 @@ public: %{ class wxPopupWindow : public wxWindow { public: - wxPopupWindow(wxWindow *, int) { PyErr_SetNone(PyExc_NotImplementedError); } - wxPopupWindow() { PyErr_SetNone(PyExc_NotImplementedError); } + wxPopupWindow(wxWindow *, int) { wxPyRaiseNotImplemented(); } + wxPopupWindow() { wxPyRaiseNotImplemented(); } }; class wxPyPopupTransientWindow : public wxPopupWindow { public: - wxPyPopupTransientWindow(wxWindow *, int) { PyErr_SetNone(PyExc_NotImplementedError); } - wxPyPopupTransientWindow() { PyErr_SetNone(PyExc_NotImplementedError); } + wxPyPopupTransientWindow(wxWindow *, int) { wxPyRaiseNotImplemented(); } + wxPyPopupTransientWindow() { wxPyRaiseNotImplemented(); } }; %} diff --git a/wxPython/src/_region.i b/wxPython/src/_region.i index 714aba481b..55a9cc4834 100644 --- a/wxPython/src/_region.i +++ b/wxPython/src/_region.i @@ -54,7 +54,7 @@ public: %extend { %name(RegionFromPoints)wxRegion(int points, wxPoint* points_array, int fillStyle = wxWINDING_RULE) { - PyErr_SetNone(PyExc_NotImplementedError); + wxPyRaiseNotImplemented(); return NULL; } } diff --git a/wxPython/src/_taskbar.i b/wxPython/src/_taskbar.i index 24a1d4abd9..3b37db21b2 100644 --- a/wxPython/src/_taskbar.i +++ b/wxPython/src/_taskbar.i @@ -29,7 +29,7 @@ class wxTaskBarIcon : public wxEvtHandler { public: - wxTaskBarIcon() { PyErr_SetNone(PyExc_NotImplementedError); } + wxTaskBarIcon() { wxPyRaiseNotImplemented(); } }; @@ -37,7 +37,7 @@ class wxTaskBarIconEvent : public wxEvent { public: wxTaskBarIconEvent(wxEventType, wxTaskBarIcon *) - { PyErr_SetNone(PyExc_NotImplementedError); } + { wxPyRaiseNotImplemented(); } virtual wxEvent* Clone() const { return NULL; } }; diff --git a/wxPython/src/_tglbtn.i b/wxPython/src/_tglbtn.i index 1d736f9c38..2cf934ce84 100644 --- a/wxPython/src/_tglbtn.i +++ b/wxPython/src/_tglbtn.i @@ -33,10 +33,10 @@ public: wxToggleButton(wxWindow *, wxWindowID, const wxString&, const wxPoint&, const wxSize&, long, const wxValidator&, const wxString&) - { PyErr_SetNone(PyExc_NotImplementedError); } + { wxPyRaiseNotImplemented(); } wxToggleButton() - { PyErr_SetNone(PyExc_NotImplementedError); } + { wxPyRaiseNotImplemented(); } }; #endif %} diff --git a/wxPython/src/_wave.i b/wxPython/src/_wave.i index acf94593a6..a55857dc3b 100644 --- a/wxPython/src/_wave.i +++ b/wxPython/src/_wave.i @@ -30,12 +30,14 @@ class wxWave : public wxObject public: wxWave(const wxString& fileName, bool isResource = False) { wxPyBeginBlockThreads(); - PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform."); + PyErr_SetString(PyExc_NotImplementedError, + "wxWave is not available on this platform."); wxPyEndBlockThreads(); } wxWave(int size, const wxByte* data) { wxPyBeginBlockThreads(); - PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform."); + PyErr_SetString(PyExc_NotImplementedError, + "wxWave is not available on this platform."); wxPyEndBlockThreads(); } diff --git a/wxPython/src/_window.i b/wxPython/src/_window.i index 9dec8acb35..34c35b3703 100644 --- a/wxPython/src/_window.i +++ b/wxPython/src/_window.i @@ -807,7 +807,7 @@ wxWindow* wxFindWindowByLabel( const wxString& label, win->SubclassWin(hWnd); return win; #else - PyErr_SetNone(PyExc_NotImplementedError); + wxPyRaiseNotImplemented(); return NULL; #endif } -- 2.45.2