X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/54f9ee450905e98296e6afd1376b3d1e06a1e00f..c6f57ccb5d0a15e72ef36ea7b8a95fccaebce762:/wxPython/src/core.i?ds=sidebyside diff --git a/wxPython/src/core.i b/wxPython/src/core.i index 5dd883fdc1..b10d9d60df 100644 --- a/wxPython/src/core.i +++ b/wxPython/src/core.i @@ -39,11 +39,32 @@ _core_._wxPySetDictionary(vars()) %#// be used here. import sys as _sys wx = _sys.modules[__name__] -} +} #endif +%pythoncode { +%#---------------------------------------------------------------------------- + +def _deprecated(callable, msg=None): + """ + Create a wrapper function that will raise a DeprecationWarning + before calling the callable. + """ + if msg is None: + msg = "%s is deprecated" % callable + def deprecatedWrapper(*args, **kwargs): + import warnings + warnings.warn(msg, DeprecationWarning, stacklevel=2) + return callable(*args, **kwargs) + deprecatedWrapper.__doc__ = msg + return deprecatedWrapper + + +%#---------------------------------------------------------------------------- +} + //--------------------------------------------------------------------------- // Include all the files that make up the core module