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
Gwenaël Samain
cython
Commits
5cffd806
Commit
5cffd806
authored
Feb 09, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve error message on failing exec()
parent
6af1821f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
Cython/Utility/Builtins.c
Cython/Utility/Builtins.c
+3
-2
tests/run/exectest.pyx
tests/run/exectest.pyx
+8
-0
No files found.
Cython/Utility/Builtins.c
View file @
5cffd806
...
...
@@ -140,8 +140,9 @@ static PyObject* __Pyx_PyExec3(PyObject* o, PyObject* globals, PyObject* locals)
#else
}
else
if
(
!
PyString_Check
(
o
))
{
#endif
PyErr_SetString
(
PyExc_TypeError
,
"exec: arg 1 must be string, bytes or code object"
);
PyErr_Format
(
PyExc_TypeError
,
"exec: arg 1 must be string, bytes or code object, got %.200s"
,
Py_TYPE
(
o
)
->
tp_name
);
goto
bad
;
}
#if PY_MAJOR_VERSION >= 3
...
...
tests/run/exectest.pyx
View file @
5cffd806
...
...
@@ -113,3 +113,11 @@ def test_encoding_unicode(d1, d2):
def
test_compile
(
d
):
c
=
compile
(
u"b = a+c"
,
u"<string>"
,
u"exec"
)
exec
c
in
d
def
exec_invalid_type
(
x
):
"""
>>> exec_invalid_type(42)
Traceback (most recent call last):
TypeError: exec: arg 1 must be string, bytes or code object, got int
"""
exec
x
in
{}
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