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
ca393626
Commit
ca393626
authored
May 25, 2011
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some code style issues
parent
106812c1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
18 deletions
+18
-18
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+8
-2
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+8
-10
Cython/Distutils/build_ext.py
Cython/Distutils/build_ext.py
+2
-6
No files found.
Cython/Compiler/Optimize.py
View file @
ca393626
...
@@ -3069,10 +3069,16 @@ class ConstantFolding(Visitor.VisitorTransform, SkipDeclarations):
...
@@ -3069,10 +3069,16 @@ class ConstantFolding(Visitor.VisitorTransform, SkipDeclarations):
into a single node.
into a single node.
"""
"""
check_constant_value_not_set
=
True
def
__init__
(
self
,
reevaluate
=
False
):
"""
The reevaluate argument specifies whether constant values that were
previously computed should be recomputed.
"""
super
(
ConstantFolding
,
self
).
__init__
()
self
.
reevaluate
=
reevaluate
def
_calculate_const
(
self
,
node
):
def
_calculate_const
(
self
,
node
):
if
(
self
.
check_constant_value_not_set
and
if
(
not
self
.
reevaluate
and
node
.
constant_result
is
not
ExprNodes
.
constant_value_not_set
):
node
.
constant_result
is
not
ExprNodes
.
constant_value_not_set
):
return
return
...
...
Cython/Compiler/ParseTreeTransforms.py
View file @
ca393626
...
@@ -2350,9 +2350,7 @@ class ReplaceFusedTypeChecks(VisitorTransform):
...
@@ -2350,9 +2350,7 @@ class ReplaceFusedTypeChecks(VisitorTransform):
# Defer the import until now to avoid circularity...
# Defer the import until now to avoid circularity...
from
Cython.Compiler
import
Optimize
from
Cython.Compiler
import
Optimize
transform
=
Optimize
.
ConstantFolding
(
reevaluate
=
True
)
transform
=
Optimize
.
ConstantFolding
()
transform
.
check_constant_value_not_set
=
False
def
__init__
(
self
,
local_scope
):
def
__init__
(
self
,
local_scope
):
super
(
ReplaceFusedTypeChecks
,
self
).
__init__
()
super
(
ReplaceFusedTypeChecks
,
self
).
__init__
()
...
@@ -2371,8 +2369,8 @@ class ReplaceFusedTypeChecks(VisitorTransform):
...
@@ -2371,8 +2369,8 @@ class ReplaceFusedTypeChecks(VisitorTransform):
type2
=
node
.
operand2
.
analyse_as_type
(
self
.
local_scope
)
type2
=
node
.
operand2
.
analyse_as_type
(
self
.
local_scope
)
if
type1
and
type2
:
if
type1
and
type2
:
false
=
ExprNodes
.
BoolNode
(
node
.
pos
,
value
=
False
)
false
_node
=
ExprNodes
.
BoolNode
(
node
.
pos
,
value
=
False
)
true
=
ExprNodes
.
BoolNode
(
node
.
pos
,
value
=
True
)
true
_node
=
ExprNodes
.
BoolNode
(
node
.
pos
,
value
=
True
)
type1
=
self
.
specialize_type
(
type1
,
node
.
operand1
.
pos
)
type1
=
self
.
specialize_type
(
type1
,
node
.
operand1
.
pos
)
op
=
node
.
operator
op
=
node
.
operator
...
@@ -2384,7 +2382,7 @@ class ReplaceFusedTypeChecks(VisitorTransform):
...
@@ -2384,7 +2382,7 @@ class ReplaceFusedTypeChecks(VisitorTransform):
eq
=
op
in
(
'is'
,
'=='
)
eq
=
op
in
(
'is'
,
'=='
)
if
(
is_same
and
eq
)
or
(
not
is_same
and
not
eq
):
if
(
is_same
and
eq
)
or
(
not
is_same
and
not
eq
):
return
true
return
true
_node
elif
op
in
(
'in'
,
'not_in'
):
elif
op
in
(
'in'
,
'not_in'
):
# We have to do an instance check directly, as operand2
# We have to do an instance check directly, as operand2
...
@@ -2404,14 +2402,14 @@ class ReplaceFusedTypeChecks(VisitorTransform):
...
@@ -2404,14 +2402,14 @@ class ReplaceFusedTypeChecks(VisitorTransform):
for
specific_type
in
types
:
for
specific_type
in
types
:
if
type1
.
same_as
(
specific_type
):
if
type1
.
same_as
(
specific_type
):
if
op
==
'in'
:
if
op
==
'in'
:
return
true
return
true
_node
else
:
else
:
return
false
return
false
_node
if
op
==
'not_in'
:
if
op
==
'not_in'
:
return
true
return
true
_node
return
false
return
false
_node
return
node
return
node
...
...
Cython/Distutils/build_ext.py
View file @
ca393626
...
@@ -19,10 +19,6 @@ from distutils.dir_util import mkpath
...
@@ -19,10 +19,6 @@ from distutils.dir_util import mkpath
from
distutils.command
import
build_ext
as
_build_ext
from
distutils.command
import
build_ext
as
_build_ext
from
distutils
import
sysconfig
from
distutils
import
sysconfig
if
sys
.
version_info
<
(
3
,
0
):
from
Cython.Utils
import
any
extension_name_re
=
_build_ext
.
extension_name_re
extension_name_re
=
_build_ext
.
extension_name_re
show_compilers
=
_build_ext
.
show_compilers
show_compilers
=
_build_ext
.
show_compilers
...
@@ -122,8 +118,8 @@ class build_ext(_build_ext.build_ext):
...
@@ -122,8 +118,8 @@ class build_ext(_build_ext.build_ext):
# If --pyrex-gdb is in effect as a command line option or as option
# If --pyrex-gdb is in effect as a command line option or as option
# of any Extension module, disable optimization for the C or C++
# of any Extension module, disable optimization for the C or C++
# compiler.
# compiler.
if
(
self
.
pyrex_gdb
or
any
([
getattr
(
ext
,
'pyrex_gdb'
,
False
)
if
self
.
pyrex_gdb
or
[
1
for
ext
in
self
.
extensions
for
ext
in
self
.
extensions
]))
:
if
getattr
(
ext
,
'pyrex_gdb'
,
False
)]
:
optimization
.
disable_optimization
()
optimization
.
disable_optimization
()
_build_ext
.
build_ext
.
run
(
self
)
_build_ext
.
build_ext
.
run
(
self
)
...
...
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