Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
b510608e
Commit
b510608e
authored
Jun 29, 2011
by
Lars Buitinck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Translate std::bad_alloc to MemoryError
parent
91a18881
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
0 deletions
+3
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
b510608e
...
...
@@ -8226,6 +8226,8 @@ static void __Pyx_CppExn2PyErr() {
// equivalent Python errors.
// Change invalid_argument to ValueError
PyErr_SetString(PyExc_ValueError, exn.what());
} catch (const std::bad_alloc& exn) {
PyErr_SetString(PyExc_MemoryError, exn.what());
} catch (const std::out_of_range& exn) {
// Change out_of_range to IndexError
PyErr_SetString(PyExc_IndexError, exn.what());
...
...
Cython/Compiler/Nodes.py
View file @
b510608e
...
...
@@ -577,6 +577,7 @@ class CFuncDeclaratorNode(CDeclaratorNode):
exc_val
=
None
exc_check
=
0
if
self
.
exception_check
==
'+'
:
env
.
add_include_file
(
'new'
)
# for std::bad_alloc
env
.
add_include_file
(
'stdexcept'
)
if
return_type
.
is_pyobject
\
and
(
self
.
exception_value
or
self
.
exception_check
)
\
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment