restore implicit coercion of Python objects into CPTA

This commit is contained in:
David Rose 2013-03-27 19:40:47 +00:00
parent e36dee223a
commit a27908a7e8
2 changed files with 25 additions and 0 deletions

View File

@ -831,6 +831,23 @@ ConstPointerToArray(const ConstPointerToArray<Element> &copy) :
{
}
#ifdef HAVE_PYTHON
////////////////////////////////////////////////////////////////////
// Function: ConstPointerToArray::Constructor
// Access: Public
// Description: This special constructor accepts a Python list of
// elements, or a Python string (or a bytes object,
// in Python 3).
////////////////////////////////////////////////////////////////////
template<class Element>
INLINE ConstPointerToArray<Element>::
ConstPointerToArray(PyObject *self, PyObject *sequence) :
PointerToArrayBase<Element>(PointerToArray<Element>(self, sequence)),
_type_handle(get_type_handle(Element))
{
}
#endif // HAVE_PYTHON
////////////////////////////////////////////////////////////////////
// Function: ConstPointerToArray::begin
// Access: Public

View File

@ -267,6 +267,10 @@ PUBLISHED:
INLINE ConstPointerToArray(const PointerToArray<Element> &copy);
INLINE ConstPointerToArray(const ConstPointerToArray<Element> &copy);
#ifdef HAVE_PYTHON
INLINE ConstPointerToArray(PyObject *self, PyObject *sequence);
#endif
typedef TYPENAME pvector<Element>::size_type size_type;
INLINE size_type size() const;
INLINE const Element &get_element(size_type n) const;
@ -298,6 +302,10 @@ PUBLISHED:
INLINE ConstPointerToArray(const PointerToArray<Element> &copy);
INLINE ConstPointerToArray(const ConstPointerToArray<Element> &copy);
#ifdef HAVE_PYTHON
INLINE ConstPointerToArray(PyObject *self, PyObject *sequence);
#endif
// Duplicating the interface of vector.
INLINE iterator begin() const;