Commit 08e17af0 authored by Lars Buitinck's avatar Lars Buitinck

remove leftover 2.5 compatibility code

parent 77c43a1d
......@@ -403,10 +403,6 @@ static PyGetSetDef __pyx_CyFunction_getsets[] = {
{0, 0, 0, 0, 0}
};
#ifndef PY_WRITE_RESTRICTED /* < Py2.5 */
#define PY_WRITE_RESTRICTED WRITE_RESTRICTED
#endif
static PyMemberDef __pyx_CyFunction_members[] = {
{(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
{0, 0, 0, 0, 0}
......
......@@ -107,7 +107,7 @@ Numeric conversions
+-----------------------+---------------------------------------+-------------+-----------------------------------------------------+
| __hex__ | self | object | Convert to hexadecimal |
+-----------------------+---------------------------------------+-------------+-----------------------------------------------------+
| __index__ (2.5+ only) | self | object | Convert to sequence index |
| __index__ | self | object | Convert to sequence index |
+-----------------------+---------------------------------------+-------------+-----------------------------------------------------+
In-place arithmetic operators
......
......@@ -8,7 +8,7 @@ Debugging your Cython program
Cython comes with an extension for the GNU Debugger that helps users debug
Cython code. To use this functionality, you will need to install gdb 7.2 or
higher, built with Python support (linked to Python 2.5 or higher).
higher, built with Python support (linked to Python 2.6 or higher).
The debugger supports debuggees with versions 2.6 and higher. For Python 3,
code should be built with Python 3 and the debugger should be run with
Python 2 (or at least it should be able to find the Python 2 Cython
......
......@@ -292,24 +292,6 @@ def _is_py3_before_32(excluded, version):
VER_DEP_MODULES = {
# tests are excluded if 'CurrentPythonVersion OP VersionTuple', i.e.
# (2,4) : (operator.lt, ...) excludes ... when PyVer < 2.4.x
(2,4) : (operator.lt, lambda x: x in ['run.extern_builtins_T258',
'run.builtin_sorted',
'run.reversed_iteration',
]),
(2,5) : (operator.lt, lambda x: x in ['run.any',
'run.all',
'run.yield_from_pep380', # GeneratorExit
'run.generator_frame_cycle', # yield in try-finally
'run.generator_expressions_in_class',
'run.absolute_import',
'run.relativeimport_T542',
'run.relativeimport_star_T542',
'run.initial_file_path', # relative import
'run.pynumber_subtype_conversion', # bug in Py2.4
'build.cythonize_script', # python2.4 -m a.b.c
'build.cythonize_script_excludes', # python2.4 -m a.b.c
'build.cythonize_script_package', # python2.4 -m a.b.c
]),
(2,6) : (operator.lt, lambda x: x in ['run.print_function',
'run.language_level', # print function
'run.cython3',
......
......@@ -6,11 +6,8 @@ except ImportError:
import os
import sys
try:
import platform
is_cpython = not hasattr(platform, 'python_implementation') or platform.python_implementation() == 'CPython'
except (ImportError, NameError):
is_cpython = True # CPython < 2.6
import platform
is_cpython = platform.python_implementation() == 'CPython'
if sys.platform == "darwin":
# Don't create resource files on OS X tar.
......
# mode: run
# tag: generators
try:
from builtins import next # Py3k
except ImportError:
def next(it):
return it.next()
if hasattr(__builtins__, 'GeneratorExit'):
GeneratorExit = __builtins__.GeneratorExit
else: # < 2.5
GeneratorExit = StopIteration
def very_simple():
"""
>>> x = very_simple()
......
# mode: run
# tag: portability
# test some C-API functions that Cython replaces for portability reasons
from cpython.number cimport PyNumber_Index, PyIndex_Check
def number_index(x):
"""
>>> number_index(1)
1
>>> try: number_index(1.1)
... except TypeError: pass
... else: print("FAILED")
>>> try: number_index(1j)
... except TypeError: pass
... else: print("FAILED")
>>> try: number_index('abc')
... except TypeError: pass
... else: print("FAILED")
"""
# was not available in Py2.4
return PyNumber_Index(x)
def index_check(x):
"""
>>> index_check(1)
True
>>> index_check(1.1)
False
>>> index_check(1j)
False
>>> index_check('abc')
False
"""
# was not available in Py2.4
return PyIndex_Check(x)
......@@ -9,11 +9,6 @@ see <http://www.cosc.canterbury.ac.nz/greg.ewing/python/yield-from/YieldFrom-Pyt
import sys
try:
_next = next # not in Py<=2.5
except NameError:
def _next(it):
return it.next()
def _lines(trace):
for line in trace:
......@@ -1018,7 +1013,7 @@ def yield_in_return(x):
>>> x = yield_in_return(range(3))
>>> for _ in range(10):
... try:
... print(_next(x))
... print(next(x))
... except StopIteration:
... if sys.version_info >= (3,3):
... print(sys.exc_info()[1].value is None)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment