Skip to content
Permalink
Browse files

py3: CXX: remaining diff:

win: exernalize missing CXX-functions
define PYCXX_PYTHON_2TO3
  • Loading branch information...
looooo authored and yorikvanhavre committed May 22, 2017
1 parent d5c5870 commit 852a984195d4f49a320f8d8732532b12da5c578d
@@ -106,20 +106,20 @@
# define EXPLICIT_CLASS
# define TEMPLATE_TYPENAME class
#endif

// export macro

// export macro
#if defined( _MSC_VER )
# pragma warning( disable : 4251 )
#endif
# 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
# 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
@@ -128,4 +128,9 @@
#if PY_MINOR_VERSION < 2
typedef long int Py_hash_t;
#endif

#ifndef PYCXX_PYTHON_2TO3
#define PYCXX_PYTHON_2TO3
#endif

#endif // __PyCXX_config_hh__
@@ -104,7 +104,7 @@

namespace Py
{
extern PythonExtensionBase *getPythonExtensionBase( PyObject *self );
PYCXX_EXPORT extern PythonExtensionBase *getPythonExtensionBase( PyObject *self );
struct PythonClassInstance
{
PyObject_HEAD
@@ -175,8 +175,8 @@ PYCXX_EXPORT int &_Py_TabcheckFlag();
PYCXX_EXPORT int &_Py_VerboseFlag();
PYCXX_EXPORT int &_Py_UnicodeFlag();

void _XINCREF( PyObject *op );
void _XDECREF( PyObject *op );
PYCXX_EXPORT void _XINCREF( PyObject *op );
PYCXX_EXPORT void _XDECREF( PyObject *op );

PYCXX_EXPORT char *__Py_PackageContext();
};
@@ -239,7 +239,7 @@ namespace Py
//

// Can pyob be used in this object's constructor?
virtual bool accepts( PyObject *pyob ) const
virtual bool accepts( PyObject * /* pyob */ ) const
{
// allow any object or NULL
return true;
@@ -429,12 +429,12 @@ namespace Py
};

//------------------------------------------------------------
bool operator==( const Object &o1, const Object &o2 );
bool operator!=( const Object &o1, const Object &o2 );
bool operator>=( const Object &o1, const Object &o2 );
bool operator<=( const Object &o1, const Object &o2 );
bool operator<( const Object &o1, const Object &o2 );
bool operator>( const Object &o1, const Object &o2 );
PYCXX_EXPORT bool operator==( const Object &o1, const Object &o2 );
PYCXX_EXPORT bool operator!=( const Object &o1, const Object &o2 );
PYCXX_EXPORT bool operator>=( const Object &o1, const Object &o2 );
PYCXX_EXPORT bool operator<=( const Object &o1, const Object &o2 );
PYCXX_EXPORT bool operator<( const Object &o1, const Object &o2 );
PYCXX_EXPORT bool operator>( const Object &o1, const Object &o2 );

//------------------------------------------------------------

@@ -480,7 +480,7 @@ namespace Py

// TMM: 31May'01 - Added the #ifndef so I can exlude iostreams.
#ifndef CXX_NO_IOSTREAMS
std::ostream &operator<<( std::ostream &os, const Object &ob );
PYCXX_EXPORT std::ostream &operator<<( std::ostream &os, const Object &ob );
#endif

// Class Type
@@ -1285,7 +1285,7 @@ namespace Py
// ...the base class for all sequence types

template<TEMPLATE_TYPENAME T>
class PYCXX_EXPORT SeqBase: public Object
class SeqBase: public Object
{
public:
// STL definitions
@@ -2179,7 +2179,7 @@ namespace Py
}

// New tuple of a given size
explicit Tuple( int size = 0 )
explicit Tuple( sequence_index_type size = 0 )
{
set( PyTuple_New( size ), true );
validate();
@@ -2237,7 +2237,7 @@ namespace Py
{
public:
TupleN()
: Tuple( 0 )
: Tuple( (sequence_index_type)0 )
{
}

@@ -2362,7 +2362,7 @@ namespace Py
validate();
}
// Creation at a fixed size
List( int size = 0 )
List( sequence_index_type size = 0 )
{
set( PyList_New( size ), true );
validate();
@@ -2379,7 +2379,7 @@ namespace Py
List( const Sequence &s )
: Sequence()
{
int n =( int )s.length();
sequence_index_type n =( int )s.length();
set( PyList_New( n ), true );
validate();
for( sequence_index_type i=0; i < n; i++ )
@@ -2648,7 +2648,7 @@ namespace Py
#endif

template<TEMPLATE_TYPENAME T>
class PYCXX_EXPORT MapBase: public Object
class MapBase: public Object
{
protected:
explicit MapBase<T>()
@@ -3059,10 +3059,10 @@ namespace Py
template <TEMPLATE_TYPENAME T> bool operator==( const EXPLICIT_TYPENAME MapBase<T>::const_iterator &left, const EXPLICIT_TYPENAME MapBase<T>::const_iterator &right );
template <TEMPLATE_TYPENAME T> bool operator!=( const EXPLICIT_TYPENAME MapBase<T>::const_iterator &left, const EXPLICIT_TYPENAME MapBase<T>::const_iterator &right );

extern bool operator==( const Mapping::iterator &left, const Mapping::iterator &right );
extern bool operator!=( const Mapping::iterator &left, const Mapping::iterator &right );
extern bool operator==( const Mapping::const_iterator &left, const Mapping::const_iterator &right );
extern bool operator!=( const Mapping::const_iterator &left, const Mapping::const_iterator &right );
PYCXX_EXPORT extern bool operator==( const Mapping::iterator &left, const Mapping::iterator &right );
PYCXX_EXPORT extern bool operator!=( const Mapping::iterator &left, const Mapping::iterator &right );
PYCXX_EXPORT extern bool operator==( const Mapping::const_iterator &left, const Mapping::const_iterator &right );
PYCXX_EXPORT extern bool operator!=( const Mapping::const_iterator &left, const Mapping::const_iterator &right );


// ==================================================
@@ -3233,7 +3233,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 );
}

@@ -222,7 +222,9 @@ extern "C"
// All the following functions redirect the call from Python
// onto the matching virtual function in PythonExtensionBase
//
#ifdef PYCXX_PYTHON_2TO3
static int print_handler( PyObject *, FILE *, int );
#endif
static PyObject *getattr_handler( PyObject *, char * );
static int setattr_handler( PyObject *, char *, PyObject * );
static PyObject *getattro_handler( PyObject *, PyObject * );
@@ -1221,7 +1223,7 @@ Py::Object PythonExtensionBase::callOnSelf( const std::string &fn_name,
return self().callMemberFunction( fn_name, args );
}

void PythonExtensionBase::reinit( Tuple &args, Dict &kwds )
void PythonExtensionBase::reinit( Tuple & /* args */, Dict & /* kwds */)
{
throw RuntimeError( "Must not call __init__ twice on this class" );
}
@@ -1479,7 +1481,7 @@ Py::Object PythonExtensionBase::number_power( const Py::Object &, const Py::Obje


// Buffer
int PythonExtensionBase::buffer_get( Py_buffer *buf, int flags )
int PythonExtensionBase::buffer_get( Py_buffer * /* buf */, int /* flags */ )
{
missing_method( buffer_get );
return -1;

0 comments on commit 852a984

Please sign in to comment.
You can’t perform that action at this time.