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
60978085
Commit
60978085
authored
Nov 03, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support exec(cmd,g) as alternative signature for exec(cmd,g,l) in -3 mode
parent
cac2cf22
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
2 deletions
+30
-2
Cython/Compiler/Builtin.py
Cython/Compiler/Builtin.py
+6
-0
Cython/Compiler/Scanning.py
Cython/Compiler/Scanning.py
+5
-2
tests/run/cython3.pyx
tests/run/cython3.pyx
+19
-0
No files found.
Cython/Compiler/Builtin.py
View file @
60978085
...
...
@@ -18,6 +18,7 @@ builtin_function_table = [
(
'dir'
,
"O"
,
"O"
,
"PyObject_Dir"
),
(
'divmod'
,
"OO"
,
"O"
,
"PyNumber_Divmod"
),
(
'exec'
,
"OOO"
,
"O"
,
"__Pyx_PyRun"
),
(
'exec'
,
"OO"
,
"O"
,
"__Pyx_PyRun2"
),
#('eval', "", "", ""),
#('execfile', "", "", ""),
#('filter', "", "", ""),
...
...
@@ -181,8 +182,13 @@ proto = """
#endif
#endif
static PyObject* __Pyx_PyRun(PyObject*, PyObject*, PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyRun2(PyObject*, PyObject*);
"""
,
impl
=
"""
static CYTHON_INLINE PyObject* __Pyx_PyRun2(PyObject* o, PyObject* globals) {
return __Pyx_PyRun(o, globals, NULL);
}
static PyObject* __Pyx_PyRun(PyObject* o, PyObject* globals, PyObject* locals) {
PyObject* result;
PyObject* s = 0;
...
...
Cython/Compiler/Scanning.py
View file @
60978085
...
...
@@ -358,8 +358,11 @@ class PyrexScanner(Scanner):
self
.
error
(
"Unrecognized character"
)
if
sy
==
IDENT
:
if
systring
in
self
.
keywords
:
if
systring
==
'print'
and
\
print_function
in
self
.
context
.
future_directives
:
if
systring
==
'print'
and
print_function
in
self
.
context
.
future_directives
:
self
.
keywords
.
remove
(
'print'
)
systring
=
EncodedString
(
systring
)
elif
systring
==
'exec'
and
self
.
context
.
language_level
>=
3
:
self
.
keywords
.
remove
(
'exec'
)
systring
=
EncodedString
(
systring
)
else
:
sy
=
systring
...
...
tests/run/cython3.pyx
View file @
60978085
...
...
@@ -15,6 +15,25 @@ def print_function(*args):
"""
print
(
*
args
)
# this isn't valid Py2 syntax
def
exec3_function
(
cmd
):
"""
>>> exec3_function('a = 1+1')['a']
2
"""
g
=
{}
l
=
{}
exec
(
cmd
,
g
,
l
)
return
l
def
exec2_function
(
cmd
):
"""
>>> exec2_function('a = 1+1')['a']
2
"""
g
=
{}
exec
(
cmd
,
g
)
return
g
ustring
=
"abcdefg"
def
unicode_literals
():
...
...
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