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
c5da19ce
Commit
c5da19ce
authored
May 18, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make imported names encoded strings to fix attribute access on them
parent
a0b45f26
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+4
-3
No files found.
Cython/Compiler/Parsing.py
View file @
c5da19ce
...
@@ -261,7 +261,7 @@ def p_trailer(s, node1):
...
@@ -261,7 +261,7 @@ def p_trailer(s, node1):
return
p_index
(
s
,
node1
)
return
p_index
(
s
,
node1
)
else
:
# s.sy == '.'
else
:
# s.sy == '.'
s
.
next
()
s
.
next
()
name
=
p_ident
(
s
)
name
=
Utils
.
EncodedString
(
p_ident
(
s
)
)
return
ExprNodes
.
AttributeNode
(
pos
,
return
ExprNodes
.
AttributeNode
(
pos
,
obj
=
node1
,
attribute
=
name
)
obj
=
node1
,
attribute
=
name
)
...
@@ -469,7 +469,7 @@ def p_atom(s):
...
@@ -469,7 +469,7 @@ def p_atom(s):
else
:
else
:
return
ExprNodes
.
StringNode
(
pos
,
value
=
value
)
return
ExprNodes
.
StringNode
(
pos
,
value
=
value
)
elif
sy
==
'IDENT'
:
elif
sy
==
'IDENT'
:
name
=
s
.
systring
name
=
Utils
.
EncodedString
(
s
.
systring
)
s
.
next
()
s
.
next
()
if
name
==
"None"
:
if
name
==
"None"
:
return
ExprNodes
.
NoneNode
(
pos
)
return
ExprNodes
.
NoneNode
(
pos
)
...
@@ -911,6 +911,7 @@ def p_import_statement(s):
...
@@ -911,6 +911,7 @@ def p_import_statement(s):
items
.
append
(
p_dotted_name
(
s
,
as_allowed
=
1
))
items
.
append
(
p_dotted_name
(
s
,
as_allowed
=
1
))
stats
=
[]
stats
=
[]
for
pos
,
target_name
,
dotted_name
,
as_name
in
items
:
for
pos
,
target_name
,
dotted_name
,
as_name
in
items
:
dotted_name
=
Utils
.
EncodedString
(
dotted_name
)
if
kind
==
'cimport'
:
if
kind
==
'cimport'
:
stat
=
Nodes
.
CImportStatNode
(
pos
,
stat
=
Nodes
.
CImportStatNode
(
pos
,
module_name
=
dotted_name
,
module_name
=
dotted_name
,
...
@@ -921,7 +922,6 @@ def p_import_statement(s):
...
@@ -921,7 +922,6 @@ def p_import_statement(s):
ExprNodes
.
StringNode
(
pos
,
value
=
Utils
.
EncodedString
(
"*"
))])
ExprNodes
.
StringNode
(
pos
,
value
=
Utils
.
EncodedString
(
"*"
))])
else
:
else
:
name_list
=
None
name_list
=
None
dotted_name
=
Utils
.
EncodedString
(
dotted_name
)
stat
=
Nodes
.
SingleAssignmentNode
(
pos
,
stat
=
Nodes
.
SingleAssignmentNode
(
pos
,
lhs
=
ExprNodes
.
NameNode
(
pos
,
lhs
=
ExprNodes
.
NameNode
(
pos
,
name
=
as_name
or
target_name
),
name
=
as_name
or
target_name
),
...
@@ -949,6 +949,7 @@ def p_from_import_statement(s, first_statement = 0):
...
@@ -949,6 +949,7 @@ def p_from_import_statement(s, first_statement = 0):
while
s
.
sy
==
','
:
while
s
.
sy
==
','
:
s
.
next
()
s
.
next
()
imported_names
.
append
(
p_imported_name
(
s
))
imported_names
.
append
(
p_imported_name
(
s
))
dotted_name
=
Utils
.
EncodedString
(
dotted_name
)
if
dotted_name
==
'__future__'
:
if
dotted_name
==
'__future__'
:
if
not
first_statement
:
if
not
first_statement
:
s
.
error
(
"from __future__ imports must occur at the beginning of the file"
)
s
.
error
(
"from __future__ imports must occur at the beginning of the file"
)
...
...
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