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
9a59133d
Commit
9a59133d
authored
Mar 22, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove some legacy Py2.[345] code
parent
a4893ddb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
41 deletions
+20
-41
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+4
-10
Cython/Compiler/Tests/TestParseTreeTransforms.py
Cython/Compiler/Tests/TestParseTreeTransforms.py
+3
-4
Cython/Compiler/TreePath.py
Cython/Compiler/TreePath.py
+4
-11
Cython/Tests/xmlrunner.py
Cython/Tests/xmlrunner.py
+4
-7
Cython/Utils.py
Cython/Utils.py
+5
-9
No files found.
Cython/Compiler/ExprNodes.py
View file @
9a59133d
...
@@ -3715,12 +3715,6 @@ class IndexNode(ExprNode):
...
@@ -3715,12 +3715,6 @@ class IndexNode(ExprNode):
buffer_entry
=
self
.
buffer_entry
()
buffer_entry
=
self
.
buffer_entry
()
have_gil
=
not
self
.
in_nogil_context
have_gil
=
not
self
.
in_nogil_context
if
sys
.
version_info
<
(
3
,):
def
next_
(
it
):
return
it
.
next
()
else
:
next_
=
next
have_slices
=
False
have_slices
=
False
it
=
iter
(
self
.
indices
)
it
=
iter
(
self
.
indices
)
for
index
in
self
.
original_indices
:
for
index
in
self
.
original_indices
:
...
@@ -3728,13 +3722,13 @@ class IndexNode(ExprNode):
...
@@ -3728,13 +3722,13 @@ class IndexNode(ExprNode):
have_slices
=
have_slices
or
is_slice
have_slices
=
have_slices
or
is_slice
if
is_slice
:
if
is_slice
:
if
not
index
.
start
.
is_none
:
if
not
index
.
start
.
is_none
:
index
.
start
=
next
_
(
it
)
index
.
start
=
next
(
it
)
if
not
index
.
stop
.
is_none
:
if
not
index
.
stop
.
is_none
:
index
.
stop
=
next
_
(
it
)
index
.
stop
=
next
(
it
)
if
not
index
.
step
.
is_none
:
if
not
index
.
step
.
is_none
:
index
.
step
=
next
_
(
it
)
index
.
step
=
next
(
it
)
else
:
else
:
next
_
(
it
)
next
(
it
)
assert
not
list
(
it
)
assert
not
list
(
it
)
...
...
Cython/Compiler/Tests/TestParseTreeTransforms.py
View file @
9a59133d
import
os
import
os
from
Cython.Compiler
import
CmdLine
from
Cython.TestUtils
import
TransformTest
from
Cython.TestUtils
import
TransformTest
from
Cython.Compiler.ParseTreeTransforms
import
*
from
Cython.Compiler.ParseTreeTransforms
import
*
from
Cython.Compiler.Nodes
import
*
from
Cython.Compiler.Nodes
import
*
...
@@ -203,18 +202,18 @@ class TestInterpretCompilerDirectives(TransformTest):
...
@@ -203,18 +202,18 @@ class TestInterpretCompilerDirectives(TransformTest):
# TODO: Re-enable once they're more robust.
# TODO: Re-enable once they're more robust.
if
sys
.
version_info
[:
2
]
>=
(
2
,
5
)
and
False
:
if
False
:
from
Cython.Debugger
import
DebugWriter
from
Cython.Debugger
import
DebugWriter
from
Cython.Debugger.Tests.TestLibCython
import
DebuggerTestCase
from
Cython.Debugger.Tests.TestLibCython
import
DebuggerTestCase
else
:
else
:
# skip test, don't let it inherit unittest.TestCase
# skip test, don't let it inherit unittest.TestCase
DebuggerTestCase
=
object
DebuggerTestCase
=
object
class
TestDebugTransform
(
DebuggerTestCase
):
class
TestDebugTransform
(
DebuggerTestCase
):
def
elem_hasattrs
(
self
,
elem
,
attrs
):
def
elem_hasattrs
(
self
,
elem
,
attrs
):
# we shall supporteth python 2.3 !
return
all
(
attr
in
elem
.
attrib
for
attr
in
attrs
)
return
all
([
attr
in
elem
.
attrib
for
attr
in
attrs
])
def
test_debug_info
(
self
):
def
test_debug_info
(
self
):
try
:
try
:
...
...
Cython/Compiler/TreePath.py
View file @
9a59133d
...
@@ -7,7 +7,7 @@ specific descendant or a node that holds an attribute.
...
@@ -7,7 +7,7 @@ specific descendant or a node that holds an attribute.
"""
"""
import
re
import
re
import
sys
import
operator
path_tokenizer
=
re
.
compile
(
path_tokenizer
=
re
.
compile
(
"("
"("
...
@@ -132,6 +132,7 @@ def handle_descendants(next, token):
...
@@ -132,6 +132,7 @@ def handle_descendants(next, token):
return select
return select
def handle_attribute(next, token):
def handle_attribute(next, token):
token = next()
token = next()
if token[0]:
if token[0]:
...
@@ -145,16 +146,7 @@ def handle_attribute(next, token):
...
@@ -145,16 +146,7 @@ def handle_attribute(next, token):
else:
else:
if token[0] == '=':
if token[0] == '=':
value = parse_path_value(next)
value = parse_path_value(next)
if sys.version_info >= (2,6) or (sys.version_info >= (2,4) and '.' not in name):
readattr = operator.attrgetter(name)
import operator
readattr = operator.attrgetter(name)
else:
name_path = name.split('.')
def readattr(node):
attr_value = node
for attr in name_path:
attr_value = getattr(attr_value, attr)
return attr_value
if value is None:
if value is None:
def select(result):
def select(result):
for node in result:
for node in result:
...
@@ -175,6 +167,7 @@ def handle_attribute(next, token):
...
@@ -175,6 +167,7 @@ def handle_attribute(next, token):
yield attr_value
yield attr_value
return select
return select
def parse_path_value(next):
def parse_path_value(next):
token = next()
token = next()
value = token[0]
value = token[0]
...
...
Cython/Tests/xmlrunner.py
View file @
9a59133d
...
@@ -86,11 +86,8 @@ class _TestInfo(object):
...
@@ -86,11 +86,8 @@ class _TestInfo(object):
"""
"""
if
not
self
.
err
:
if
not
self
.
err
:
return
''
return
''
if
sys
.
version_info
<
(
2
,
4
):
return
self
.
test_result
.
_exc_info_to_string
(
return
self
.
test_result
.
_exc_info_to_string
(
self
.
err
)
self
.
err
,
self
.
test_method
)
else
:
return
self
.
test_result
.
_exc_info_to_string
(
self
.
err
,
self
.
test_method
)
class
_XMLTestResult
(
_TextTestResult
):
class
_XMLTestResult
(
_TextTestResult
):
...
@@ -98,8 +95,8 @@ class _XMLTestResult(_TextTestResult):
...
@@ -98,8 +95,8 @@ class _XMLTestResult(_TextTestResult):
Used by XMLTestRunner.
Used by XMLTestRunner.
"""
"""
def
__init__
(
self
,
stream
=
sys
.
stderr
,
descriptions
=
1
,
verbosity
=
1
,
\
def
__init__
(
self
,
stream
=
sys
.
stderr
,
descriptions
=
1
,
verbosity
=
1
,
elapsed_times
=
True
):
elapsed_times
=
True
):
"Create a new instance of _XMLTestResult."
"Create a new instance of _XMLTestResult."
_TextTestResult
.
__init__
(
self
,
stream
,
descriptions
,
verbosity
)
_TextTestResult
.
__init__
(
self
,
stream
,
descriptions
,
verbosity
)
self
.
successes
=
[]
self
.
successes
=
[]
...
...
Cython/Utils.py
View file @
9a59133d
...
@@ -3,7 +3,11 @@
...
@@ -3,7 +3,11 @@
# anywhere else in particular
# anywhere else in particular
#
#
import
os
,
sys
,
re
,
codecs
import
os
import
sys
import
re
import
io
import
codecs
modification_time
=
os
.
path
.
getmtime
modification_time
=
os
.
path
.
getmtime
...
@@ -268,14 +272,6 @@ class NormalisedNewlineStream(object):
...
@@ -268,14 +272,6 @@ class NormalisedNewlineStream(object):
raise
NotImplementedError
raise
NotImplementedError
io
=
None
if
sys
.
version_info
>=
(
2
,
6
):
try
:
import
io
except
ImportError
:
pass
def
open_source_file
(
source_filename
,
mode
=
"r"
,
def
open_source_file
(
source_filename
,
mode
=
"r"
,
encoding
=
None
,
error_handling
=
None
,
encoding
=
None
,
error_handling
=
None
,
require_normalised_newlines
=
True
):
require_normalised_newlines
=
True
):
...
...
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