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
e568b4d5
Commit
e568b4d5
authored
Sep 01, 2020
by
Tao He
Committed by
GitHub
Sep 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix `return None` in CodeWriter. (GH-3795)
parent
3e37b742
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
Cython/CodeWriter.py
Cython/CodeWriter.py
+4
-2
Cython/Tests/TestCodeWriter.py
Cython/Tests/TestCodeWriter.py
+16
-0
No files found.
Cython/CodeWriter.py
View file @
e568b4d5
...
@@ -449,8 +449,10 @@ class StatementWriter(DeclarationWriter):
...
@@ -449,8 +449,10 @@ class StatementWriter(DeclarationWriter):
self
.
_visit_indented
(
node
.
body
)
self
.
_visit_indented
(
node
.
body
)
def
visit_ReturnStatNode
(
self
,
node
):
def
visit_ReturnStatNode
(
self
,
node
):
self
.
startline
(
"return "
)
self
.
startline
(
"return"
)
self
.
visit
(
node
.
value
)
if
node
.
value
is
not
None
:
self
.
put
(
u" "
)
self
.
visit
(
node
.
value
)
self
.
endline
()
self
.
endline
()
def
visit_ReraiseStatNode
(
self
,
node
):
def
visit_ReraiseStatNode
(
self
,
node
):
...
...
Cython/Tests/TestCodeWriter.py
View file @
e568b4d5
...
@@ -107,6 +107,22 @@ class TestCodeWriter(CythonTest):
...
@@ -107,6 +107,22 @@ class TestCodeWriter(CythonTest):
def
test_attribute
(
self
):
def
test_attribute
(
self
):
self
.
t
(
u"a.x"
)
self
.
t
(
u"a.x"
)
def
test_return_none
(
self
):
self
.
t
(
u"""
def f(x, y, z):
return
cdef f(x, y, z):
return
def f(x, y, z):
return None
cdef f(x, y, z):
return None
def f(x, y, z):
return 1234
cdef f(x, y, z):
return 1234
"""
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
import
unittest
import
unittest
unittest
.
main
()
unittest
.
main
()
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