Commit 358418eb authored by Max Bachmann's avatar Max Bachmann Committed by GitHub

Catch more exceptions from C++ standard containers (GH-4079)

parent 0c819bf5
......@@ -52,9 +52,9 @@ cdef extern from "<deque>" namespace "std" nogil:
bint operator>(deque&, deque&)
bint operator<=(deque&, deque&)
bint operator>=(deque&, deque&)
void assign(size_t, T&)
void assign(input_iterator, input_iterator)
T& at(size_t)
void assign(size_t, T&) except +
void assign(input_iterator, input_iterator) except +
T& at(size_t) except +
T& back()
iterator begin()
const_iterator const_begin "begin"()
......@@ -62,25 +62,25 @@ cdef extern from "<deque>" namespace "std" nogil:
bint empty()
iterator end()
const_iterator const_end "end"()
iterator erase(iterator)
iterator erase(iterator, iterator)
iterator erase(iterator) except +
iterator erase(iterator, iterator) except +
T& front()
iterator insert(iterator, T&)
void insert(iterator, size_t, T&)
void insert(iterator, input_iterator, input_iterator)
iterator insert(iterator, T&) except +
void insert(iterator, size_t, T&) except +
void insert(iterator, input_iterator, input_iterator) except +
size_t max_size()
void pop_back()
void pop_front()
void push_back(T&)
void push_front(T&)
void push_back(T&) except +
void push_front(T&) except +
reverse_iterator rbegin()
#const_reverse_iterator rbegin()
reverse_iterator rend()
#const_reverse_iterator rend()
void resize(size_t)
void resize(size_t, T&)
void resize(size_t) except +
void resize(size_t, T&) except +
size_t size()
void swap(deque&)
# C++11 methods
void shrink_to_fit()
void shrink_to_fit() except +
......@@ -39,7 +39,7 @@ cdef extern from "<list>" namespace "std" nogil:
bint operator>(list&, list&)
bint operator<=(list&, list&)
bint operator>=(list&, list&)
void assign(size_t, T&)
void assign(size_t, T&) except +
T& back()
iterator begin()
const_iterator const_begin "begin"()
......@@ -53,22 +53,22 @@ cdef extern from "<list>" namespace "std" nogil:
iterator insert(iterator, T&)
void insert(iterator, size_t, T&)
size_t max_size()
void merge(list&)
void merge(list&) except +
#void merge(list&, BinPred)
void pop_back()
void pop_front()
void push_back(T&)
void push_front(T&)
void push_back(T&) except +
void push_front(T&) except +
reverse_iterator rbegin()
const_reverse_iterator const_rbegin "rbegin"()
void remove(T&)
void remove(T&) except +
#void remove_if(UnPred)
reverse_iterator rend()
const_reverse_iterator const_rend "rend"()
void resize(size_t, T&)
void resize(size_t, T&) except +
void reverse()
size_t size()
void sort()
void sort() except +
#void sort(BinPred)
void splice(iterator, list&)
void splice(iterator, list&, iterator)
......
......@@ -67,19 +67,19 @@ cdef extern from "<string>" namespace "std" nogil:
iterator erase(iterator first, iterator last)
iterator erase(const_iterator first, const_iterator last)
char& at(size_t)
char& at(size_t) except +
char& operator[](size_t)
char& front() # C++11
char& back() # C++11
int compare(const string&)
string& append(const string&)
string& append(const string&, size_t, size_t)
string& append(const char *)
string& append(const char *, size_t)
string& append(size_t, char)
string& append(const string&) except +
string& append(const string&, size_t, size_t) except +
string& append(const char *) except +
string& append(const char *, size_t) except +
string& append(size_t, char) except +
void push_back(char c)
void push_back(char c) except +
string& assign (const string&)
string& assign (const string&, size_t, size_t)
......@@ -87,15 +87,15 @@ cdef extern from "<string>" namespace "std" nogil:
string& assign (const char *)
string& assign (size_t n, char c)
string& insert(size_t, const string&)
string& insert(size_t, const string&, size_t, size_t)
string& insert(size_t, const char* s, size_t)
string& insert(size_t, const string&) except +
string& insert(size_t, const string&, size_t, size_t) except +
string& insert(size_t, const char* s, size_t) except +
string& insert(size_t, const char* s)
string& insert(size_t, size_t, char c)
string& insert(size_t, const char* s) except +
string& insert(size_t, size_t, char c) except +
size_t copy(char *, size_t, size_t)
size_t copy(char *, size_t, size_t) except +
size_t find(const string&)
size_t find(const string&, size_t)
......@@ -131,9 +131,9 @@ cdef extern from "<string>" namespace "std" nogil:
size_t find_last_not_of(const char* s, size_t, size_t)
size_t find_last_not_of(const char*, size_t pos)
string substr(size_t, size_t)
string substr(size_t, size_t) except +
string substr()
string substr(size_t)
string substr(size_t) except +
size_t find_last_not_of(char c, size_t)
size_t find_last_not_of(char c)
......@@ -142,8 +142,8 @@ cdef extern from "<string>" namespace "std" nogil:
#string& operator= (const char*)
#string& operator= (char)
string operator+ (const string& rhs)
string operator+ (const char* rhs)
string operator+ (const string& rhs) except +
string operator+ (const char* rhs) except +
bint operator==(const string&)
bint operator==(const char*)
......
......@@ -76,7 +76,7 @@ cdef extern from "<vector>" namespace "std" nogil:
const_reverse_iterator const_rbegin "crbegin"()
reverse_iterator rend()
const_reverse_iterator const_rend "crend"()
void reserve(size_type)
void reserve(size_type) except +
void resize(size_type) except +
void resize(size_type, T&) except +
size_type size()
......@@ -85,4 +85,4 @@ cdef extern from "<vector>" namespace "std" nogil:
# C++11 methods
T* data()
const T* const_data "data"()
void shrink_to_fit()
void shrink_to_fit() except +
......@@ -5,8 +5,8 @@
cdef extern from *:
cdef cppclass string "{{type}}":
string()
string(char* c_str, size_t size)
string() except +
string(char* c_str, size_t size) except +
cdef const char* __Pyx_PyObject_AsStringAndSize(object, Py_ssize_t*) except NULL
@cname("{{cname}}")
......@@ -39,7 +39,7 @@ cdef inline object {{cname.replace("PyObject", py_type, 1)}}(const string& s):
cdef extern from *:
cdef cppclass vector "std::vector" [T]:
void push_back(T&)
void push_back(T&) except +
@cname("{{cname}}")
cdef vector[X] {{cname}}(object o) except *:
......@@ -65,7 +65,7 @@ cdef object {{cname}}(vector[X]& v):
cdef extern from *:
cdef cppclass cpp_list "std::list" [T]:
void push_back(T&)
void push_back(T&) except +
@cname("{{cname}}")
cdef cpp_list[X] {{cname}}(object o) except *:
......@@ -102,7 +102,7 @@ cdef object {{cname}}(const cpp_list[X]& v):
cdef extern from *:
cdef cppclass set "std::{{maybe_unordered}}set" [T]:
void insert(T&)
void insert(T&) except +
@cname("{{cname}}")
cdef set[X] {{cname}}(object o) except *:
......@@ -138,8 +138,8 @@ cdef object {{cname}}(const cpp_set[X]& s):
cdef extern from *:
cdef cppclass pair "std::pair" [T, U]:
pair()
pair(T&, U&)
pair() except +
pair(T&, U&) except +
@cname("{{cname}}")
cdef pair[X,Y] {{cname}}(object o) except *:
......@@ -163,9 +163,9 @@ cdef object {{cname}}(const pair[X,Y]& p):
cdef extern from *:
cdef cppclass pair "std::pair" [T, U]:
pair(T&, U&)
pair(T&, U&) except +
cdef cppclass map "std::{{maybe_unordered}}map" [T, U]:
void insert(pair[T, U]&)
void insert(pair[T, U]&) except +
cdef cppclass vector "std::vector" [T]:
pass
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment