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
Gwenaël Samain
cython
Commits
d0627fcb
Commit
d0627fcb
authored
May 23, 2013
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add error_on_uninitialized option and disable it for pyregr testsuite
parent
9b4eb5fd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
2 deletions
+13
-2
Cython/Compiler/FlowControl.py
Cython/Compiler/FlowControl.py
+3
-1
Cython/Compiler/Options.py
Cython/Compiler/Options.py
+6
-0
runtests.py
runtests.py
+4
-1
No files found.
Cython/Compiler/FlowControl.py
View file @
d0627fcb
...
...
@@ -9,6 +9,7 @@ cython.declare(PyrexTypes=object, ExprNodes=object, Nodes=object,
import
Builtin
import
ExprNodes
import
Nodes
import
Options
from
PyrexTypes
import
py_object_type
,
unspecified_type
import
PyrexTypes
...
...
@@ -574,7 +575,8 @@ def check_definitions(flow, compiler_directives):
if
node
.
allow_null
or
entry
.
from_closure
or
entry
.
is_pyclass_attr
:
pass
# Can be uninitialized here
elif
node
.
cf_is_null
:
if
(
entry
.
type
.
is_pyobject
or
entry
.
type
.
is_unspecified
or
if
Options
.
error_on_uninitialized
and
(
entry
.
type
.
is_pyobject
or
entry
.
type
.
is_unspecified
or
entry
.
error_on_uninitialized
):
messages
.
error
(
node
.
pos
,
...
...
Cython/Compiler/Options.py
View file @
d0627fcb
...
...
@@ -34,6 +34,12 @@ warning_errors = False
# you should disable this option and also 'cache_builtins'.
error_on_unknown_names
=
True
# Make uninitialized local variable reference a compile time error.
# Python raises UnboundLocalError at runtime, whereas this option makes
# them a compile time error. Note that this option affects only variables
# of "python object" type.
error_on_uninitialized
=
True
# This will convert statements of the form "for i in range(...)"
# to "for i from ..." when i is a cdef'd integer type, and the direction
# (i.e. sign of step) can be determined.
...
...
runtests.py
View file @
d0627fcb
...
...
@@ -520,7 +520,9 @@ class CythonCompileTestCase(unittest.TestCase):
def setUp(self):
from Cython.Compiler import Options
self._saved_options = [ (name, getattr(Options, name))
for name in ('warning_errors', 'error_on_unknown_names') ]
for name in ('warning_errors',
'error_on_unknown_names',
'error_on_uninitialized') ]
self._saved_default_directives = Options.directive_defaults.items()
Options.warning_errors = self.warning_errors
...
...
@@ -989,6 +991,7 @@ class CythonPyregrTestCase(CythonRunTestCase):
CythonRunTestCase.setUp(self)
from Cython.Compiler import Options
Options.error_on_unknown_names = False
Options.error_on_uninitialized = False
Options.directive_defaults.update(dict(
binding=True, always_allow_keywords=True,
set_initial_path="
SOURCEFILE
"))
...
...
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