Skip to content

Commit fac6e65

Browse files
Merge pull request #610 from insertinterestingnamehere/pxd_extras
Pxd extras
2 parents 0333ee7 + de2d674 commit fac6e65

2 files changed

Lines changed: 27 additions & 7 deletions

File tree

dynd/cpp/array.pxd

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,25 @@ cdef extern from 'dynd/array.hpp' namespace 'dynd::nd' nogil:
3737

3838
bool is_null()
3939

40-
array operator<(array &)
41-
array operator<=(array &)
42-
array operator==(array &)
43-
array operator!=(array &)
44-
array operator>=(array &)
45-
array operator>(array &)
46-
4740
void assign(array &) except +translate_exception
4841
array eval() except +translate_exception
4942
array cast(type) except +translate_exception
5043
array ucast(type, ssize_t) except +translate_exception
44+
45+
# These should only be used with versions of Cython later than 0.23.
46+
# Otherwise the exception handler isn't properly applied and the
47+
# resulting uncaught C++ exceptions can crash the Python interpreter.
48+
array operator<(array&) except +translate_exception
49+
array operator<=(array&) except +translate_exception
50+
array operator==(array&) except +translate_exception
51+
array operator!=(array&) except +translate_exception
52+
array operator>=(array&) except +translate_exception
53+
array operator>(array&) except +translate_exception
54+
array operator+(array&) except +translate_exception
55+
array operator-(array&) except +translate_exception
56+
array operator*(array&) except +translate_exception
57+
array operator/(array&) except +translate_exception
58+
array operator()(...) except +translate_exception
5159

5260
array empty(type &tp) except +translate_exception
5361

dynd/cpp/irange.pxd

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from ..config cimport translate_exception
2+
3+
cdef extern from "dynd/irange.hpp" namespace "dynd" nogil:
4+
cppclass irange:
5+
irange()
6+
# Use size_t for this interface since Cython doesn't know
7+
# how to directly convert integer literals in the source
8+
# to intptr_t. It can do that with size_t and on the overwhelming
9+
# majority of platforms that's exactly the same thing.
10+
irange(size_t)
11+
irange(size_t, size_t)
12+
irange(size_t, size_t, size_t)

0 commit comments

Comments
 (0)