Skip to content

Commit ab0ac27

Browse files
Issue #20315: Removed support for backward compatibility with early 2.x versions.
Removed backward compatibility alias curses.window.nooutrefresh which should be removed in 2.3.
2 parents 679688e + 7e52705 commit ab0ac27

8 files changed

Lines changed: 3 additions & 98 deletions

File tree

Lib/configparser.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -144,23 +144,6 @@
144144
class Error(Exception):
145145
"""Base class for ConfigParser exceptions."""
146146

147-
def _get_message(self):
148-
"""Getter for 'message'; needed only to override deprecation in
149-
BaseException.
150-
"""
151-
return self.__message
152-
153-
def _set_message(self, value):
154-
"""Setter for 'message'; needed only to override deprecation in
155-
BaseException.
156-
"""
157-
self.__message = value
158-
159-
# BaseException.message has been deprecated since Python 2.6. To prevent
160-
# DeprecationWarning from popping up over this pre-existing attribute, use
161-
# a new property that takes lookup precedence.
162-
message = property(_get_message, _set_message)
163-
164147
def __init__(self, msg=''):
165148
self.message = msg
166149
Exception.__init__(self, msg)

Lib/modulefinder.py

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -335,30 +335,6 @@ def _safe_import_hook(self, name, caller, fromlist, level=-1):
335335
fullname = name + "." + sub
336336
self._add_badmodule(fullname, caller)
337337

338-
def scan_opcodes(self, co,
339-
unpack = struct.unpack):
340-
# Scan the code, and yield 'interesting' opcode combinations
341-
# Version for Python 2.4 and older
342-
code = co.co_code
343-
names = co.co_names
344-
consts = co.co_consts
345-
while code:
346-
c = code[0]
347-
if c in STORE_OPS:
348-
oparg, = unpack('<H', code[1:3])
349-
yield "store", (names[oparg],)
350-
code = code[3:]
351-
continue
352-
if c == LOAD_CONST and code[3] == IMPORT_NAME:
353-
oparg_1, oparg_2 = unpack('<xHxH', code[:6])
354-
yield "import", (consts[oparg_1], names[oparg_2])
355-
code = code[6:]
356-
continue
357-
if c >= HAVE_ARGUMENT:
358-
code = code[3:]
359-
else:
360-
code = code[1:]
361-
362338
def scan_opcodes_25(self, co,
363339
unpack = struct.unpack):
364340
# Scan the code, and yield 'interesting' opcode combinations
@@ -390,10 +366,7 @@ def scan_opcodes_25(self, co,
390366

391367
def scan_code(self, co, m):
392368
code = co.co_code
393-
if sys.version_info >= (2, 5):
394-
scanner = self.scan_opcodes_25
395-
else:
396-
scanner = self.scan_opcodes
369+
scanner = self.scan_opcodes_25
397370
for what, args in scanner(co):
398371
if what == "store":
399372
name, = args

Lib/optparse.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -645,14 +645,8 @@ def _check_type(self):
645645
self.type = "string"
646646
else:
647647
# Allow type objects or builtin type conversion functions
648-
# (int, str, etc.) as an alternative to their names. (The
649-
# complicated check of builtins is only necessary for
650-
# Python 2.1 and earlier, and is short-circuited by the
651-
# first check on modern Pythons.)
652-
import builtins
653-
if ( isinstance(self.type, type) or
654-
(hasattr(self.type, "__name__") and
655-
getattr(builtins, self.type.__name__, None) is self.type) ):
648+
# (int, str, etc.) as an alternative to their names.
649+
if isinstance(self.type, type):
656650
self.type = self.type.__name__
657651

658652
if self.type == "str":

Lib/test/_test_multiprocessing.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -695,9 +695,6 @@ def _test_task_done(cls, q):
695695
def test_task_done(self):
696696
queue = self.JoinableQueue()
697697

698-
if sys.version_info < (2, 5) and not hasattr(queue, 'task_done'):
699-
self.skipTest("requires 'queue.task_done()' method")
700-
701698
workers = [self.Process(target=self._test_task_done, args=(queue,))
702699
for i in range(4)]
703700

Modules/_cursesmodule.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2087,8 +2087,6 @@ static PyMethodDef PyCursesWindow_Methods[] = {
20872087
{"nodelay", (PyCFunction)PyCursesWindow_nodelay, METH_VARARGS},
20882088
{"notimeout", (PyCFunction)PyCursesWindow_notimeout, METH_VARARGS},
20892089
{"noutrefresh", (PyCFunction)PyCursesWindow_NoOutRefresh, METH_VARARGS},
2090-
/* Backward compatibility alias -- remove in Python 2.3 */
2091-
{"nooutrefresh", (PyCFunction)PyCursesWindow_NoOutRefresh, METH_VARARGS},
20922090
{"overlay", (PyCFunction)PyCursesWindow_Overlay, METH_VARARGS},
20932091
{"overwrite", (PyCFunction)PyCursesWindow_Overwrite,
20942092
METH_VARARGS},

Modules/_lsprof.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,6 @@ profiler_callback(PyObject *self, PyFrameObject *frame, int what,
451451
PyTrace_RETURN event will be generated, so we don't need to
452452
handle it. */
453453

454-
#ifdef PyTrace_C_CALL /* not defined in Python <= 2.3 */
455454
/* the Python function 'frame' is issuing a call to the built-in
456455
function 'arg' */
457456
case PyTrace_C_CALL:
@@ -473,7 +472,6 @@ profiler_callback(PyObject *self, PyFrameObject *frame, int what,
473472
((PyCFunctionObject *)arg)->m_ml);
474473
}
475474
break;
476-
#endif
477475

478476
default:
479477
break;
@@ -663,13 +661,7 @@ setBuiltins(ProfilerObject *pObj, int nvalue)
663661
if (nvalue == 0)
664662
pObj->flags &= ~POF_BUILTINS;
665663
else if (nvalue > 0) {
666-
#ifndef PyTrace_C_CALL
667-
PyErr_SetString(PyExc_ValueError,
668-
"builtins=True requires Python >= 2.4");
669-
return -1;
670-
#else
671664
pObj->flags |= POF_BUILTINS;
672-
#endif
673665
}
674666
return 0;
675667
}
@@ -767,11 +759,7 @@ profiler_init(ProfilerObject *pObj, PyObject *args, PyObject *kw)
767759
PyObject *timer = NULL;
768760
double timeunit = 0.0;
769761
int subcalls = 1;
770-
#ifdef PyTrace_C_CALL
771762
int builtins = 1;
772-
#else
773-
int builtins = 0;
774-
#endif
775763
static char *kwlist[] = {"timer", "timeunit",
776764
"subcalls", "builtins", 0};
777765

Modules/_tkinter.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,6 @@ Copyright (C) 1994 Steen Lumholt.
3333
#include <windows.h>
3434
#endif
3535

36-
/* Allow using this code in Python 2.[12] */
37-
#ifndef PyDoc_STRVAR
38-
#define PyDoc_STRVAR(name,str) static char name[] = str
39-
#endif
40-
41-
#ifndef PyMODINIT_FUNC
42-
#define PyMODINIT_FUNC void
43-
#endif
44-
45-
#ifndef PyBool_Check
46-
#define PyBool_Check(o) 0
47-
#define PyBool_FromLong PyLong_FromLong
48-
#endif
49-
5036
#define CHECK_SIZE(size, elemsize) \
5137
((size_t)(size) <= Py_MAX((size_t)INT_MAX, UINT_MAX / (size_t)(elemsize)))
5238

Modules/gcmodule.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,13 +1693,6 @@ PyObject_GC_Track(void *op)
16931693
_PyObject_GC_TRACK(op);
16941694
}
16951695

1696-
/* for binary compatibility with 2.2 */
1697-
void
1698-
_PyObject_GC_Track(PyObject *op)
1699-
{
1700-
PyObject_GC_Track(op);
1701-
}
1702-
17031696
void
17041697
PyObject_GC_UnTrack(void *op)
17051698
{
@@ -1710,13 +1703,6 @@ PyObject_GC_UnTrack(void *op)
17101703
_PyObject_GC_UNTRACK(op);
17111704
}
17121705

1713-
/* for binary compatibility with 2.2 */
1714-
void
1715-
_PyObject_GC_UnTrack(PyObject *op)
1716-
{
1717-
PyObject_GC_UnTrack(op);
1718-
}
1719-
17201706
PyObject *
17211707
_PyObject_GC_Malloc(size_t basicsize)
17221708
{

0 commit comments

Comments
 (0)