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
b1a30915
Commit
b1a30915
authored
Mar 18, 2019
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid building control flow GV graph if it's not requested.
parent
08e22bb4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
Cython/Compiler/FlowControl.py
Cython/Compiler/FlowControl.py
+5
-7
No files found.
Cython/Compiler/FlowControl.py
View file @
b1a30915
...
@@ -673,7 +673,8 @@ class AssignmentCollector(TreeVisitor):
...
@@ -673,7 +673,8 @@ class AssignmentCollector(TreeVisitor):
class
ControlFlowAnalysis
(
CythonTransform
):
class
ControlFlowAnalysis
(
CythonTransform
):
def
visit_ModuleNode
(
self
,
node
):
def
visit_ModuleNode
(
self
,
node
):
self
.
gv_ctx
=
GVContext
()
dot_output
=
self
.
current_directives
[
'control_flow.dot_output'
]
self
.
gv_ctx
=
GVContext
()
if
dot_output
else
None
self
.
constant_folder
=
ConstantFolding
()
self
.
constant_folder
=
ConstantFolding
()
# Set of NameNode reductions
# Set of NameNode reductions
...
@@ -689,14 +690,10 @@ class ControlFlowAnalysis(CythonTransform):
...
@@ -689,14 +690,10 @@ class ControlFlowAnalysis(CythonTransform):
check_definitions
(
self
.
flow
,
self
.
current_directives
)
check_definitions
(
self
.
flow
,
self
.
current_directives
)
dot_output
=
self
.
current_directives
[
'control_flow.dot_output'
]
if
dot_output
:
if
dot_output
:
annotate_defs
=
self
.
current_directives
[
'control_flow.dot_annotate_defs'
]
annotate_defs
=
self
.
current_directives
[
'control_flow.dot_annotate_defs'
]
fp
=
open
(
dot_output
,
'wt'
)
with
open
(
dot_output
,
'wt'
)
as
fp
:
try
:
self
.
gv_ctx
.
render
(
fp
,
'module'
,
annotate_defs
=
annotate_defs
)
self
.
gv_ctx
.
render
(
fp
,
'module'
,
annotate_defs
=
annotate_defs
)
finally
:
fp
.
close
()
return
node
return
node
def
visit_FuncDefNode
(
self
,
node
):
def
visit_FuncDefNode
(
self
,
node
):
...
@@ -744,7 +741,8 @@ class ControlFlowAnalysis(CythonTransform):
...
@@ -744,7 +741,8 @@ class ControlFlowAnalysis(CythonTransform):
check_definitions
(
self
.
flow
,
self
.
current_directives
)
check_definitions
(
self
.
flow
,
self
.
current_directives
)
self
.
flow
.
blocks
.
add
(
self
.
flow
.
entry_point
)
self
.
flow
.
blocks
.
add
(
self
.
flow
.
entry_point
)
self
.
gv_ctx
.
add
(
GV
(
node
.
local_scope
.
name
,
self
.
flow
))
if
self
.
gv_ctx
is
not
None
:
self
.
gv_ctx
.
add
(
GV
(
node
.
local_scope
.
name
,
self
.
flow
))
self
.
flow
=
self
.
stack
.
pop
()
self
.
flow
=
self
.
stack
.
pop
()
self
.
env
=
self
.
env_stack
.
pop
()
self
.
env
=
self
.
env_stack
.
pop
()
...
...
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