Issue #11135: Remove redundant doc field from PyType_Spec.

Reviewed by Georg Brandl.
This commit is contained in:
Martin v. Löwis 2011-02-11 20:47:49 +00:00
parent dafdd7f8ca
commit 6916806443
4 changed files with 7 additions and 9 deletions

View File

@ -396,7 +396,6 @@ typedef struct{
typedef struct{ typedef struct{
const char* name; const char* name;
const char* doc;
int basicsize; int basicsize;
int itemsize; int itemsize;
int flags; int flags;

View File

@ -10,6 +10,8 @@ What's New in Python 3.2?
Core and Builtins Core and Builtins
----------------- -----------------
- Issue #11135: Remove redundant doc field from PyType_Spec.
- Issue #11067: Add PyType_GetFlags, to support PyUnicode_Check - Issue #11067: Add PyType_GetFlags, to support PyUnicode_Check
in the limited ABI. in the limited ABI.

View File

@ -101,6 +101,7 @@ Xxo_setattr(XxoObject *self, char *name, PyObject *v)
} }
static PyType_Slot Xxo_Type_slots[] = { static PyType_Slot Xxo_Type_slots[] = {
{Py_tp_doc, "The Xxo type"},
{Py_tp_dealloc, Xxo_dealloc}, {Py_tp_dealloc, Xxo_dealloc},
{Py_tp_getattro, Xxo_getattro}, {Py_tp_getattro, Xxo_getattro},
{Py_tp_setattr, Xxo_setattr}, {Py_tp_setattr, Xxo_setattr},
@ -109,8 +110,7 @@ static PyType_Slot Xxo_Type_slots[] = {
}; };
static PyType_Spec Xxo_Type_spec = { static PyType_Spec Xxo_Type_spec = {
"xxmodule.Xxo", "xxlimited.Xxo",
NULL,
sizeof(XxoObject), sizeof(XxoObject),
0, 0,
Py_TPFLAGS_DEFAULT, Py_TPFLAGS_DEFAULT,
@ -178,7 +178,6 @@ static PyType_Spec Str_Type_spec = {
"xxlimited.Str", "xxlimited.Str",
0, 0,
0, 0,
0,
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
Str_Type_slots Str_Type_slots
}; };
@ -201,7 +200,6 @@ static PyType_Slot Null_Type_slots[] = {
static PyType_Spec Null_Type_spec = { static PyType_Spec Null_Type_spec = {
"xxlimited.Null", "xxlimited.Null",
NULL, /* doc */
0, /* basicsize */ 0, /* basicsize */
0, /* itemsize */ 0, /* itemsize */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
@ -230,7 +228,7 @@ PyDoc_STRVAR(module_doc,
static struct PyModuleDef xxmodule = { static struct PyModuleDef xxmodule = {
PyModuleDef_HEAD_INIT, PyModuleDef_HEAD_INIT,
"xx", "xxlimited",
module_doc, module_doc,
-1, -1,
xx_methods, xx_methods,
@ -264,7 +262,7 @@ PyInit_xxlimited(void)
/* Add some symbolic constants to the module */ /* Add some symbolic constants to the module */
if (ErrorObject == NULL) { if (ErrorObject == NULL) {
ErrorObject = PyErr_NewException("xx.error", NULL, NULL); ErrorObject = PyErr_NewException("xxlimited.error", NULL, NULL);
if (ErrorObject == NULL) if (ErrorObject == NULL)
goto fail; goto fail;
} }

View File

@ -162,7 +162,7 @@ def make_slots(name, fields):
res = [] res = []
res.append('static PyType_Slot %s_slots[] = {' % name) res.append('static PyType_Slot %s_slots[] = {' % name)
# defaults for spec # defaults for spec
spec = { 'tp_doc':'NULL', 'tp_itemsize':'0' } spec = { 'tp_itemsize':'0' }
for i, val in enumerate(fields): for i, val in enumerate(fields):
if val.endswith('0'): if val.endswith('0'):
continue continue
@ -174,7 +174,6 @@ def make_slots(name, fields):
res.append('};') res.append('};')
res.append('static PyType_Spec %s_spec = {' % name) res.append('static PyType_Spec %s_spec = {' % name)
res.append(' %s,' % spec['tp_name']) res.append(' %s,' % spec['tp_name'])
res.append(' %s,' % spec['tp_doc'])
res.append(' %s,' % spec['tp_basicsize']) res.append(' %s,' % spec['tp_basicsize'])
res.append(' %s,' % spec['tp_itemsize']) res.append(' %s,' % spec['tp_itemsize'])
res.append(' %s,' % spec['tp_flags']) res.append(' %s,' % spec['tp_flags'])