Remove PEP 291 compatibility requirements for ctypes and modulefinder
https://mail.python.org/pipermail/python-dev/2016-May/144502.html
diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py
index 77b020a..e24cfd2 100644
--- a/Lib/ctypes/__init__.py
+++ b/Lib/ctypes/__init__.py
@@ -1,6 +1,3 @@
-######################################################################
-# This file should be kept compatible with Python 2.3, see PEP 291. #
-######################################################################
"""create and manipulate C data types in Python"""
import os as _os, sys as _sys
diff --git a/Lib/ctypes/_endian.py b/Lib/ctypes/_endian.py
index f80e675..c0ba646 100644
--- a/Lib/ctypes/_endian.py
+++ b/Lib/ctypes/_endian.py
@@ -1,6 +1,3 @@
-######################################################################
-# This file should be kept compatible with Python 2.3, see PEP 291. #
-######################################################################
import sys
from ctypes import *
diff --git a/Lib/ctypes/macholib/__init__.py b/Lib/ctypes/macholib/__init__.py
index 36149d2..5621def 100644
--- a/Lib/ctypes/macholib/__init__.py
+++ b/Lib/ctypes/macholib/__init__.py
@@ -1,6 +1,3 @@
-######################################################################
-# This file should be kept compatible with Python 2.3, see PEP 291. #
-######################################################################
"""
Enough Mach-O to make your head spin.
diff --git a/Lib/ctypes/macholib/dyld.py b/Lib/ctypes/macholib/dyld.py
index 9714ec6..1fdf8d6 100644
--- a/Lib/ctypes/macholib/dyld.py
+++ b/Lib/ctypes/macholib/dyld.py
@@ -1,6 +1,3 @@
-######################################################################
-# This file should be kept compatible with Python 2.3, see PEP 291. #
-######################################################################
"""
dyld emulation
"""
diff --git a/Lib/ctypes/macholib/dylib.py b/Lib/ctypes/macholib/dylib.py
index ea3dd38..aa10750 100644
--- a/Lib/ctypes/macholib/dylib.py
+++ b/Lib/ctypes/macholib/dylib.py
@@ -1,6 +1,3 @@
-######################################################################
-# This file should be kept compatible with Python 2.3, see PEP 291. #
-######################################################################
"""
Generic dylib path manipulation
"""
diff --git a/Lib/ctypes/macholib/framework.py b/Lib/ctypes/macholib/framework.py
index dd7fb2f..ad6ed55 100644
--- a/Lib/ctypes/macholib/framework.py
+++ b/Lib/ctypes/macholib/framework.py
@@ -1,6 +1,3 @@
-######################################################################
-# This file should be kept compatible with Python 2.3, see PEP 291. #
-######################################################################
"""
Generic framework path manipulation
"""
diff --git a/Lib/ctypes/test/test_structures.py b/Lib/ctypes/test/test_structures.py
index 2fa42bd..f983a6b 100644
--- a/Lib/ctypes/test/test_structures.py
+++ b/Lib/ctypes/test/test_structures.py
@@ -326,6 +326,7 @@
"(Phone) <type 'exceptions.TypeError'>: "
"expected string or Unicode object, int found")
else:
+ # Compatibility no longer strictly required
self.assertEqual(msg,
"(Phone) exceptions.TypeError: "
"expected string or Unicode object, int found")
diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
index 929a29c..bf1b6a0 100644
--- a/Lib/ctypes/util.py
+++ b/Lib/ctypes/util.py
@@ -1,6 +1,3 @@
-######################################################################
-# This file should be kept compatible with Python 2.3, see PEP 291. #
-######################################################################
import sys, os
# find_library(name) returns the pathname of a library, or None.
diff --git a/Lib/ctypes/wintypes.py b/Lib/ctypes/wintypes.py
index dafbb78..e7f569c 100644
--- a/Lib/ctypes/wintypes.py
+++ b/Lib/ctypes/wintypes.py
@@ -1,7 +1,3 @@
-######################################################################
-# This file should be kept compatible with Python 2.3, see PEP 291. #
-######################################################################
-
# The most useful windows datatypes
from ctypes import *
diff --git a/Lib/modulefinder.py b/Lib/modulefinder.py
index 2ffd448..e2fee41 100644
--- a/Lib/modulefinder.py
+++ b/Lib/modulefinder.py
@@ -1,5 +1,4 @@
"""Find modules used by a script, using introspection."""
-# This module should be kept compatible with Python 2.2, see PEP 291.
from __future__ import generators
import dis
@@ -13,7 +12,7 @@
if hasattr(sys.__stdout__, "newlines"):
READ_MODE = "U" # universal line endings
else:
- # remain compatible with Python < 2.3
+ # Python < 2.3 compatibility, no longer strictly required
READ_MODE = "r"
LOAD_CONST = dis.opmap['LOAD_CONST']
diff --git a/Misc/NEWS b/Misc/NEWS
index 025fa3e..b1a1d28 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -77,6 +77,9 @@
Library
-------
+- Removed the requirements for the ctypes and modulefinder modules to be
+ compatible with earlier Python versions.
+
- Issue #22274: In the subprocess module, allow stderr to be redirected to
stdout even when stdout is not redirected. Patch by Akira Li.
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index fe79b08..9baf4b3 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -1,5 +1,6 @@
/*****************************************************************
- This file should be kept compatible with Python 2.3, see PEP 291.
+ This file contains remnant Python 2.3 compatibility code that is no longer
+ strictly required.
*****************************************************************/
diff --git a/Modules/_ctypes/_ctypes_test.c b/Modules/_ctypes/_ctypes_test.c
index a52f650..57628b8 100644
--- a/Modules/_ctypes/_ctypes_test.c
+++ b/Modules/_ctypes/_ctypes_test.c
@@ -1,12 +1,7 @@
-/*****************************************************************
- This file should be kept compatible with Python 2.3, see PEP 291.
- *****************************************************************/
-
-
#include <Python.h>
/*
- Backwards compatibility:
+ Backwards compatibility, no longer strictly required:
Python2.2 used LONG_LONG instead of PY_LONG_LONG
*/
#if defined(HAVE_LONG_LONG) && !defined(PY_LONG_LONG)
diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c
index 47dbe05..b1e85ce 100644
--- a/Modules/_ctypes/callbacks.c
+++ b/Modules/_ctypes/callbacks.c
@@ -1,5 +1,6 @@
/*****************************************************************
- This file should be kept compatible with Python 2.3, see PEP 291.
+ This file contains remnant Python 2.3 compatibility code that is no longer
+ strictly required.
*****************************************************************/
#include "Python.h"
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index 7007b7c..280a315 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -1,5 +1,6 @@
/*****************************************************************
- This file should be kept compatible with Python 2.3, see PEP 291.
+ This file contains remnant Python 2.3 compatibility code that is no longer
+ strictly required.
*****************************************************************/
diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c
index 85b5ad2..0585ed2 100644
--- a/Modules/_ctypes/cfield.c
+++ b/Modules/_ctypes/cfield.c
@@ -1,5 +1,6 @@
/*****************************************************************
- This file should be kept compatible with Python 2.3, see PEP 291.
+ This file contains remnant Python 2.3 compatibility code that is no longer
+ strictly required.
*****************************************************************/
#include "Python.h"
diff --git a/Modules/_ctypes/ctypes.h b/Modules/_ctypes/ctypes.h
index b88cf4f..a61ce5f 100644
--- a/Modules/_ctypes/ctypes.h
+++ b/Modules/_ctypes/ctypes.h
@@ -1,5 +1,6 @@
/*****************************************************************
- This file should be kept compatible with Python 2.3, see PEP 291.
+ This file contains remnant Python 2.3 compatibility code that is no longer
+ strictly required.
*****************************************************************/
#if defined (__SVR4) && defined (__sun)
diff --git a/Modules/_ctypes/ctypes_dlfcn.h b/Modules/_ctypes/ctypes_dlfcn.h
index d8bf904..54cdde9 100644
--- a/Modules/_ctypes/ctypes_dlfcn.h
+++ b/Modules/_ctypes/ctypes_dlfcn.h
@@ -1,7 +1,3 @@
-/*****************************************************************
- This file should be kept compatible with Python 2.3, see PEP 291.
- *****************************************************************/
-
#ifndef _CTYPES_DLFCN_H_
#define _CTYPES_DLFCN_H_
diff --git a/Modules/_ctypes/malloc_closure.c b/Modules/_ctypes/malloc_closure.c
index b98d43b..248c6a6 100644
--- a/Modules/_ctypes/malloc_closure.c
+++ b/Modules/_ctypes/malloc_closure.c
@@ -1,7 +1,3 @@
-/*****************************************************************
- This file should be kept compatible with Python 2.3, see PEP 291.
- *****************************************************************/
-
#include <Python.h>
#include <ffi.h>
#ifdef MS_WIN32
diff --git a/Modules/_ctypes/stgdict.c b/Modules/_ctypes/stgdict.c
index 17b9760..31528af 100644
--- a/Modules/_ctypes/stgdict.c
+++ b/Modules/_ctypes/stgdict.c
@@ -1,7 +1,3 @@
-/*****************************************************************
- This file should be kept compatible with Python 2.3, see PEP 291.
- *****************************************************************/
-
#include "Python.h"
#include <ffi.h>
#ifdef MS_WIN32
@@ -449,6 +445,7 @@
Py_DECREF(pair);
PyErr_Format(PyExc_TypeError,
#if (PY_VERSION_HEX < 0x02050000)
+ /* Compatibility no longer strictly required */
"second item in _fields_ tuple (index %d) must be a C type",
#else
"second item in _fields_ tuple (index %zd) must be a C type",