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
f2dafd13
Commit
f2dafd13
authored
Apr 10, 2022
by
da-woods
Committed by
GitHub
Apr 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use an EncodedString on dataclass types when creating a StringNode (GH-4728)
Closes
https://github.com/cython/cython/issues/4704
parent
18eb280a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
Cython/Compiler/Dataclass.py
Cython/Compiler/Dataclass.py
+1
-1
tests/run/cdef_class_dataclass.pyx
tests/run/cdef_class_dataclass.pyx
+8
-0
No files found.
Cython/Compiler/Dataclass.py
View file @
f2dafd13
...
...
@@ -590,7 +590,7 @@ def get_field_type(pos, entry):
# try to return PyType_Type. This case should only happen with
# attributes defined with cdef so Cython is free to make it's own
# decision
s
=
entry
.
type
.
declaration_code
(
""
,
for_display
=
1
)
s
=
EncodedString
(
entry
.
type
.
declaration_code
(
""
,
for_display
=
1
)
)
return
ExprNodes
.
StringNode
(
pos
,
value
=
s
)
...
...
tests/run/cdef_class_dataclass.pyx
View file @
f2dafd13
...
...
@@ -197,12 +197,20 @@ cdef class TestVisibility:
'double'
>>> hasattr(inst, "c")
True
>>> "d" in TestVisibility.__dataclass_fields__
True
>>> TestVisibility.__dataclass_fields__["d"].type
'object'
>>> hasattr(inst, "d")
True
"""
cdef
double
a
a
=
1.0
b
:
double
=
2.0
cdef
public
double
c
c
=
3.0
cdef
public
object
d
d
=
object
()
@
dataclass
(
frozen
=
True
)
cdef
class
TestFrozen
:
...
...
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