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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
951baff4
Commit
951baff4
authored
Dec 09, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
b5f87b17
21dbe229
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
16 deletions
+26
-16
Cython/Compiler/Builtin.py
Cython/Compiler/Builtin.py
+1
-1
Cython/Compiler/Code.pxd
Cython/Compiler/Code.pxd
+10
-3
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+2
-0
Cython/Compiler/Parsing.pxd
Cython/Compiler/Parsing.pxd
+1
-1
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+12
-11
No files found.
Cython/Compiler/Builtin.py
View file @
951baff4
...
@@ -123,7 +123,7 @@ static PyObject* __Pyx_PyRun(PyObject* o, PyObject* globals, PyObject* locals) {
...
@@ -123,7 +123,7 @@ static PyObject* __Pyx_PyRun(PyObject* o, PyObject* globals, PyObject* locals) {
"code object passed to exec() may not contain free variables");
"code object passed to exec() may not contain free variables");
goto bad;
goto bad;
}
}
#if PY_VERSION_HEX < 0x030200
A4
#if PY_VERSION_HEX < 0x030200
B1
result = PyEval_EvalCode((PyCodeObject *)o, globals, locals);
result = PyEval_EvalCode((PyCodeObject *)o, globals, locals);
#else
#else
result = PyEval_EvalCode(o, globals, locals);
result = PyEval_EvalCode(o, globals, locals);
...
...
Cython/Compiler/Code.pxd
View file @
951baff4
cimport
cython
cdef
class
UtilityCode
:
cdef
class
UtilityCode
:
cdef
public
object
proto
cdef
public
object
proto
cdef
public
object
impl
cdef
public
object
impl
...
@@ -9,14 +11,14 @@ cdef class UtilityCode:
...
@@ -9,14 +11,14 @@ cdef class UtilityCode:
cdef
public
list
specialize_list
cdef
public
list
specialize_list
cdef
public
object
proto_block
cdef
public
object
proto_block
cpdef
put_code
(
self
,
dict
output
)
cpdef
put_code
(
self
,
output
)
cdef
class
FunctionState
:
cdef
class
FunctionState
:
cdef
public
set
names_taken
cdef
public
set
names_taken
cdef
public
object
owner
cdef
public
object
owner
cdef
public
object
error_label
cdef
public
object
error_label
cdef
public
Py_s
size_t
label_counter
cdef
public
size_t
label_counter
cdef
public
set
labels_used
cdef
public
set
labels_used
cdef
public
object
return_label
cdef
public
object
return_label
cdef
public
object
continue_label
cdef
public
object
continue_label
...
@@ -30,8 +32,10 @@ cdef class FunctionState:
...
@@ -30,8 +32,10 @@ cdef class FunctionState:
cdef
public
list
temps_allocated
cdef
public
list
temps_allocated
cdef
public
dict
temps_free
cdef
public
dict
temps_free
cdef
public
dict
temps_used_type
cdef
public
dict
temps_used_type
cdef
public
Py_s
size_t
temp_counter
cdef
public
size_t
temp_counter
@
cython
.
locals
(
n
=
size_t
)
cpdef
new_label
(
self
,
name
=*
)
cpdef
tuple
get_loop_labels
(
self
)
cpdef
tuple
get_loop_labels
(
self
)
cpdef
set_loop_labels
(
self
,
labels
)
cpdef
set_loop_labels
(
self
,
labels
)
cpdef
tuple
get_all_labels
(
self
)
cpdef
tuple
get_all_labels
(
self
)
...
@@ -54,6 +58,9 @@ cdef class StringConst:
...
@@ -54,6 +58,9 @@ cdef class StringConst:
cdef
public
object
escaped_value
cdef
public
object
escaped_value
cdef
public
dict
py_strings
cdef
public
dict
py_strings
@
cython
.
locals
(
intern
=
bint
,
is_str
=
bint
,
is_unicode
=
bint
)
cpdef
get_py_string_const
(
self
,
encoding
,
identifier
=*
,
is_str
=*
)
## cdef class PyStringConst:
## cdef class PyStringConst:
## cdef public object cname
## cdef public object cname
## cdef public object encoding
## cdef public object encoding
...
...
Cython/Compiler/Code.py
View file @
951baff4
...
@@ -293,6 +293,8 @@ class PyObjectConst(object):
...
@@ -293,6 +293,8 @@ class PyObjectConst(object):
self
.
cname
=
cname
self
.
cname
=
cname
self
.
type
=
type
self
.
type
=
type
cython
.
declare
(
possible_unicode_identifier
=
object
,
possible_bytes_identifier
=
object
,
nice_identifier
=
object
,
find_alphanums
=
object
)
possible_unicode_identifier
=
re
.
compile
(
ur"(?![0-9])\
w+$
", re.U).match
possible_unicode_identifier
=
re
.
compile
(
ur"(?![0-9])\
w+$
", re.U).match
possible_bytes_identifier = re.compile(r"
(
?!
[
0
-
9
])
\
w
+
$
".encode('ASCII')).match
possible_bytes_identifier = re.compile(r"
(
?!
[
0
-
9
])
\
w
+
$
".encode('ASCII')).match
nice_identifier = re.compile(r'
\
A[
a
-zA-Z0-9_]+
\
Z
'
).match
nice_identifier = re.compile(r'
\
A[
a
-zA-Z0-9_]+
\
Z
'
).match
...
...
Cython/Compiler/Parsing.pxd
View file @
951baff4
...
@@ -104,7 +104,7 @@ cdef p_if_clause(PyrexScanner s)
...
@@ -104,7 +104,7 @@ cdef p_if_clause(PyrexScanner s)
cdef
p_else_clause
(
PyrexScanner
s
)
cdef
p_else_clause
(
PyrexScanner
s
)
cdef
p_while_statement
(
PyrexScanner
s
)
cdef
p_while_statement
(
PyrexScanner
s
)
cdef
p_for_statement
(
PyrexScanner
s
)
cdef
p_for_statement
(
PyrexScanner
s
)
cpdef
p_for_bounds
(
PyrexScanner
s
,
bint
allow_testlist
=
*
)
cpdef
dict
p_for_bounds
(
PyrexScanner
s
,
bint
allow_testlist
=
*
)
cdef
p_for_from_relation
(
PyrexScanner
s
)
cdef
p_for_from_relation
(
PyrexScanner
s
)
cdef
p_for_from_step
(
PyrexScanner
s
)
cdef
p_for_from_step
(
PyrexScanner
s
)
cdef
p_target
(
PyrexScanner
s
,
terminator
)
cdef
p_target
(
PyrexScanner
s
,
terminator
)
...
...
Cython/Compiler/Parsing.py
View file @
951baff4
...
@@ -877,8 +877,7 @@ def p_comp_for(s, body):
...
@@ -877,8 +877,7 @@ def p_comp_for(s, body):
pos
=
s
.
position
()
pos
=
s
.
position
()
s
.
next
()
s
.
next
()
kw
=
p_for_bounds
(
s
,
allow_testlist
=
False
)
kw
=
p_for_bounds
(
s
,
allow_testlist
=
False
)
kw
[
'else_clause'
]
=
None
kw
.
update
(
dict
(
else_clause
=
None
,
body
=
p_comp_iter
(
s
,
body
)))
kw
[
'body'
]
=
p_comp_iter
(
s
,
body
)
return
Nodes
.
ForStatNode
(
pos
,
**
kw
)
return
Nodes
.
ForStatNode
(
pos
,
**
kw
)
def
p_comp_if
(
s
,
body
):
def
p_comp_if
(
s
,
body
):
...
@@ -1372,8 +1371,9 @@ def p_for_statement(s):
...
@@ -1372,8 +1371,9 @@ def p_for_statement(s):
pos
=
s
.
position
()
pos
=
s
.
position
()
s
.
next
()
s
.
next
()
kw
=
p_for_bounds
(
s
,
allow_testlist
=
True
)
kw
=
p_for_bounds
(
s
,
allow_testlist
=
True
)
kw
[
'body'
]
=
p_suite
(
s
)
body
=
p_suite
(
s
)
kw
[
'else_clause'
]
=
p_else_clause
(
s
)
else_clause
=
p_else_clause
(
s
)
kw
.
update
(
dict
(
body
=
body
,
else_clause
=
else_clause
))
return
Nodes
.
ForStatNode
(
pos
,
**
kw
)
return
Nodes
.
ForStatNode
(
pos
,
**
kw
)
def
p_for_bounds
(
s
,
allow_testlist
=
True
):
def
p_for_bounds
(
s
,
allow_testlist
=
True
):
...
@@ -1381,7 +1381,7 @@ def p_for_bounds(s, allow_testlist=True):
...
@@ -1381,7 +1381,7 @@ def p_for_bounds(s, allow_testlist=True):
if
s
.
sy
==
'in'
:
if
s
.
sy
==
'in'
:
s
.
next
()
s
.
next
()
iterator
=
p_for_iterator
(
s
,
allow_testlist
)
iterator
=
p_for_iterator
(
s
,
allow_testlist
)
return
{
'target'
:
target
,
'iterator'
:
iterator
}
return
dict
(
target
=
target
,
iterator
=
iterator
)
elif
not
s
.
in_python_file
:
elif
not
s
.
in_python_file
:
if
s
.
sy
==
'from'
:
if
s
.
sy
==
'from'
:
s
.
next
()
s
.
next
()
...
@@ -1408,12 +1408,13 @@ def p_for_bounds(s, allow_testlist=True):
...
@@ -1408,12 +1408,13 @@ def p_for_bounds(s, allow_testlist=True):
if
rel1
[
0
]
!=
rel2
[
0
]:
if
rel1
[
0
]
!=
rel2
[
0
]:
error
(
rel2_pos
,
error
(
rel2_pos
,
"Relation directions in for-from do not match"
)
"Relation directions in for-from do not match"
)
return
{
'target'
:
target
,
return
dict
(
target
=
target
,
'bound1'
:
bound1
,
bound1
=
bound1
,
'relation1'
:
rel1
,
relation1
=
rel1
,
'relation2'
:
rel2
,
relation2
=
rel2
,
'bound2'
:
bound2
,
bound2
=
bound2
,
'step'
:
step
}
step
=
step
,
)
else
:
else
:
s
.
expect
(
'in'
)
s
.
expect
(
'in'
)
return
{}
return
{}
...
...
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