mirror of https://github.com/python/cpython.git
Merge changes from r22a2-branch back into trunk. Also, change patch
level to 2.2a2+
This commit is contained in:
parent
0f10f84028
commit
60f018846d
|
@ -23,10 +23,10 @@
|
|||
#define PY_MINOR_VERSION 2
|
||||
#define PY_MICRO_VERSION 0
|
||||
#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA
|
||||
#define PY_RELEASE_SERIAL 1
|
||||
#define PY_RELEASE_SERIAL 2
|
||||
|
||||
/* Version as a string */
|
||||
#define PY_VERSION "2.2a1+"
|
||||
#define PY_VERSION "2.2a2+"
|
||||
|
||||
/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
|
||||
Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
import unittest
|
||||
import warnings
|
||||
|
||||
warnings.filterwarnings("ignore", "tempnam", RuntimeWarning, __name__)
|
||||
warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning, __name__)
|
||||
|
||||
from test_support import TESTFN, run_unittest
|
||||
|
||||
|
||||
|
|
|
@ -98,6 +98,7 @@ PYTHONPATH=$(COREPYTHONPATH)
|
|||
|
||||
posix posixmodule.c # posix (UNIX) system calls
|
||||
_sre _sre.c # Fredrik Lundh's new regular expressions
|
||||
new newmodule.c # Tommy Burnette's 'new' module
|
||||
|
||||
# The rest of the modules listed in this file are all commented out by
|
||||
# default. Usually they can be detected and built as dynamically
|
||||
|
@ -347,11 +348,6 @@ GLHACK=-Dclear=__GLclear
|
|||
#_curses_panel _curses_panel.c -lpanel -lncurses
|
||||
|
||||
|
||||
# Tommy Burnette's 'new' module (creates new empty objects of certain kinds):
|
||||
|
||||
#new newmodule.c
|
||||
|
||||
|
||||
# Generic (SunOS / SVR4) dynamic loading module.
|
||||
# This is not needed for dynamic loading of Python modules --
|
||||
# it is a highly experimental and dangerous device for calling
|
||||
|
|
|
@ -2091,29 +2091,52 @@ static struct wrapperbase tab_init[] = {
|
|||
static PyObject *
|
||||
tp_new_wrapper(PyObject *self, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
PyTypeObject *type, *subtype;
|
||||
PyTypeObject *type, *subtype, *staticbase;
|
||||
PyObject *arg0, *res;
|
||||
|
||||
if (self == NULL || !PyType_Check(self))
|
||||
Py_FatalError("__new__() called with non-type 'self'");
|
||||
type = (PyTypeObject *)self;
|
||||
if (!PyTuple_Check(args) || PyTuple_GET_SIZE(args) < 1) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"T.__new__(): not enough arguments");
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"%s.__new__(): not enough arguments",
|
||||
type->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
arg0 = PyTuple_GET_ITEM(args, 0);
|
||||
if (!PyType_Check(arg0)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"T.__new__(S): S is not a type object");
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"%s.__new__(X): X is not a type object (%s)",
|
||||
type->tp_name,
|
||||
arg0->ob_type->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
subtype = (PyTypeObject *)arg0;
|
||||
if (!PyType_IsSubtype(subtype, type)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"T.__new__(S): S is not a subtype of T");
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"%s.__new__(%s): %s is not a subtype of %s",
|
||||
type->tp_name,
|
||||
subtype->tp_name,
|
||||
subtype->tp_name,
|
||||
type->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Check that the use doesn't do something silly and unsafe like
|
||||
object.__new__(dictionary). To do this, we check that the
|
||||
most derived base that's not a heap type is this type. */
|
||||
staticbase = subtype;
|
||||
while (staticbase && (staticbase->tp_flags & Py_TPFLAGS_HEAPTYPE))
|
||||
staticbase = staticbase->tp_base;
|
||||
if (staticbase != type) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"%s.__new__(%s) is not safe, use %s.__new__()",
|
||||
type->tp_name,
|
||||
subtype->tp_name,
|
||||
staticbase == NULL ? "?" : staticbase->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
args = PyTuple_GetSlice(args, 1, PyTuple_GET_SIZE(args));
|
||||
if (args == NULL)
|
||||
return NULL;
|
||||
|
|
4
setup.py
4
setup.py
|
@ -269,10 +269,6 @@ def detect_modules(self):
|
|||
# (NIST's Secure Hash Algorithm.)
|
||||
exts.append( Extension('sha', ['shamodule.c']) )
|
||||
|
||||
# Tommy Burnette's 'new' module (creates new empty objects of certain
|
||||
# kinds):
|
||||
exts.append( Extension('new', ['newmodule.c']) )
|
||||
|
||||
# Helper module for various ascii-encoders
|
||||
exts.append( Extension('binascii', ['binascii.c']) )
|
||||
|
||||
|
|
Loading…
Reference in New Issue