PyCXX: harmonize PyCXX with Python C API
This commit is contained in:
@@ -54,7 +54,7 @@
|
||||
|
||||
namespace Py
|
||||
{
|
||||
typedef size_t sequence_index_type; // type of an index into a sequence
|
||||
typedef Py_ssize_t sequence_index_type; // type of an index into a sequence
|
||||
|
||||
// Forward declarations
|
||||
class Object;
|
||||
@@ -1126,7 +1126,7 @@ namespace Py
|
||||
{
|
||||
protected:
|
||||
SeqBase<T>& s; // the sequence
|
||||
size_t offset; // item number
|
||||
sequence_index_type offset; // item number
|
||||
T the_item; // lvalue
|
||||
public:
|
||||
|
||||
@@ -1316,7 +1316,7 @@ namespace Py
|
||||
{
|
||||
public:
|
||||
// STL definitions
|
||||
typedef size_t size_type;
|
||||
typedef Py_ssize_t size_type;
|
||||
typedef seqref<T> reference;
|
||||
typedef T const_reference;
|
||||
typedef seqref<T>* pointer;
|
||||
@@ -2099,7 +2099,7 @@ namespace Py
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::string( PyString_AsString( ptr() ), static_cast<size_type>( PyString_Size( ptr() ) ) );
|
||||
return std::string( PyString_AsString( ptr() ), static_cast<size_t>( PyString_Size( ptr() ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2305,7 +2305,7 @@ namespace Py
|
||||
}
|
||||
|
||||
// New tuple of a given size
|
||||
explicit Tuple (sequence_index_type size = 0)
|
||||
explicit Tuple (size_type size=0)
|
||||
{
|
||||
set(PyTuple_New (size), true);
|
||||
validate ();
|
||||
@@ -2363,7 +2363,7 @@ namespace Py
|
||||
{
|
||||
public:
|
||||
TupleN()
|
||||
: Tuple( (sequence_index_type)0 )
|
||||
: Tuple( (size_type)0 )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -2487,11 +2487,11 @@ namespace Py
|
||||
validate();
|
||||
}
|
||||
// Creation at a fixed size
|
||||
List (sequence_index_type size = 0)
|
||||
List (size_type size=0)
|
||||
{
|
||||
set(PyList_New (size), true);
|
||||
validate();
|
||||
for (sequence_index_type i=0; i < size; i++)
|
||||
for (size_type i=0; i < size; i++)
|
||||
{
|
||||
if(PyList_SetItem (ptr(), i, new_reference_to(Py::_None())) == -1)
|
||||
{
|
||||
@@ -2503,7 +2503,7 @@ namespace Py
|
||||
// List from a sequence
|
||||
List (const Sequence& s): Sequence()
|
||||
{
|
||||
sequence_index_type n = s.length();
|
||||
size_type n = s.length();
|
||||
set(PyList_New (n), true);
|
||||
validate();
|
||||
for (sequence_index_type i=0; i < n; i++)
|
||||
@@ -2773,7 +2773,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 size_t size_type;
|
||||
typedef Py_ssize_t size_type;
|
||||
typedef Object key_type;
|
||||
typedef mapref<T> data_type;
|
||||
typedef std::pair< const T, T > value_type;
|
||||
|
||||
Reference in New Issue
Block a user