mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
SF #1693079: Cannot save empty array in shelve
This commit is contained in:
parent
5447850f6f
commit
e6e660bde3
2 changed files with 28 additions and 6 deletions
|
@ -1147,12 +1147,19 @@ array_reduce(arrayobject *array)
|
|||
dict = Py_None;
|
||||
Py_INCREF(dict);
|
||||
}
|
||||
result = Py_BuildValue("O(cs#)O",
|
||||
array->ob_type,
|
||||
array->ob_descr->typecode,
|
||||
array->ob_item,
|
||||
array->ob_size * array->ob_descr->itemsize,
|
||||
dict);
|
||||
if (array->ob_size > 0) {
|
||||
result = Py_BuildValue("O(cs#)O",
|
||||
array->ob_type,
|
||||
array->ob_descr->typecode,
|
||||
array->ob_item,
|
||||
array->ob_size * array->ob_descr->itemsize,
|
||||
dict);
|
||||
} else {
|
||||
result = Py_BuildValue("O(c)O",
|
||||
array->ob_type,
|
||||
array->ob_descr->typecode,
|
||||
dict);
|
||||
}
|
||||
Py_DECREF(dict);
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue