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
Kirill Smelkov
cython
Commits
a22a4487
Commit
a22a4487
authored
Aug 21, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix struct handling in Py3
parent
893efcd0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+3
-2
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+10
-1
No files found.
Cython/Compiler/ExprNodes.py
View file @
a22a4487
...
...
@@ -3528,9 +3528,10 @@ class DictNode(ExprNode):
error
(
item
.
key
.
pos
,
"Invalid struct field identifier"
)
item
.
key
=
IdentifierStringNode
(
item
.
key
.
pos
,
value
=
"<error>"
)
else
:
member
=
dst_type
.
scope
.
lookup_here
(
item
.
key
.
value
)
key
=
str
(
item
.
key
.
value
)
# converts string literals to unicode in Py3
member
=
dst_type
.
scope
.
lookup_here
(
key
)
if
not
member
:
error
(
item
.
key
.
pos
,
"struct '%s' has no field '%s'"
%
(
dst_type
,
item
.
key
.
value
))
error
(
item
.
key
.
pos
,
"struct '%s' has no field '%s'"
%
(
dst_type
,
key
))
else
:
value
=
item
.
value
if
isinstance
(
value
,
CoerceToPyTypeNode
):
...
...
Cython/Compiler/PyrexTypes.py
View file @
a22a4487
...
...
@@ -1358,7 +1358,8 @@ class CStructOrUnionType(CType):
def
__eq__
(
self
,
other
):
try
:
return
self
.
name
==
other
.
name
return
(
isinstance
(
other
,
CStructOrUnionType
)
and
self
.
name
==
other
.
name
)
except
AttributeError
:
return
False
...
...
@@ -1370,6 +1371,14 @@ class CStructOrUnionType(CType):
# *some* kind of order
return
False
def
__hash__
(
self
):
try
:
return
self
.
__hashval
except
AttributeError
:
hashval
=
self
.
__hashval
=
hash
(
self
.
cname
)
^
(
sum
([
hash
(
field
.
name
)
for
field
in
self
.
scope
.
var_entries
])
%
0xffff
)
return
hashval
def
is_complete
(
self
):
return
self
.
scope
is
not
None
...
...
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