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
ab2454fe
Commit
ab2454fe
authored
Feb 14, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
report unused variables also across closures
parent
0b657721
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
Cython/Compiler/FlowControl.py
Cython/Compiler/FlowControl.py
+1
-2
tests/errors/w_unused.pyx
tests/errors/w_unused.pyx
+14
-0
No files found.
Cython/Compiler/FlowControl.py
View file @
ab2454fe
...
...
@@ -616,8 +616,7 @@ def check_definitions(flow, compiler_directives):
# Unused entries
for
entry
in
flow
.
entries
:
if
(
not
entry
.
cf_references
and
not
entry
.
is_pyclass_attr
and
not
entry
.
in_closure
):
and
not
entry
.
is_pyclass_attr
):
if
entry
.
name
!=
'_'
:
# '_' is often used for unused variables, e.g. in loops
if
entry
.
is_arg
:
...
...
tests/errors/w_unused.pyx
View file @
ab2454fe
...
...
@@ -38,6 +38,16 @@ def unused_and_unassigned():
def
unused_generic
(
*
args
,
**
kwargs
):
pass
def
unused_in_closure
(
a
,
b
,
c
):
x
=
1
def
inner
():
nonlocal
c
c
=
1
y
=
2
return
a
+
b
return
inner
()
_ERRORS
=
"""
6:6: Unused entry 'a'
9:9: Unused entry 'b'
...
...
@@ -49,4 +59,8 @@ _ERRORS = """
36:13: Unused entry 'i'
38:20: Unused argument 'args'
38:28: Unused argument 'kwargs'
41:26: Unused argument 'c'
41:26: Unused entry 'c'
42:6: Unused entry 'x'
46:10: Unused entry 'y'
"""
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