Patched PyCXX 6.2.5 with original FreeCAD changes made in 6.2.0

This commit is contained in:
Yorik van Havre
2014-09-18 18:40:40 -03:00
parent f5e87dd358
commit 29cadd9681
23 changed files with 621 additions and 472 deletions

View File

@@ -106,6 +106,20 @@
# define EXPLICIT_CLASS
# define TEMPLATE_TYPENAME class
#endif
// export macro
#if defined( _MSC_VER )
# pragma warning( disable : 4251 )
#endif
#if defined( _MSC_VER ) || defined( __MINGW32__ )
# ifdef PYCXX_DLL
# define PYCXX_EXPORT __declspec(dllexport)
# else
# define PYCXX_EXPORT __declspec(dllimport)
# endif
#else
# define PYCXX_EXPORT
#endif
// before 3.2 Py_hash_t was missing
#ifndef PY_MAJOR_VERSION

View File

@@ -54,7 +54,7 @@ namespace Py
class Object;
class Exception
class PYCXX_EXPORT Exception
{
public:
Exception( ExtensionExceptionType &exception, const std::string &reason );
@@ -84,28 +84,28 @@ namespace Py
// Abstract
class StandardError: public Exception
class PYCXX_EXPORT StandardError: public Exception
{
protected:
explicit StandardError()
{}
};
class LookupError: public StandardError
class PYCXX_EXPORT LookupError: public StandardError
{
protected:
explicit LookupError()
{}
};
class ArithmeticError: public StandardError
class PYCXX_EXPORT ArithmeticError: public StandardError
{
protected:
explicit ArithmeticError()
{}
};
class EnvironmentError: public StandardError
class PYCXX_EXPORT EnvironmentError: public StandardError
{
protected:
explicit EnvironmentError()
@@ -114,7 +114,7 @@ namespace Py
// Concrete
class TypeError: public StandardError
class PYCXX_EXPORT TypeError: public StandardError
{
public:
TypeError (const std::string& reason)
@@ -124,7 +124,7 @@ namespace Py
}
};
class IndexError: public LookupError
class PYCXX_EXPORT IndexError: public LookupError
{
public:
IndexError (const std::string& reason)
@@ -134,7 +134,7 @@ namespace Py
}
};
class AttributeError: public StandardError
class PYCXX_EXPORT AttributeError: public StandardError
{
public:
AttributeError (const std::string& reason)
@@ -144,7 +144,7 @@ namespace Py
}
};
class NameError: public StandardError
class PYCXX_EXPORT NameError: public StandardError
{
public:
NameError (const std::string& reason)
@@ -154,7 +154,7 @@ namespace Py
}
};
class RuntimeError: public StandardError
class PYCXX_EXPORT RuntimeError: public StandardError
{
public:
RuntimeError (const std::string& reason)
@@ -174,7 +174,7 @@ namespace Py
}
};
class SystemError: public StandardError
class PYCXX_EXPORT SystemError: public StandardError
{
public:
SystemError (const std::string& reason)
@@ -184,7 +184,7 @@ namespace Py
}
};
class KeyError: public LookupError
class PYCXX_EXPORT KeyError: public LookupError
{
public:
KeyError (const std::string& reason)
@@ -195,7 +195,7 @@ namespace Py
};
class ValueError: public StandardError
class PYCXX_EXPORT ValueError: public StandardError
{
public:
ValueError (const std::string& reason)
@@ -205,7 +205,7 @@ namespace Py
}
};
class OverflowError: public ArithmeticError
class PYCXX_EXPORT OverflowError: public ArithmeticError
{
public:
OverflowError (const std::string& reason)
@@ -215,7 +215,7 @@ namespace Py
}
};
class ZeroDivisionError: public ArithmeticError
class PYCXX_EXPORT ZeroDivisionError: public ArithmeticError
{
public:
ZeroDivisionError (const std::string& reason)
@@ -225,7 +225,7 @@ namespace Py
}
};
class FloatingPointError: public ArithmeticError
class PYCXX_EXPORT FloatingPointError: public ArithmeticError
{
public:
FloatingPointError (const std::string& reason)
@@ -235,7 +235,7 @@ namespace Py
}
};
class MemoryError: public StandardError
class PYCXX_EXPORT MemoryError: public StandardError
{
public:
MemoryError (const std::string& reason)
@@ -245,7 +245,7 @@ namespace Py
}
};
class SystemExit: public StandardError
class PYCXX_EXPORT SystemExit: public StandardError
{
public:
SystemExit (const std::string& reason)

View File

@@ -40,7 +40,7 @@
namespace Py
{
class ExtensionModuleBase
class PYCXX_EXPORT ExtensionModuleBase
{
public:
ExtensionModuleBase( const char *name );
@@ -78,9 +78,9 @@ namespace Py
};
// Note: Python calls noargs as varargs buts args==NULL
extern "C" PyObject *method_noargs_call_handler( PyObject *_self_and_name_tuple, PyObject * );
extern "C" PyObject *method_varargs_call_handler( PyObject *_self_and_name_tuple, PyObject *_args );
extern "C" PyObject *method_keyword_call_handler( PyObject *_self_and_name_tuple, PyObject *_args, PyObject *_keywords );
extern "C" PYCXX_EXPORT PyObject *method_noargs_call_handler( PyObject *_self_and_name_tuple, PyObject * );
extern "C" PYCXX_EXPORT PyObject *method_varargs_call_handler( PyObject *_self_and_name_tuple, PyObject *_args );
extern "C" PYCXX_EXPORT PyObject *method_keyword_call_handler( PyObject *_self_and_name_tuple, PyObject *_args, PyObject *_keywords );
template<TEMPLATE_TYPENAME T>
class ExtensionModule : public ExtensionModuleBase

View File

@@ -112,7 +112,7 @@ namespace Py
};
class ExtensionClassMethodsTable
class PYCXX_EXPORT ExtensionClassMethodsTable
{
public:
ExtensionClassMethodsTable()

View File

@@ -59,7 +59,7 @@ namespace Py
// This special deallocator does a delete on the pointer.
class PythonExtensionBase : public PyObject
class PYCXX_EXPORT PythonExtensionBase : public PyObject
{
public:
PythonExtensionBase();

View File

@@ -63,7 +63,7 @@ namespace Py
class ExtensionModuleBase;
// Make an Exception Type for use in raising custom exceptions
class ExtensionExceptionType : public Object
class PYCXX_EXPORT ExtensionExceptionType : public Object
{
public:
ExtensionExceptionType();
@@ -74,7 +74,7 @@ namespace Py
void init( ExtensionModuleBase &module, const std::string &name );
};
class MethodTable
class PYCXX_EXPORT MethodTable
{
public:
MethodTable();

View File

@@ -39,6 +39,7 @@
#define __CXX_INDIRECT_PYTHON_INTERFACE__HXX__
#include "CXX/WrapPython.h"
#include "CXX/Config.hxx"
namespace Py
{
@@ -47,137 +48,137 @@ bool InitialisePythonIndirectInterface();
//
// Wrap Exception variables as function calls
//
PyObject * _Exc_Exception();
PyObject * _Exc_StandardError();
PyObject * _Exc_ArithmeticError();
PyObject * _Exc_LookupError();
PYCXX_EXPORT PyObject * _Exc_Exception();
PYCXX_EXPORT PyObject * _Exc_StandardError();
PYCXX_EXPORT PyObject * _Exc_ArithmeticError();
PYCXX_EXPORT PyObject * _Exc_LookupError();
PyObject * _Exc_AssertionError();
PyObject * _Exc_AttributeError();
PyObject * _Exc_EOFError();
PyObject * _Exc_FloatingPointError();
PyObject * _Exc_EnvironmentError();
PyObject * _Exc_IOError();
PyObject * _Exc_OSError();
PyObject * _Exc_ImportError();
PyObject * _Exc_IndexError();
PyObject * _Exc_KeyError();
PyObject * _Exc_KeyboardInterrupt();
PyObject * _Exc_MemoryError();
PyObject * _Exc_NameError();
PyObject * _Exc_OverflowError();
PyObject * _Exc_RuntimeError();
PyObject * _Exc_NotImplementedError();
PyObject * _Exc_SyntaxError();
PyObject * _Exc_SystemError();
PyObject * _Exc_SystemExit();
PyObject * _Exc_TypeError();
PyObject * _Exc_ValueError();
PyObject * _Exc_ZeroDivisionError();
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
PyObject * _Exc_WindowsError();
PYCXX_EXPORT PyObject * _Exc_WindowsError();
#endif
PyObject * _Exc_IndentationError();
PyObject * _Exc_TabError();
PyObject * _Exc_UnboundLocalError();
PyObject * _Exc_UnicodeError();
PYCXX_EXPORT PyObject * _Exc_IndentationError();
PYCXX_EXPORT PyObject * _Exc_TabError();
PYCXX_EXPORT PyObject * _Exc_UnboundLocalError();
PYCXX_EXPORT PyObject * _Exc_UnicodeError();
//
// Wrap Object variables as function calls
//
PyObject * _None();
PYCXX_EXPORT PyObject * _None();
PyObject * _False();
PyObject * _True();
PYCXX_EXPORT PyObject * _False();
PYCXX_EXPORT PyObject * _True();
//
// Wrap Type variables as function calls
//
PyTypeObject * _List_Type();
bool _List_Check( PyObject *o );
PYCXX_EXPORT PyTypeObject * _List_Type();
PYCXX_EXPORT bool _List_Check( PyObject *o );
PyTypeObject * _Buffer_Type();
bool _Buffer_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Buffer_Type();
PYCXX_EXPORT bool _Buffer_Check( PyObject *op );
PyTypeObject * _Class_Type();
bool _Class_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Class_Type();
PYCXX_EXPORT bool _Class_Check( PyObject *op );
PyTypeObject * _Instance_Type();
bool _Instance_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Instance_Type();
PYCXX_EXPORT bool _Instance_Check( PyObject *op );
PyTypeObject * _Method_Type();
bool _Method_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Method_Type();
PYCXX_EXPORT bool _Method_Check( PyObject *op );
PyTypeObject * _Complex_Type();
bool _Complex_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Complex_Type();
PYCXX_EXPORT bool _Complex_Check( PyObject *op );
PyTypeObject * _Dict_Type();
bool _Dict_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Dict_Type();
PYCXX_EXPORT bool _Dict_Check( PyObject *op );
PyTypeObject * _File_Type();
bool _File_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _File_Type();
PYCXX_EXPORT bool _File_Check( PyObject *op );
PyTypeObject * _Float_Type();
bool _Float_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Float_Type();
PYCXX_EXPORT bool _Float_Check( PyObject *op );
PyTypeObject * _Frame_Type();
bool _Frame_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Frame_Type();
PYCXX_EXPORT bool _Frame_Check( PyObject *op );
PyTypeObject * _Function_Type();
bool _Function_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Function_Type();
PYCXX_EXPORT bool _Function_Check( PyObject *op );
PyTypeObject * _Bool_Type();
bool _Boolean_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Bool_Type();
PYCXX_EXPORT bool _Boolean_Check( PyObject *op );
PyTypeObject * _Int_Type();
bool _Int_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Int_Type();
PYCXX_EXPORT bool _Int_Check( PyObject *op );
PyTypeObject * _List_Type();
bool _List_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _List_Type();
PYCXX_EXPORT bool _List_Check( PyObject *op );
PyTypeObject * _Long_Type();
bool _Long_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Long_Type();
PYCXX_EXPORT bool _Long_Check( PyObject *op );
PyTypeObject * _CFunction_Type();
bool _CFunction_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _CFunction_Type();
PYCXX_EXPORT bool _CFunction_Check( PyObject *op );
PyTypeObject * _Module_Type();
bool _Module_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Module_Type();
PYCXX_EXPORT bool _Module_Check( PyObject *op );
PyTypeObject * _Type_Type();
bool _Type_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Type_Type();
PYCXX_EXPORT bool _Type_Check( PyObject *op );
PyTypeObject * _Range_Type();
bool _Range_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Range_Type();
PYCXX_EXPORT bool _Range_Check( PyObject *op );
PyTypeObject * _Slice_Type();
bool _Slice_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Slice_Type();
PYCXX_EXPORT bool _Slice_Check( PyObject *op );
PyTypeObject * _Unicode_Type();
bool _Unicode_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Unicode_Type();
PYCXX_EXPORT bool _Unicode_Check( PyObject *op );
PyTypeObject * _Bytes_Type();
bool _Bytes_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Bytes_Type();
PYCXX_EXPORT bool _Bytes_Check( PyObject *op );
PyTypeObject * _TraceBack_Type();
bool _TraceBack_Check( PyObject *v );
PYCXX_EXPORT PyTypeObject * _TraceBack_Type();
PYCXX_EXPORT bool _TraceBack_Check( PyObject *v );
PyTypeObject * _Tuple_Type();
bool _Tuple_Check( PyObject *op );
PYCXX_EXPORT PyTypeObject * _Tuple_Type();
PYCXX_EXPORT bool _Tuple_Check( PyObject *op );
int &_Py_DebugFlag();
int &_Py_InteractiveFlag();
int &_Py_OptimizeFlag();
int &_Py_NoSiteFlag();
int &_Py_TabcheckFlag();
int &_Py_VerboseFlag();
int &_Py_UnicodeFlag();
PYCXX_EXPORT int &_Py_DebugFlag();
PYCXX_EXPORT int &_Py_InteractiveFlag();
PYCXX_EXPORT int &_Py_OptimizeFlag();
PYCXX_EXPORT int &_Py_NoSiteFlag();
PYCXX_EXPORT int &_Py_TabcheckFlag();
PYCXX_EXPORT int &_Py_VerboseFlag();
PYCXX_EXPORT int &_Py_UnicodeFlag();
void _XINCREF( PyObject *op );
void _XDECREF( PyObject *op );
char *__Py_PackageContext();
PYCXX_EXPORT char *__Py_PackageContext();
};
#endif // __CXX_INDIRECT_PYTHON_INTERFACE__HXX__

View File

@@ -53,7 +53,7 @@
namespace Py
{
typedef int sequence_index_type; // type of an index into a sequence
typedef size_t sequence_index_type; // type of an index into a sequence
// Forward declarations
class Object;
@@ -134,7 +134,7 @@ namespace Py
// which you can use in accepts when writing a wrapper class.
// See Demo/range.h and Demo/range.cxx for an example.
class Object
class PYCXX_EXPORT Object
{
private:
// the pointer to the Python object
@@ -402,7 +402,7 @@ namespace Py
// End of class Object
// Null can be return from when it is require to return NULL to Python from a method
class Null: public Object
class PYCXX_EXPORT Null: public Object
{
public:
Null()
@@ -475,7 +475,7 @@ namespace Py
#endif
// Class Type
class Type: public Object
class PYCXX_EXPORT Type: public Object
{
public:
explicit Type( PyObject *pyob, bool owned = false )
@@ -516,7 +516,7 @@ namespace Py
// ===============================================
// class boolean
class Boolean: public Object
class PYCXX_EXPORT Boolean: public Object
{
public:
// Constructor
@@ -579,7 +579,7 @@ namespace Py
// ===============================================
// class Long
class Long: public Object
class PYCXX_EXPORT Long: public Object
{
public:
// Constructor
@@ -860,7 +860,7 @@ namespace Py
// ===============================================
// class Float
//
class Float: public Object
class PYCXX_EXPORT Float: public Object
{
public:
// Constructor
@@ -973,7 +973,7 @@ namespace Py
// ===============================================
// class Complex
class Complex: public Object
class PYCXX_EXPORT Complex: public Object
{
public:
// Constructor
@@ -1086,7 +1086,7 @@ namespace Py
{
protected:
SeqBase<T> &s; // the sequence
int offset; // item number
size_t offset; // item number
T the_item; // lvalue
public:
@@ -1105,7 +1105,7 @@ namespace Py
// TMM: added this seqref ctor for use with STL algorithms
seqref( Object &obj )
: s( dynamic_cast< SeqBase<T>&>( obj ) )
, offset( NULL )
, offset( 0 )
, the_item( s.getItem( offset ) )
{}
@@ -1276,7 +1276,7 @@ namespace Py
// ...the base class for all sequence types
template<TEMPLATE_TYPENAME T>
class SeqBase: public Object
class PYCXX_EXPORT SeqBase: public Object
{
public:
// STL definitions
@@ -1418,13 +1418,13 @@ namespace Py
throw IndexError( "Unexpected SeqBase<T> length." );
}
class iterator
class PYCXX_EXPORT iterator
: public random_access_iterator_parent( seqref<T> )
{
protected:
friend class SeqBase<T>;
SeqBase<T> *seq;
int count;
size_type count;
public:
~iterator()
@@ -1435,7 +1435,7 @@ namespace Py
, count( 0 )
{}
iterator( SeqBase<T> *s, int where )
iterator( SeqBase<T> *s, size_type where )
: seq( s )
, count( where )
{}
@@ -1570,7 +1570,7 @@ namespace Py
return iterator( this, length() );
}
class const_iterator
class PYCXX_EXPORT const_iterator
: public random_access_iterator_parent( const Object )
{
protected:
@@ -1587,7 +1587,7 @@ namespace Py
, count( 0 )
{}
const_iterator( const SeqBase<T> *s, int where )
const_iterator( const SeqBase<T> *s, size_type where )
: seq( s )
, count( where )
{}
@@ -1733,19 +1733,19 @@ namespace Py
template <TEMPLATE_TYPENAME T> bool operator>=( const EXPLICIT_TYPENAME SeqBase<T>::const_iterator &left, const EXPLICIT_TYPENAME SeqBase<T>::const_iterator &right );
extern bool operator==( const Sequence::iterator &left, const Sequence::iterator &right );
extern bool operator!=( const Sequence::iterator &left, const Sequence::iterator &right );
extern bool operator< ( const Sequence::iterator &left, const Sequence::iterator &right );
extern bool operator> ( const Sequence::iterator &left, const Sequence::iterator &right );
extern bool operator<=( const Sequence::iterator &left, const Sequence::iterator &right );
extern bool operator>=( const Sequence::iterator &left, const Sequence::iterator &right );
PYCXX_EXPORT extern bool operator==( const Sequence::iterator &left, const Sequence::iterator &right );
PYCXX_EXPORT extern bool operator!=( const Sequence::iterator &left, const Sequence::iterator &right );
PYCXX_EXPORT extern bool operator< ( const Sequence::iterator &left, const Sequence::iterator &right );
PYCXX_EXPORT extern bool operator> ( const Sequence::iterator &left, const Sequence::iterator &right );
PYCXX_EXPORT extern bool operator<=( const Sequence::iterator &left, const Sequence::iterator &right );
PYCXX_EXPORT extern bool operator>=( const Sequence::iterator &left, const Sequence::iterator &right );
extern bool operator==( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
extern bool operator!=( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
extern bool operator< ( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
extern bool operator> ( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
extern bool operator<=( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
extern bool operator>=( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
PYCXX_EXPORT extern bool operator==( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
PYCXX_EXPORT extern bool operator!=( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
PYCXX_EXPORT extern bool operator< ( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
PYCXX_EXPORT extern bool operator> ( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
PYCXX_EXPORT extern bool operator<=( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
PYCXX_EXPORT extern bool operator>=( const Sequence::const_iterator &left, const Sequence::const_iterator &right );
// ==================================================
// class Char
@@ -1755,7 +1755,7 @@ namespace Py
typedef std::basic_string<Py_UNICODE> unicodestring;
extern Py_UNICODE unicode_null_string[1];
class Byte: public Object
class PYCXX_EXPORT Byte: public Object
{
public:
// Membership
@@ -1820,7 +1820,7 @@ namespace Py
operator Bytes() const;
};
class Bytes: public SeqBase<Byte>
class PYCXX_EXPORT Bytes: public SeqBase<Byte>
{
public:
// Membership
@@ -1915,7 +1915,7 @@ namespace Py
}
};
class Char: public Object
class PYCXX_EXPORT Char: public Object
{
public:
// Membership
@@ -1990,7 +1990,7 @@ namespace Py
operator String() const;
};
class String: public SeqBase<Char>
class PYCXX_EXPORT String: public SeqBase<Char>
{
public:
virtual size_type capacity() const
@@ -2137,7 +2137,7 @@ namespace Py
// ==================================================
// class Tuple
class Tuple: public Sequence
class PYCXX_EXPORT Tuple: public Sequence
{
public:
virtual void setItem( sequence_index_type offset, const Object&ob )
@@ -2217,11 +2217,11 @@ namespace Py
};
class TupleN: public Tuple
class PYCXX_EXPORT TupleN: public Tuple
{
public:
TupleN()
: Tuple( 0 )
: Tuple( (sequence_index_type)0 )
{
}
@@ -2331,7 +2331,7 @@ namespace Py
// ==================================================
// class List
class List: public Sequence
class PYCXX_EXPORT List: public Sequence
{
public:
// Constructor
@@ -2632,7 +2632,7 @@ namespace Py
#endif
template<TEMPLATE_TYPENAME T>
class MapBase: public Object
class PYCXX_EXPORT MapBase: public Object
{
protected:
explicit MapBase<T>()
@@ -3051,7 +3051,7 @@ namespace Py
// ==================================================
// class Dict
class Dict: public Mapping
class PYCXX_EXPORT Dict: public Mapping
{
public:
// Constructor
@@ -3093,7 +3093,7 @@ namespace Py
}
};
class Callable: public Object
class PYCXX_EXPORT Callable: public Object
{
public:
// Constructor
@@ -3150,7 +3150,7 @@ namespace Py
}
};
class Module: public Object
class PYCXX_EXPORT Module: public Object
{
public:
explicit Module( PyObject *pyob, bool owned = false )
@@ -3198,7 +3198,7 @@ namespace Py
inline Object Object::callMemberFunction( const std::string &function_name ) const
{
Callable target( getAttr( function_name ) );
Tuple args( 0 );
Tuple args( (sequence_index_type)0 );
return target.apply( args );
}

View File

@@ -40,7 +40,7 @@
namespace Py
{
class PythonType
class PYCXX_EXPORT PythonType
{
public:
// if you define one sequence method you must define

View File

@@ -1518,6 +1518,61 @@ extern "C" PyObject *method_noargs_call_handler( PyObject *_self_and_name_tuple,
}
}
extern "C" PyObject *method_noargs_call_handler( PyObject *_self_and_name_tuple, PyObject * )
{
try
{
Tuple self_and_name_tuple( _self_and_name_tuple );
PyObject *self_in_cobject = self_and_name_tuple[0].ptr();
void *self_as_void = PyCObject_AsVoidPtr( self_in_cobject );
if( self_as_void == NULL )
return NULL;
ExtensionModuleBase *self = static_cast<ExtensionModuleBase *>( self_as_void );
Object result
(
self->invoke_method_noargs
(
PyCObject_AsVoidPtr( self_and_name_tuple[1].ptr() )
)
);
return new_reference_to( result.ptr() );
}
catch( Exception & )
{
return 0;
}
#if 0
try
{
Tuple self_and_name_tuple( _self_and_name_tuple );
PyObject *self_in_cobject = self_and_name_tuple[0].ptr();
void *self_as_void = PyCObject_AsVoidPtr( self_in_cobject );
if( self_as_void == NULL )
return NULL;
ExtensionModuleBase *self = static_cast<ExtensionModuleBase *>( self_as_void );
String py_name( self_and_name_tuple[1] );
std::string name( py_name.as_std_string( NULL ) );
Object result( self->invoke_method_noargs( name ) );
return new_reference_to( result.ptr() );
}
catch( Exception & )
{
return 0;
}
#else
return 0;
#endif
}
extern "C" PyObject *method_varargs_call_handler( PyObject *_self_and_name_tuple, PyObject *_args )
{
try