diff options
| author | qrort <[email protected]> | 2022-12-02 11:31:25 +0300 |
|---|---|---|
| committer | qrort <[email protected]> | 2022-12-02 11:31:25 +0300 |
| commit | b1f4ffc9c8abff3ba58dc1ec9a9f92d2f0de6806 (patch) | |
| tree | 2a23209faf0fea5586a6d4b9cee60d1b318d29fe /contrib/libs/pycxx/Python3/cxx_exceptions.cxx | |
| parent | 559174a9144de40d6bb3997ea4073c82289b4974 (diff) | |
remove kikimr/driver DEPENDS
Diffstat (limited to 'contrib/libs/pycxx/Python3/cxx_exceptions.cxx')
| -rw-r--r-- | contrib/libs/pycxx/Python3/cxx_exceptions.cxx | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/contrib/libs/pycxx/Python3/cxx_exceptions.cxx b/contrib/libs/pycxx/Python3/cxx_exceptions.cxx deleted file mode 100644 index 9dff2753ddd..00000000000 --- a/contrib/libs/pycxx/Python3/cxx_exceptions.cxx +++ /dev/null @@ -1,72 +0,0 @@ -// -// cxx_exceptions.cxx -// -#include "../Exception.hxx" -#include "../Extensions.hxx" - -#include <map> - -namespace Py -{ -typedef void (*throw_exception_func_t)( PyObject* exc ); - -std::map<void *, throw_exception_func_t> py_exc_type_to_exc_func; - -void addPythonException( ExtensionExceptionType &py_exc_type, throw_exception_func_t func ) -{ - py_exc_type_to_exc_func.insert( std::make_pair( py_exc_type.ptr(), func ) ); -} - -void addPythonException( PyObject *py_exc_type, throw_exception_func_t func ) -{ - py_exc_type_to_exc_func.insert( std::make_pair( py_exc_type, func ) ); -} - -void ifPyErrorThrowCxxException() -{ - if( PyErr_Occurred() ) - { - PyObject *ptype, *pvalue, *ptrace; - PyErr_Fetch( &ptype, &pvalue, &ptrace ); - PyErr_Restore( ptype, pvalue, ptrace ); - - Object q( ptype ); - - std::map<void *, throw_exception_func_t>::iterator func = py_exc_type_to_exc_func.find( ptype ); - if( func != py_exc_type_to_exc_func.end() ) - { -#ifdef PYCXX_DEBUG - std::cout << "ifPyErrorThrowCxxException found throwFunc: " << q << std::endl; -#endif - (func->second)(pvalue); - } - else - { -#ifdef PYCXX_DEBUG - std::cout << "ifPyErrorThrowCxxException no throwFunc: " << q << std::endl; -#endif - throw Exception(); - } - } -} - -void initExceptions() -{ - static bool init_done = false; - if( init_done ) - { - return; - } - -#define PYCXX_STANDARD_EXCEPTION( eclass, bclass ) \ - addPythonException( eclass::exceptionType(), eclass::throwFuncObj ); - -#include "cxx_standard_exceptions.hxx" - -#undef PYCXX_STANDARD_EXCEPTION - - init_done = true; -} - - -} // end of namespace Py |
