mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #18520: Add a new PyStructSequence_InitType2() function, same than
PyStructSequence_InitType() except that it has a return value (0 on success, -1 on error). * PyStructSequence_InitType2() now raises MemoryError on memory allocation failure * Fix also some calls to PyDict_SetItemString(): handle error
This commit is contained in:
parent
2a545099f7
commit
1c8f059019
17 changed files with 117 additions and 54 deletions
|
@ -1853,7 +1853,7 @@ PyTypeObject PyFloat_Type = {
|
|||
float_new, /* tp_new */
|
||||
};
|
||||
|
||||
void
|
||||
int
|
||||
_PyFloat_Init(void)
|
||||
{
|
||||
/* We attempt to determine if this machine is using IEEE
|
||||
|
@ -1903,8 +1903,11 @@ _PyFloat_Init(void)
|
|||
float_format = detected_float_format;
|
||||
|
||||
/* Init float info */
|
||||
if (FloatInfoType.tp_name == 0)
|
||||
PyStructSequence_InitType(&FloatInfoType, &floatinfo_desc);
|
||||
if (FloatInfoType.tp_name == NULL) {
|
||||
if (PyStructSequence_InitType2(&FloatInfoType, &floatinfo_desc) < 0)
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue