Remove PEP 291 compatibility requirements for ctypes and modulefinder

https://mail.python.org/pipermail/python-dev/2016-May/144502.html
This commit is contained in:
Martin Panter 2016-05-14 07:25:37 +00:00
parent 0e1c5f7dae
commit f45c1755c3
20 changed files with 17 additions and 50 deletions

View File

@ -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""" """create and manipulate C data types in Python"""
import os as _os, sys as _sys import os as _os, sys as _sys

View File

@ -1,6 +1,3 @@
######################################################################
# This file should be kept compatible with Python 2.3, see PEP 291. #
######################################################################
import sys import sys
from ctypes import * from ctypes import *

View File

@ -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. Enough Mach-O to make your head spin.

View File

@ -1,6 +1,3 @@
######################################################################
# This file should be kept compatible with Python 2.3, see PEP 291. #
######################################################################
""" """
dyld emulation dyld emulation
""" """

View File

@ -1,6 +1,3 @@
######################################################################
# This file should be kept compatible with Python 2.3, see PEP 291. #
######################################################################
""" """
Generic dylib path manipulation Generic dylib path manipulation
""" """

View File

@ -1,6 +1,3 @@
######################################################################
# This file should be kept compatible with Python 2.3, see PEP 291. #
######################################################################
""" """
Generic framework path manipulation Generic framework path manipulation
""" """

View File

@ -326,6 +326,7 @@ class StructureTestCase(unittest.TestCase):
"(Phone) <type 'exceptions.TypeError'>: " "(Phone) <type 'exceptions.TypeError'>: "
"expected string or Unicode object, int found") "expected string or Unicode object, int found")
else: else:
# Compatibility no longer strictly required
self.assertEqual(msg, self.assertEqual(msg,
"(Phone) exceptions.TypeError: " "(Phone) exceptions.TypeError: "
"expected string or Unicode object, int found") "expected string or Unicode object, int found")

View File

@ -1,6 +1,3 @@
######################################################################
# This file should be kept compatible with Python 2.3, see PEP 291. #
######################################################################
import sys, os import sys, os
# find_library(name) returns the pathname of a library, or None. # find_library(name) returns the pathname of a library, or None.

View File

@ -1,7 +1,3 @@
######################################################################
# This file should be kept compatible with Python 2.3, see PEP 291. #
######################################################################
# The most useful windows datatypes # The most useful windows datatypes
from ctypes import * from ctypes import *

View File

@ -1,5 +1,4 @@
"""Find modules used by a script, using introspection.""" """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 from __future__ import generators
import dis import dis
@ -13,7 +12,7 @@ import struct
if hasattr(sys.__stdout__, "newlines"): if hasattr(sys.__stdout__, "newlines"):
READ_MODE = "U" # universal line endings READ_MODE = "U" # universal line endings
else: else:
# remain compatible with Python < 2.3 # Python < 2.3 compatibility, no longer strictly required
READ_MODE = "r" READ_MODE = "r"
LOAD_CONST = dis.opmap['LOAD_CONST'] LOAD_CONST = dis.opmap['LOAD_CONST']

View File

@ -77,6 +77,9 @@ Core and Builtins
Library 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 - Issue #22274: In the subprocess module, allow stderr to be redirected to
stdout even when stdout is not redirected. Patch by Akira Li. stdout even when stdout is not redirected. Patch by Akira Li.

View File

@ -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.
*****************************************************************/ *****************************************************************/

View File

@ -1,12 +1,7 @@
/*****************************************************************
This file should be kept compatible with Python 2.3, see PEP 291.
*****************************************************************/
#include <Python.h> #include <Python.h>
/* /*
Backwards compatibility: Backwards compatibility, no longer strictly required:
Python2.2 used LONG_LONG instead of PY_LONG_LONG Python2.2 used LONG_LONG instead of PY_LONG_LONG
*/ */
#if defined(HAVE_LONG_LONG) && !defined(PY_LONG_LONG) #if defined(HAVE_LONG_LONG) && !defined(PY_LONG_LONG)

View File

@ -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" #include "Python.h"

View File

@ -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.
*****************************************************************/ *****************************************************************/

View File

@ -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" #include "Python.h"

View File

@ -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) #if defined (__SVR4) && defined (__sun)

View File

@ -1,7 +1,3 @@
/*****************************************************************
This file should be kept compatible with Python 2.3, see PEP 291.
*****************************************************************/
#ifndef _CTYPES_DLFCN_H_ #ifndef _CTYPES_DLFCN_H_
#define _CTYPES_DLFCN_H_ #define _CTYPES_DLFCN_H_

View File

@ -1,7 +1,3 @@
/*****************************************************************
This file should be kept compatible with Python 2.3, see PEP 291.
*****************************************************************/
#include <Python.h> #include <Python.h>
#include <ffi.h> #include <ffi.h>
#ifdef MS_WIN32 #ifdef MS_WIN32

View File

@ -1,7 +1,3 @@
/*****************************************************************
This file should be kept compatible with Python 2.3, see PEP 291.
*****************************************************************/
#include "Python.h" #include "Python.h"
#include <ffi.h> #include <ffi.h>
#ifdef MS_WIN32 #ifdef MS_WIN32
@ -449,6 +445,7 @@ PyCStructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct
Py_DECREF(pair); Py_DECREF(pair);
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
#if (PY_VERSION_HEX < 0x02050000) #if (PY_VERSION_HEX < 0x02050000)
/* Compatibility no longer strictly required */
"second item in _fields_ tuple (index %d) must be a C type", "second item in _fields_ tuple (index %d) must be a C type",
#else #else
"second item in _fields_ tuple (index %zd) must be a C type", "second item in _fields_ tuple (index %zd) must be a C type",