mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
Make _fields attr for no fields consistent with _attributes attr.
This commit is contained in:
parent
ebc8dedd19
commit
2c55c597fa
3 changed files with 9 additions and 16 deletions
|
@ -465,14 +465,9 @@ static PyTypeObject* make_type(char *type, PyTypeObject* base, char**fields, int
|
|||
{
|
||||
PyObject *fnames, *result;
|
||||
int i;
|
||||
if (num_fields) {
|
||||
fnames = PyTuple_New(num_fields);
|
||||
if (!fnames) return NULL;
|
||||
} else {
|
||||
fnames = Py_None;
|
||||
Py_INCREF(Py_None);
|
||||
}
|
||||
for(i=0; i < num_fields; i++) {
|
||||
fnames = PyTuple_New(num_fields);
|
||||
if (!fnames) return NULL;
|
||||
for (i = 0; i < num_fields; i++) {
|
||||
PyObject *field = PyString_FromString(fields[i]);
|
||||
if (!field) {
|
||||
Py_DECREF(fnames);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue