diff Modules/structmodule.c @ 18094:2367b7a001a7 legacy-trunk

The new {b,l}p_{u,}longlong() didn't check get_pylong()'s return for NULL. Repaired that, and added appropriate tests for it to test_struct.py.
author Tim Peters <tim.peters@gmail.com>
date Wed, 13 Jun 2001 01:26:35 +0000
parents bbcdbd8f4469
children 8df77415a61d
line wrap: on
line diff
--- a/Modules/structmodule.c	Wed Jun 13 00:35:57 2001 +0000
+++ b/Modules/structmodule.c	Wed Jun 13 01:26:35 2001 +0000
@@ -874,6 +874,8 @@
 {
 	int res;
 	v = get_pylong(v);
+	if (v == NULL)
+		return -1;
 	res = _PyLong_AsByteArray((PyLongObject *)v,
 			   	  (unsigned char *)p,
 				  8,
@@ -888,6 +890,8 @@
 {
 	int res;
 	v = get_pylong(v);
+	if (v == NULL)
+		return -1;
 	res = _PyLong_AsByteArray((PyLongObject *)v,
 			   	  (unsigned char *)p,
 				  8,
@@ -1036,6 +1040,8 @@
 {
 	int res;
 	v = get_pylong(v);
+	if (v == NULL)
+		return -1;
 	res = _PyLong_AsByteArray((PyLongObject*)v,
 			   	  (unsigned char *)p,
 				  8,
@@ -1050,6 +1056,8 @@
 {
 	int res;
 	v = get_pylong(v);
+	if (v == NULL)
+		return -1;
 	res = _PyLong_AsByteArray((PyLongObject*)v,
 			   	  (unsigned char *)p,
 				  8,