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
This commit is contained in:
Robin Dunn
2003-12-20 19:54:10 +00:00
parent 2678dd26fb
commit 81cfe5e13e
13 changed files with 32 additions and 23 deletions

View File

@@ -145,7 +145,8 @@ void wxPyEndBlockThreads();
#endif // wxPyUSE_EXPORTED_API #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 // These are helpers used by the typemaps

View File

@@ -257,7 +257,7 @@ public:
#else #else
%extend { %extend {
static int GetComCtl32Version() static int GetComCtl32Version()
{ PyErr_SetNone(PyExc_NotImplementedError); return 0; } { wxPyRaiseNotImplemented(); return 0; }
} }
#endif #endif
}; };

View File

@@ -445,7 +445,7 @@ public:
class wxMetafileDataObject : public wxDataObjectSimple class wxMetafileDataObject : public wxDataObjectSimple
{ {
public: public:
wxMetafileDataObject() { PyErr_SetNone(PyExc_NotImplementedError); } wxMetafileDataObject() { wxPyRaiseNotImplemented(); }
}; };
%} %}

View File

@@ -705,13 +705,13 @@ public:
class wxMetaFile : public wxObject { class wxMetaFile : public wxObject {
public: public:
wxMetaFile(const wxString&) wxMetaFile(const wxString&)
{ PyErr_SetNone(PyExc_NotImplementedError); } { wxPyRaiseNotImplemented(); }
}; };
class wxMetaFileDC : public wxClientDC { class wxMetaFileDC : public wxClientDC {
public: public:
wxMetaFileDC(const wxString&, int, int, const wxString&) wxMetaFileDC(const wxString&, int, int, const wxString&)
{ PyErr_SetNone(PyExc_NotImplementedError); } { wxPyRaiseNotImplemented(); }
}; };
%} %}
@@ -751,10 +751,10 @@ public:
class wxPrinterDC : public wxClientDC { class wxPrinterDC : public wxClientDC {
public: public:
wxPrinterDC(const wxPrintData&) wxPrinterDC(const wxPrintData&)
{ PyErr_SetNone(PyExc_NotImplementedError); } { wxPyRaiseNotImplemented(); }
// wxPrinterDC(const wxString&, const wxString&, const wxString&, bool, int) // wxPrinterDC(const wxString&, const wxString&, const wxString&, bool, int)
// { PyErr_SetNone(PyExc_NotImplementedError); } // { wxPyRaiseNotImplemented(); }
}; };
%} %}

View File

@@ -268,10 +268,10 @@ bool wxTestFontEncoding(const wxNativeEncodingInfo& info);
%inline %{ %inline %{
wxNativeEncodingInfo* wxGetNativeFontEncoding(wxFontEncoding encoding) wxNativeEncodingInfo* wxGetNativeFontEncoding(wxFontEncoding encoding)
{ PyErr_SetNone(PyExc_NotImplementedError); return NULL; } { wxPyRaiseNotImplemented(); return NULL; }
bool wxTestFontEncoding(const wxNativeEncodingInfo& info) bool wxTestFontEncoding(const wxNativeEncodingInfo& info)
{ PyErr_SetNone(PyExc_NotImplementedError); return False; } { wxPyRaiseNotImplemented(); return False; }
%} %}
#endif #endif

View File

@@ -52,7 +52,7 @@ long wxGetFreeMemory();
#else #else
%inline %{ %inline %{
long wxGetFreeMemory() long wxGetFreeMemory()
{ PyErr_SetNone(PyExc_NotImplementedError); return 0; } { wxPyRaiseNotImplemented(); return 0; }
%} %}
#endif #endif
@@ -214,6 +214,11 @@ wxWindow* wxGetTopLevelParent(wxWindow *win);
// This is generally most useful getting the state of // This is generally most useful getting the state of
// Caps Lock, Num Lock and Scroll Lock... // Caps Lock, Num Lock and Scroll Lock...
bool wxGetKeyState(wxKeyCode key); bool wxGetKeyState(wxKeyCode key);
#else
%inline %{
bool wxGetKeyState(wxKeyCode key)
{ wxPyRaiseNotImplemented(); return False; }
%}
#endif #endif

View File

@@ -49,7 +49,8 @@ class wxJoystick : public wxObject {
public: public:
wxJoystick(int joystick = wxJOYSTICK1) { wxJoystick(int joystick = wxJOYSTICK1) {
wxPyBeginBlockThreads(); wxPyBeginBlockThreads();
PyErr_SetString(PyExc_NotImplementedError, "wxJoystick is not available on this platform."); PyErr_SetString(PyExc_NotImplementedError,
"wxJoystick is not available on this platform.");
wxPyEndBlockThreads(); wxPyEndBlockThreads();
} }
wxPoint GetPosition() { return wxPoint(-1,-1); } wxPoint GetPosition() { return wxPoint(-1,-1); }

View File

@@ -103,15 +103,15 @@ public:
%{ %{
class wxPopupWindow : public wxWindow { class wxPopupWindow : public wxWindow {
public: public:
wxPopupWindow(wxWindow *, int) { PyErr_SetNone(PyExc_NotImplementedError); } wxPopupWindow(wxWindow *, int) { wxPyRaiseNotImplemented(); }
wxPopupWindow() { PyErr_SetNone(PyExc_NotImplementedError); } wxPopupWindow() { wxPyRaiseNotImplemented(); }
}; };
class wxPyPopupTransientWindow : public wxPopupWindow class wxPyPopupTransientWindow : public wxPopupWindow
{ {
public: public:
wxPyPopupTransientWindow(wxWindow *, int) { PyErr_SetNone(PyExc_NotImplementedError); } wxPyPopupTransientWindow(wxWindow *, int) { wxPyRaiseNotImplemented(); }
wxPyPopupTransientWindow() { PyErr_SetNone(PyExc_NotImplementedError); } wxPyPopupTransientWindow() { wxPyRaiseNotImplemented(); }
}; };
%} %}

View File

@@ -54,7 +54,7 @@ public:
%extend { %extend {
%name(RegionFromPoints)wxRegion(int points, wxPoint* points_array, %name(RegionFromPoints)wxRegion(int points, wxPoint* points_array,
int fillStyle = wxWINDING_RULE) { int fillStyle = wxWINDING_RULE) {
PyErr_SetNone(PyExc_NotImplementedError); wxPyRaiseNotImplemented();
return NULL; return NULL;
} }
} }

View File

@@ -29,7 +29,7 @@
class wxTaskBarIcon : public wxEvtHandler class wxTaskBarIcon : public wxEvtHandler
{ {
public: public:
wxTaskBarIcon() { PyErr_SetNone(PyExc_NotImplementedError); } wxTaskBarIcon() { wxPyRaiseNotImplemented(); }
}; };
@@ -37,7 +37,7 @@ class wxTaskBarIconEvent : public wxEvent
{ {
public: public:
wxTaskBarIconEvent(wxEventType, wxTaskBarIcon *) wxTaskBarIconEvent(wxEventType, wxTaskBarIcon *)
{ PyErr_SetNone(PyExc_NotImplementedError); } { wxPyRaiseNotImplemented(); }
virtual wxEvent* Clone() const { return NULL; } virtual wxEvent* Clone() const { return NULL; }
}; };

View File

@@ -33,10 +33,10 @@ public:
wxToggleButton(wxWindow *, wxWindowID, const wxString&, wxToggleButton(wxWindow *, wxWindowID, const wxString&,
const wxPoint&, const wxSize&, long, const wxPoint&, const wxSize&, long,
const wxValidator&, const wxString&) const wxValidator&, const wxString&)
{ PyErr_SetNone(PyExc_NotImplementedError); } { wxPyRaiseNotImplemented(); }
wxToggleButton() wxToggleButton()
{ PyErr_SetNone(PyExc_NotImplementedError); } { wxPyRaiseNotImplemented(); }
}; };
#endif #endif
%} %}

View File

@@ -30,12 +30,14 @@ class wxWave : public wxObject
public: public:
wxWave(const wxString& fileName, bool isResource = False) { wxWave(const wxString& fileName, bool isResource = False) {
wxPyBeginBlockThreads(); wxPyBeginBlockThreads();
PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform."); PyErr_SetString(PyExc_NotImplementedError,
"wxWave is not available on this platform.");
wxPyEndBlockThreads(); wxPyEndBlockThreads();
} }
wxWave(int size, const wxByte* data) { wxWave(int size, const wxByte* data) {
wxPyBeginBlockThreads(); wxPyBeginBlockThreads();
PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform."); PyErr_SetString(PyExc_NotImplementedError,
"wxWave is not available on this platform.");
wxPyEndBlockThreads(); wxPyEndBlockThreads();
} }

View File

@@ -807,7 +807,7 @@ wxWindow* wxFindWindowByLabel( const wxString& label,
win->SubclassWin(hWnd); win->SubclassWin(hWnd);
return win; return win;
#else #else
PyErr_SetNone(PyExc_NotImplementedError); wxPyRaiseNotImplemented();
return NULL; return NULL;
#endif #endif
} }