PyCXX: update to version 7.0.0

This commit is contained in:
wmayer
2022-08-01 16:39:26 +02:00
parent 739b59ff2d
commit 401e2558ca
16 changed files with 758 additions and 486 deletions

View File

@@ -54,33 +54,16 @@ namespace Py
class Object;
class PYCXX_EXPORT Exception
class PYCXX_EXPORT BaseException
{
public:
Exception( ExtensionExceptionType &exception, const std::string &reason );
Exception( ExtensionExceptionType &exception, Object &reason );
BaseException( ExtensionExceptionType &exception, const std::string &reason );
BaseException( ExtensionExceptionType &exception, Object &reason );
BaseException( PyObject *exception, Object &reason );
BaseException( PyObject *exception, const std::string &reason );
explicit BaseException();
explicit Exception ()
{}
// This overloaded constructor will be removed in future PyCXX versions
//Exception (const std::string &reason)
//{
// PyErr_SetString( Py::_Exc_RuntimeError(), reason.c_str() );
//}
Exception( PyObject *exception, const std::string &reason )
{
PyErr_SetString( exception, reason.c_str() );
}
Exception( PyObject *exception, Object &reason );
void clear() // clear the error
// technically but not philosophically const
{
PyErr_Clear();
}
void clear(); // clear the error
// is the exception this specific exception 'exc'
bool matches( ExtensionExceptionType &exc );
@@ -90,13 +73,27 @@ namespace Py
typedef void (*throw_exception_func_t)( void );
void addPythonException( ExtensionExceptionType &py_exc_type, throw_exception_func_t throw_func );
// Abstract
class PYCXX_EXPORT StandardError: public Exception
#if defined( PYCXX_6_2_COMPATIBILITY )
class PYCXX_EXPORT Exception : public BaseException
{
protected:
explicit StandardError()
public:
Exception( ExtensionExceptionType &exception, const std::string &reason )
: BaseException( exception, reason )
{}
Exception( ExtensionExceptionType &exception, Object &reason )
: BaseException( exception, reason )
{}
Exception( PyObject *exception, const std::string &reason )
: BaseException( exception, reason )
{}
explicit Exception()
: BaseException()
{}
};
#endif
#define PYCXX_STANDARD_EXCEPTION( eclass, bclass ) \
class PYCXX_EXPORT eclass : public bclass \
@@ -114,6 +111,56 @@ namespace Py
#include <CXX/Python3/cxx_standard_exceptions.hxx>
#undef PYCXX_STANDARD_EXCEPTION
#define PYCXX_USER_EXCEPTION_STR_ARG( uclass ) \
class PYCXX_EXPORT uclass : public Py::BaseException \
{ \
public: \
uclass( const std::string &reason ) \
: Py::BaseException( m_error, reason ) \
{ } \
~uclass() {} \
static void init( Py::ExtensionModuleBase &module ) \
{ \
m_error.init( module, #uclass ); \
Py::addPythonException( m_error, throwFunc ); \
Py::Dict d( module.moduleDictionary() ); \
d[#uclass] = m_error; \
} \
private: \
uclass() : Py::BaseException() {} \
static void throwFunc() \
{ \
throw uclass(); \
} \
static Py::ExtensionExceptionType m_error; \
}; \
Py::ExtensionExceptionType uclass::m_error;
#define PYCXX_USER_EXCEPTION_NO_ARG( uclass ) \
class PYCXX_EXPORT uclass : public Py::BaseException \
{ \
public: \
uclass() \
: Py::BaseException() \
{ } \
~uclass() {} \
static void init( Py::ExtensionModuleBase &module ) \
{ \
m_error.init( module, #uclass ); \
Py::addPythonException( m_error, throwFunc ); \
Py::Dict d( module.moduleDictionary() ); \
d[#uclass] = m_error; \
} \
private: \
static void throwFunc() \
{ \
throw uclass(); \
} \
static Py::ExtensionExceptionType m_error; \
}; \
Py::ExtensionExceptionType uclass::m_error;
}// Py
#endif

View File

@@ -270,7 +270,7 @@ namespace Py
return new_reference_to( result.ptr() );
}
catch( Exception & )
catch( BaseException & )
{
return 0;
}
@@ -307,7 +307,7 @@ namespace Py
return new_reference_to( result.ptr() );
}
catch( Exception & )
catch( BaseException & )
{
return 0;
}
@@ -335,7 +335,7 @@ namespace Py
return new_reference_to( result.ptr() );
}
catch( Exception & )
catch( BaseException & )
{
return 0;
}

View File

@@ -52,7 +52,7 @@
Py::Object r( (self->NAME)() ); \
return Py::new_reference_to( r.ptr() ); \
} \
catch( Py::Exception & ) \
catch( Py::BaseException & ) \
{ \
return 0; \
} \
@@ -68,7 +68,7 @@
Py::Object r( (self->NAME)( a ) ); \
return Py::new_reference_to( r.ptr() ); \
} \
catch( Py::Exception & ) \
catch( Py::BaseException & ) \
{ \
return 0; \
} \
@@ -87,7 +87,7 @@
Py::Object r( (self->NAME)( a, k ) ); \
return Py::new_reference_to( r.ptr() ); \
} \
catch( Py::Exception & ) \
catch( Py::BaseException & ) \
{ \
return 0; \
} \
@@ -119,6 +119,13 @@ namespace Py
, m_methods_used( 0 )
, m_methods_size( METHOD_TABLE_SIZE_INCREMENT )
{
// add the sentinel marking the table end
PyMethodDef *p = &m_methods_table[ 0 ];
p->ml_name = NULL;
p->ml_meth = NULL;
p->ml_flags = 0;
p->ml_doc = NULL;
}
~ExtensionClassMethodsTable()
@@ -247,7 +254,7 @@ namespace Py
PyObject *self = reinterpret_cast<PyObject *>( o );
#ifdef PYCXX_DEBUG
std::cout << "extension_object_new() => self=0x" << std::hex << reinterpret_cast< unsigned int >( self ) << std::dec << std::endl;
std::cout << "extension_object_new() => self=0x" << std::hex << reinterpret_cast< unsigned long >( self ) << std::dec << std::endl;
#endif
return self;
}
@@ -263,26 +270,26 @@ namespace Py
PythonClassInstance *self = reinterpret_cast<PythonClassInstance *>( _self );
#ifdef PYCXX_DEBUG
std::cout << "extension_object_init( self=0x" << std::hex << reinterpret_cast< unsigned int >( self ) << std::dec << " )" << std::endl;
std::cout << " self->m_pycxx_object=0x" << std::hex << reinterpret_cast< unsigned int >( self->m_pycxx_object ) << std::dec << std::endl;
std::cout << "extension_object_init( self=0x" << std::hex << reinterpret_cast< unsigned long >( self ) << std::dec << " )" << std::endl;
std::cout << " self->m_pycxx_object=0x" << std::hex << reinterpret_cast< unsigned long >( self->m_pycxx_object ) << std::dec << std::endl;
#endif
if( self->m_pycxx_object == NULL )
{
self->m_pycxx_object = new T( self, args, kwds );
#ifdef PYCXX_DEBUG
std::cout << " self->m_pycxx_object=0x" << std::hex << reinterpret_cast< unsigned int >( self->m_pycxx_object ) << std::dec << std::endl;
std::cout << " self->m_pycxx_object=0x" << std::hex << reinterpret_cast< unsigned long >( self->m_pycxx_object ) << std::dec << std::endl;
#endif
}
else
{
#ifdef PYCXX_DEBUG
std::cout << " reinit - self->m_pycxx_object=0x" << std::hex << reinterpret_cast< unsigned int >( self->m_pycxx_object ) << std::dec << std::endl;
std::cout << " reinit - self->m_pycxx_object=0x" << std::hex << reinterpret_cast< unsigned long >( self->m_pycxx_object ) << std::dec << std::endl;
#endif
self->m_pycxx_object->reinit( args, kwds );
}
}
catch( Exception & )
catch( BaseException & )
{
return -1;
}
@@ -293,8 +300,8 @@ namespace Py
{
PythonClassInstance *self = reinterpret_cast< PythonClassInstance * >( _self );
#ifdef PYCXX_DEBUG
std::cout << "extension_object_deallocator( self=0x" << std::hex << reinterpret_cast< unsigned int >( self ) << std::dec << " )" << std::endl;
std::cout << " self->m_pycxx_object=0x" << std::hex << reinterpret_cast< unsigned int >( self->m_pycxx_object ) << std::dec << std::endl;
std::cout << "extension_object_deallocator( self=0x" << std::hex << reinterpret_cast< unsigned long >( self ) << std::dec << " )" << std::endl;
std::cout << " self->m_pycxx_object=0x" << std::hex << reinterpret_cast< unsigned long >( self->m_pycxx_object ) << std::dec << std::endl;
#endif
delete self->m_pycxx_object;
_self->ob_type->tp_free( _self );
@@ -313,8 +320,17 @@ namespace Py
static bool check( PyObject *p )
{
// is p like me?
return p->ob_type == type_object();
// is p a me or a derived me
switch( PyObject_IsInstance( p, reinterpret_cast<PyObject *>( type_object() ) ) )
{
default:
case -1:
throw Exception();
case 0:
return false;
case 1:
return true;
}
}
static bool check( const Object &ob )

View File

@@ -89,14 +89,20 @@ namespace Py
virtual PyObject *iternext();
// Sequence methods
virtual int sequence_length();
virtual PyCxx_ssize_t sequence_length();
virtual Object sequence_concat( const Object & );
virtual Object sequence_repeat( Py_ssize_t );
virtual Object sequence_item( Py_ssize_t );
virtual int sequence_ass_item( Py_ssize_t, const Object & );
virtual Object sequence_inplace_concat( const Object & );
virtual Object sequence_inplace_repeat( Py_ssize_t );
virtual int sequence_contains( const Object & );
// Mapping
virtual int mapping_length();
virtual PyCxx_ssize_t mapping_length();
virtual Object mapping_subscript( const Object & );
virtual int mapping_ass_subscript( const Object &, const Object & );

View File

@@ -104,7 +104,7 @@ namespace Py
extern "C" typedef PyObject *(*method_keyword_call_handler_t)( PyObject *_self, PyObject *_args, PyObject *_dict );
template<class T>
class MethodDefExt : public PyMethodDef
class MethodDefExt
{
public:
typedef Object (T::*method_noargs_function_t)();

View File

@@ -49,40 +49,12 @@ bool InitialisePythonIndirectInterface();
// Wrap Exception variables as function calls
//
PYCXX_EXPORT PyObject * _Exc_Exception();
PYCXX_EXPORT PyObject * _Exc_StandardError();
PYCXX_EXPORT PyObject * _Exc_ArithmeticError();
PYCXX_EXPORT PyObject * _Exc_LookupError();
PYCXX_EXPORT PyObject * _Exc_AssertionError();
PYCXX_EXPORT PyObject * _Exc_AttributeError();
PYCXX_EXPORT PyObject * _Exc_EOFError();
PYCXX_EXPORT PyObject * _Exc_FloatingPointError();
PYCXX_EXPORT PyObject * _Exc_EnvironmentError();
PYCXX_EXPORT PyObject * _Exc_IOError();
PYCXX_EXPORT PyObject * _Exc_OSError();
PYCXX_EXPORT PyObject * _Exc_ImportError();
PYCXX_EXPORT PyObject * _Exc_IndexError();
PYCXX_EXPORT PyObject * _Exc_KeyError();
PYCXX_EXPORT PyObject * _Exc_KeyboardInterrupt();
PYCXX_EXPORT PyObject * _Exc_MemoryError();
PYCXX_EXPORT PyObject * _Exc_NameError();
PYCXX_EXPORT PyObject * _Exc_OverflowError();
PYCXX_EXPORT PyObject * _Exc_RuntimeError();
PYCXX_EXPORT PyObject * _Exc_NotImplementedError();
PYCXX_EXPORT PyObject * _Exc_SyntaxError();
PYCXX_EXPORT PyObject * _Exc_SystemError();
PYCXX_EXPORT PyObject * _Exc_SystemExit();
PYCXX_EXPORT PyObject * _Exc_TypeError();
PYCXX_EXPORT PyObject * _Exc_ValueError();
PYCXX_EXPORT PyObject * _Exc_ZeroDivisionError();
#ifdef MS_WINDOWS
PYCXX_EXPORT PyObject * _Exc_WindowsError();
#endif
#define PYCXX_STANDARD_EXCEPTION( eclass, bclass ) \
PYCXX_EXPORT PyObject * _Exc_##eclass();
PYCXX_EXPORT PyObject * _Exc_IndentationError();
PYCXX_EXPORT PyObject * _Exc_TabError();
PYCXX_EXPORT PyObject * _Exc_UnboundLocalError();
PYCXX_EXPORT PyObject * _Exc_UnicodeError();
#include "CXX/Python3/cxx_standard_exceptions.hxx"
#undef PYCXX_STANDARD_EXCEPTION
//
// Wrap Object variables as function calls

View File

@@ -375,7 +375,7 @@ namespace Py
{
if( PyObject_SetAttrString( p, const_cast<char*>( s.c_str() ), *value ) == -1 )
{
throw AttributeError( "setAttr failed." );
ifPyErrorThrowCxxException();
}
}
@@ -383,7 +383,7 @@ namespace Py
{
if( PyObject_DelAttrString( p, const_cast<char*>( s.c_str() ) ) == -1 )
{
throw AttributeError( "delAttr failed." );
ifPyErrorThrowCxxException();
}
}
@@ -394,8 +394,7 @@ namespace Py
{
if( PyObject_DelItem( p, *key ) == -1 )
{
// failed to link on Windows?
throw KeyError( "delItem failed." );
ifPyErrorThrowCxxException();
}
}
// Equality and comparison use PyObject_Compare
@@ -1378,7 +1377,7 @@ namespace Py
{
if( PySequence_SetItem( ptr(), i, *ob ) == -1 )
{
throw Exception();
ifPyErrorThrowCxxException();
}
}
@@ -1442,7 +1441,7 @@ namespace Py
protected:
friend class SeqBase<T>;
SeqBase<T> *seq;
size_type count;
sequence_index_type count;
public:
~iterator()
@@ -1453,7 +1452,7 @@ namespace Py
, count( 0 )
{}
iterator( SeqBase<T> *s, size_type where )
iterator( SeqBase<T> *s, Py_ssize_t where )
: seq( s )
, count( where )
{}
@@ -1513,29 +1512,29 @@ namespace Py
return *this;
}
iterator operator+( int n ) const
iterator operator+( sequence_index_type n ) const
{
return iterator( seq, count + n );
}
iterator operator-( int n ) const
iterator operator-( sequence_index_type n ) const
{
return iterator( seq, count - n );
}
iterator &operator+=( int n )
iterator &operator+=( sequence_index_type n )
{
count = count + n;
return *this;
}
iterator &operator-=( int n )
iterator &operator-=( sequence_index_type n )
{
count = count - n;
return *this;
}
int operator-( const iterator &other ) const
sequence_index_type operator-( const iterator &other ) const
{
if( seq->ptr() != other.seq->ptr() )
{
@@ -1612,7 +1611,7 @@ namespace Py
, count( 0 )
{}
const_iterator( const SeqBase<T> *s, size_type where )
const_iterator( const SeqBase<T> *s, sequence_index_type where )
: seq( s )
, count( where )
{}
@@ -1642,7 +1641,7 @@ namespace Py
return *this;
}
const_iterator operator+( int n ) const
const_iterator operator+( sequence_index_type n ) const
{
return const_iterator( seq, count + n );
}
@@ -1677,18 +1676,18 @@ namespace Py
return count >= other.count;
}
const_iterator operator-( int n )
const_iterator operator-( sequence_index_type n )
{
return const_iterator( seq, count - n );
}
const_iterator &operator+=( int n )
const_iterator &operator+=( sequence_index_type n )
{
count = count + n;
return *this;
}
const_iterator &operator-=( int n )
const_iterator &operator-=( sequence_index_type n )
{
count = count - n;
return *this;
@@ -1789,6 +1788,7 @@ namespace Py
virtual bool accepts( PyObject *pyob ) const
{
return pyob != NULL
// QQQ _Unicode_Check for a Byte???
&& Py::_Unicode_Check( pyob )
&& PySequence_Length( pyob ) == 1;
}
@@ -2176,7 +2176,7 @@ namespace Py
// note PyTuple_SetItem is a thief...
if( PyTuple_SetItem( ptr(), offset, new_reference_to( ob ) ) == -1 )
{
throw Exception();
ifPyErrorThrowCxxException();
}
}
@@ -2202,7 +2202,7 @@ namespace Py
{
if( PyTuple_SetItem( ptr(), i, new_reference_to( Py::_None() ) ) == -1 )
{
throw Exception();
ifPyErrorThrowCxxException();
}
}
}
@@ -2218,7 +2218,7 @@ namespace Py
{
if( PyTuple_SetItem( ptr(), i, new_reference_to( s[i] ) ) == -1 )
{
throw Exception();
ifPyErrorThrowCxxException();
}
}
}
@@ -2385,7 +2385,7 @@ namespace Py
{
if( PyList_SetItem( ptr(), i, new_reference_to( Py::_None() ) ) == -1 )
{
throw Exception();
ifPyErrorThrowCxxException();
}
}
}
@@ -2401,7 +2401,7 @@ namespace Py
{
if( PyList_SetItem( ptr(), i, new_reference_to( s[i] ) ) == -1 )
{
throw Exception();
ifPyErrorThrowCxxException();
}
}
}
@@ -2439,7 +2439,7 @@ namespace Py
{
if( PyList_SetSlice( ptr(), i, j, *v ) == -1 )
{
throw Exception();
ifPyErrorThrowCxxException();
}
}
@@ -2447,7 +2447,7 @@ namespace Py
{
if( PyList_Append( ptr(), *ob ) == -1 )
{
throw Exception();
ifPyErrorThrowCxxException();
}
}
@@ -2460,7 +2460,7 @@ namespace Py
{
if( PyList_Insert( ptr(), i, *ob ) == -1 )
{
throw Exception();
ifPyErrorThrowCxxException();
}
}
@@ -2468,7 +2468,7 @@ namespace Py
{
if( PyList_Sort( ptr() ) == -1 )
{
throw Exception();
ifPyErrorThrowCxxException();
}
}
@@ -2476,7 +2476,7 @@ namespace Py
{
if( PyList_Reverse( ptr() ) == -1 )
{
throw Exception();
ifPyErrorThrowCxxException();
}
}
};
@@ -2674,7 +2674,7 @@ namespace Py
// If you assume that Python mapping is a hash_map...
// hash_map::value_type is not assignable, but
//( *it ).second = data must be a valid expression
typedef Py_ssize_t size_type;
typedef PyCxx_ssize_t size_type;
typedef Object key_type;
typedef mapref<T> data_type;
typedef std::pair< const T, T > value_type;
@@ -2726,7 +2726,7 @@ namespace Py
}
}
virtual size_type size() const
virtual Py_ssize_t size() const
{
return PyMapping_Length( ptr() );
}
@@ -2757,7 +2757,7 @@ namespace Py
return mapref<T>( *this, key );
}
size_type length() const
Py_ssize_t length() const
{
return PyMapping_Length( ptr() );
}
@@ -2786,7 +2786,7 @@ namespace Py
{
if( PyMapping_SetItemString( ptr(), const_cast<char*>( s ), *ob ) == -1 )
{
throw Exception();
ifPyErrorThrowCxxException();
}
}
@@ -2794,7 +2794,7 @@ namespace Py
{
if( PyMapping_SetItemString( ptr(), const_cast<char*>( s.c_str() ), *ob ) == -1 )
{
throw Exception();
ifPyErrorThrowCxxException();
}
}
@@ -2802,7 +2802,7 @@ namespace Py
{
if( PyObject_SetItem( ptr(), s.ptr(), ob.ptr() ) == -1 )
{
throw Exception();
ifPyErrorThrowCxxException();
}
}
@@ -2810,7 +2810,7 @@ namespace Py
{
if( PyMapping_DelItemString( ptr(), const_cast<char*>( s.c_str() ) ) == -1 )
{
throw Exception();
ifPyErrorThrowCxxException();
}
}
@@ -2818,7 +2818,7 @@ namespace Py
{
if( PyMapping_DelItem( ptr(), *s ) == -1 )
{
throw Exception();
ifPyErrorThrowCxxException();
}
}
@@ -2853,7 +2853,7 @@ namespace Py
//
MapBase<T> *map;
List keys; // for iterating over the map
size_type pos; // index into the keys
sequence_index_type pos; // index into the keys
public:
~iterator()
@@ -2970,7 +2970,7 @@ namespace Py
friend class MapBase<T>;
const MapBase<T> *map;
List keys; // for iterating over the map
size_type pos; // index into the keys
Py_ssize_t pos; // index into the keys
public:
~const_iterator()
@@ -2982,7 +2982,7 @@ namespace Py
, pos()
{}
const_iterator( const MapBase<T> *m, List k, size_type p )
const_iterator( const MapBase<T> *m, List k, Py_ssize_t p )
: map( m )
, keys( k )
, pos( p )
@@ -3449,7 +3449,7 @@ namespace Py
//------------------------------------------------------------
// type
inline Object type( const Exception &) // return the type of the error
inline Object type( const BaseException & ) // return the type of the error
{
PyObject *ptype, *pvalue, *ptrace;
PyErr_Fetch( &ptype, &pvalue, &ptrace );
@@ -3460,7 +3460,7 @@ namespace Py
return result;
}
inline Object value( const Exception &) // return the value of the error
inline Object value( const BaseException & ) // return the value of the error
{
PyObject *ptype, *pvalue, *ptrace;
PyErr_Fetch( &ptype, &pvalue, &ptrace );
@@ -3471,7 +3471,7 @@ namespace Py
return result;
}
inline Object trace( const Exception &) // return the traceback of the error
inline Object trace( const BaseException & ) // return the traceback of the error
{
PyObject *ptype, *pvalue, *ptrace;
PyErr_Fetch( &ptype, &pvalue, &ptrace );

View File

@@ -72,12 +72,94 @@ namespace Py
PythonType &supportStr( void );
PythonType &supportHash( void );
PythonType &supportCall( void );
PythonType &supportIter( void );
PythonType &supportSequenceType( void );
PythonType &supportMappingType( void );
PythonType &supportNumberType( void );
PythonType &supportBufferType( void );
#define B( n ) (1<<(n))
enum {
support_iter_iter = B(0),
support_iter_iternext = B(1)
};
PythonType &supportIter( int methods_to_support=
support_iter_iter |
support_iter_iternext );
enum {
support_sequence_length = B(0),
support_sequence_repeat = B(1),
support_sequence_item = B(2),
support_sequence_slice = B(3),
support_sequence_concat = B(4),
support_sequence_ass_item = B(5),
support_sequence_ass_slice = B(6),
support_sequence_inplace_concat = B(7),
support_sequence_inplace_repeat = B(8),
support_sequence_contains = B(9)
};
PythonType &supportSequenceType( int methods_to_support=
support_sequence_length |
support_sequence_repeat |
support_sequence_item |
support_sequence_slice |
support_sequence_concat
);
enum {
support_mapping_length = B(0),
support_mapping_subscript = B(1),
support_mapping_ass_subscript = B(2)
};
PythonType &supportMappingType( int methods_to_support=
support_mapping_length |
support_mapping_subscript
);
enum {
support_number_add = B(0),
support_number_subtract = B(1),
support_number_multiply = B(2),
support_number_remainder = B(3),
support_number_divmod = B(4),
support_number_power = B(5),
support_number_negative = B(6),
support_number_positive = B(7),
support_number_absolute = B(8),
support_number_invert = B(9),
support_number_lshift = B(10),
support_number_rshift = B(11),
support_number_and = B(12),
support_number_xor = B(13),
support_number_or = B(14),
support_number_int = B(15),
support_number_float= B(16)
};
PythonType &supportNumberType( int methods_to_support=
support_number_add |
support_number_subtract |
support_number_multiply |
support_number_remainder |
support_number_divmod |
support_number_power |
support_number_negative |
support_number_positive |
support_number_absolute |
support_number_invert |
support_number_lshift |
support_number_rshift |
support_number_and |
support_number_xor |
support_number_or |
support_number_int |
support_number_float
);
enum {
support_buffer_getbuffer = B(0),
support_buffer_releasebuffer = B(1)
};
PythonType &supportBufferType( int methods_to_support=
support_buffer_getbuffer |
support_buffer_releasebuffer
);
#undef B
PythonType &set_tp_dealloc( void (*tp_dealloc)( PyObject * ) );
PythonType &set_tp_init( int (*tp_init)( PyObject *self, PyObject *args, PyObject *kwds ) );

File diff suppressed because it is too large Load Diff

View File

@@ -2,20 +2,67 @@
#pragma error( "define PYCXX_STANDARD_EXCEPTION before including" )
#endif
PYCXX_STANDARD_EXCEPTION( LookupError, StandardError )
PYCXX_STANDARD_EXCEPTION( ArithmeticError, StandardError )
PYCXX_STANDARD_EXCEPTION( EnvironmentError, StandardError )
PYCXX_STANDARD_EXCEPTION( TypeError, StandardError )
PYCXX_STANDARD_EXCEPTION( IndexError, LookupError )
PYCXX_STANDARD_EXCEPTION( AttributeError, StandardError )
PYCXX_STANDARD_EXCEPTION( NameError, StandardError )
PYCXX_STANDARD_EXCEPTION( RuntimeError, StandardError )
PYCXX_STANDARD_EXCEPTION( NotImplementedError, StandardError )
PYCXX_STANDARD_EXCEPTION( SystemError, StandardError )
PYCXX_STANDARD_EXCEPTION( KeyError, LookupError )
PYCXX_STANDARD_EXCEPTION( ValueError, StandardError )
PYCXX_STANDARD_EXCEPTION( OverflowError, ArithmeticError )
PYCXX_STANDARD_EXCEPTION( ZeroDivisionError, ArithmeticError )
PYCXX_STANDARD_EXCEPTION( FloatingPointError, ArithmeticError )
PYCXX_STANDARD_EXCEPTION( MemoryError, StandardError )
PYCXX_STANDARD_EXCEPTION( SystemExit, StandardError )
// taken for python3.5 documentation
// EnvironmentError and IOError are not used in Python3
//PYCXX_STANDARD_EXCEPTION( EnvironmentError, QQQ )
//PYCXX_STANDARD_EXCEPTION( IOError, QQQ )
// 5.4 Exception hierarchy
PYCXX_STANDARD_EXCEPTION( SystemExit, BaseException )
PYCXX_STANDARD_EXCEPTION( KeyboardInterrupt, BaseException )
PYCXX_STANDARD_EXCEPTION( GeneratorExit, BaseException )
#if !defined( PYCXX_6_2_COMPATIBILITY )
PYCXX_STANDARD_EXCEPTION( Exception, BaseException )
#endif
PYCXX_STANDARD_EXCEPTION( StopIteration, Exception )
#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 5
PYCXX_STANDARD_EXCEPTION( StopAsyncIteration, Exception )
#endif
PYCXX_STANDARD_EXCEPTION( ArithmeticError, Exception )
PYCXX_STANDARD_EXCEPTION( FloatingPointError, ArithmeticError )
PYCXX_STANDARD_EXCEPTION( OverflowError, ArithmeticError )
PYCXX_STANDARD_EXCEPTION( ZeroDivisionError, ArithmeticError )
PYCXX_STANDARD_EXCEPTION( AssertionError, Exception )
PYCXX_STANDARD_EXCEPTION( AttributeError, Exception )
PYCXX_STANDARD_EXCEPTION( BufferError, Exception )
PYCXX_STANDARD_EXCEPTION( EOFError, Exception )
PYCXX_STANDARD_EXCEPTION( ImportError, Exception )
PYCXX_STANDARD_EXCEPTION( LookupError, Exception )
PYCXX_STANDARD_EXCEPTION( IndexError, LookupError )
PYCXX_STANDARD_EXCEPTION( KeyError, LookupError )
PYCXX_STANDARD_EXCEPTION( MemoryError, Exception )
PYCXX_STANDARD_EXCEPTION( NameError, Exception )
PYCXX_STANDARD_EXCEPTION( UnboundLocalError, NameError )
PYCXX_STANDARD_EXCEPTION( OSError, Exception )
PYCXX_STANDARD_EXCEPTION( BlockingIOError, OSError )
PYCXX_STANDARD_EXCEPTION( ChildProcessError,OSError )
PYCXX_STANDARD_EXCEPTION( ConnectionError, OSError )
PYCXX_STANDARD_EXCEPTION( BrokenPipeError, ConnectionError )
PYCXX_STANDARD_EXCEPTION( ConnectionAbortedError, ConnectionError )
PYCXX_STANDARD_EXCEPTION( ConnectionRefusedError, ConnectionError )
PYCXX_STANDARD_EXCEPTION( ConnectionResetError, ConnectionError )
PYCXX_STANDARD_EXCEPTION( FileExistsError, OSError )
PYCXX_STANDARD_EXCEPTION( FileNotFoundError, OSError )
PYCXX_STANDARD_EXCEPTION( InterruptedError, OSError )
PYCXX_STANDARD_EXCEPTION( IsADirectoryError, OSError )
PYCXX_STANDARD_EXCEPTION( NotADirectoryError, OSError )
PYCXX_STANDARD_EXCEPTION( PermissionError, OSError )
PYCXX_STANDARD_EXCEPTION( ProcessLookupError, OSError )
PYCXX_STANDARD_EXCEPTION( TimeoutError, OSError )
PYCXX_STANDARD_EXCEPTION( ReferenceError, Exception )
PYCXX_STANDARD_EXCEPTION( RuntimeError, Exception )
PYCXX_STANDARD_EXCEPTION( NotImplementedError, RuntimeError )
#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 5
PYCXX_STANDARD_EXCEPTION( RecursionError, RuntimeError )
#endif
PYCXX_STANDARD_EXCEPTION( SyntaxError, Exception )
PYCXX_STANDARD_EXCEPTION( IndentationError, SyntaxError )
PYCXX_STANDARD_EXCEPTION( TabError, IndentationError )
PYCXX_STANDARD_EXCEPTION( SystemError, Exception )
PYCXX_STANDARD_EXCEPTION( TypeError, Exception )
PYCXX_STANDARD_EXCEPTION( ValueError, Exception )
PYCXX_STANDARD_EXCEPTION( UnicodeError, ValueError )
PYCXX_STANDARD_EXCEPTION( UnicodeDecodeError, UnicodeError )
PYCXX_STANDARD_EXCEPTION( UnicodeEncodeError, UnicodeError )
PYCXX_STANDARD_EXCEPTION( UnicodeTranslateError,UnicodeError )