aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2019-06-24 08:37:29 +0100
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2019-06-27 07:40:49 +0100
commitb655d3138b2dff046912041c036b2dd87a195a81 (patch)
tree81a9bc966503a002b22a11f9485260dc1c43efe4
parent959c2283818e76903901dddfea041d451eade686 (diff)
downloadswig-b655d3138b2dff046912041c036b2dd87a195a81.tar.gz
Remove the UnknownExceptionHandler director error handling class
Done in order to be C++17 compliant as it uses std::unexpected_handler which was removed in C++17. This class was intended for director exception handling but was never used by SWIG and was never documented. Closes #1538
-rw-r--r--CHANGES.current8
-rw-r--r--Lib/python/director.swg39
-rw-r--r--Lib/ruby/director.swg37
3 files changed, 8 insertions, 76 deletions
diff --git a/CHANGES.current b/CHANGES.current
index 99b31d5c9..e0b7f0897 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -7,6 +7,14 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
Version 4.0.1 (in progress)
===========================
+2019-06-24: wsfulton
+ [Python, Ruby] #1538 Remove the UnknownExceptionHandler class in order to be
+ C++17 compliant as it uses std::unexpected_handler which was removed in C++17.
+ This class was intended for director exception handling but was never used by
+ SWIG and was never documented.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
2019-06-06: bkotzz
[Java] #1552 Improve performance in Java std::vector constructor wrapper that takes
a native Java array as input.
diff --git a/Lib/python/director.swg b/Lib/python/director.swg
index 36df302f1..9694c6233 100644
--- a/Lib/python/director.swg
+++ b/Lib/python/director.swg
@@ -199,45 +199,6 @@ namespace Swig {
}
};
- /* unknown exception handler */
- class UnknownExceptionHandler {
-#ifdef SWIG_DIRECTOR_UEH
- static void handler() {
- try {
- throw;
- } catch (DirectorException& e) {
- std::cerr << "SWIG Director exception caught:" << std::endl
- << e.what() << std::endl;
- } catch (std::exception& e) {
- std::cerr << "std::exception caught: "<< e.what() << std::endl;
- } catch (...) {
- std::cerr << "Unknown exception caught." << std::endl;
- }
-
- std::cerr << std::endl
- << "Python interpreter traceback:" << std::endl;
- PyErr_Print();
- std::cerr << std::endl;
-
- std::cerr << "This exception was caught by the SWIG UnknownExceptionHandler." << std::endl
- << "Try using %feature(\"director:except\") to avoid reaching this point." << std::endl
- << std::endl
- << "Exception is being re-thrown, program will likely abort/terminate." << std::endl;
- throw;
- }
-
- public:
- std::terminate_handler old;
- UnknownExceptionHandler(std::terminate_handler nh = handler) {
- old = std::set_terminate(nh);
- }
-
- ~UnknownExceptionHandler() {
- std::set_terminate(old);
- }
-#endif
- };
-
/* type mismatch in the return value from a python method call */
class DirectorTypeMismatchException : public DirectorException {
public:
diff --git a/Lib/ruby/director.swg b/Lib/ruby/director.swg
index a0569785f..9395b8183 100644
--- a/Lib/ruby/director.swg
+++ b/Lib/ruby/director.swg
@@ -153,43 +153,6 @@ namespace Swig {
}
};
- /* unknown exception handler */
- class UnknownExceptionHandler {
-#ifdef SWIG_DIRECTOR_UEH
- static void handler() {
- try {
- throw;
- } catch (DirectorException& e) {
- std::cerr << "SWIG Director exception caught:" << std::endl
- << e.what() << std::endl;
- } catch (std::exception& e) {
- std::cerr << "std::exception caught: "<< e.what() << std::endl;
- } catch (...) {
- std::cerr << "Unknown exception caught." << std::endl;
- }
- std::cerr << std::endl
- << "Ruby interpreter traceback:" << std::endl;
- std::cerr << std::endl;
- std::cerr << "This exception was caught by the SWIG UnknownExceptionHandler." << std::endl
- << "Try using %feature(\"director:except\") to avoid reaching this point." << std::endl
- << std::endl
- << "Exception is being re-thrown, program will like abort/terminate." << std::endl;
- throw;
- }
-
- public:
- std::terminate_handler old;
- UnknownExceptionHandler(std::terminate_handler nh = handler) {
- old = std::set_terminate(nh);
- }
-
- ~UnknownExceptionHandler() {
- std::set_terminate(old);
- }
-#endif
- };
-
-
/* Type mismatch in the return value from a Ruby method call */
class DirectorTypeMismatchException : public DirectorException {
public: