summaryrefslogtreecommitdiff
path: root/Objects/longobject.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-22 22:24:54 +0200
committerVictor Stinner <victor.stinner@gmail.com>2013-07-22 22:24:54 +0200
commit1c8f059019d79f1891f42a2656a96919a1187967 (patch)
treebcec768e9ca0d0e1e9e1ab80e0dfc0fe29ae758d /Objects/longobject.c
parent2a545099f7ed45de1d45b45200d82c6298b75d2b (diff)
downloadcpython-git-1c8f059019d79f1891f42a2656a96919a1187967.tar.gz
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
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r--Objects/longobject.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 925e55a138..ce75888f7e 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -5059,8 +5059,10 @@ _PyLong_Init(void)
}
#endif
/* initialize int_info */
- if (Int_InfoType.tp_name == 0)
- PyStructSequence_InitType(&Int_InfoType, &int_info_desc);
+ if (Int_InfoType.tp_name == NULL) {
+ if (PyStructSequence_InitType2(&Int_InfoType, &int_info_desc) < 0)
+ return 0;
+ }
return 1;
}