diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-06-13 01:26:35 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-06-13 01:26:35 (GMT) |
commit | da9c5b35a3ee5fc5bc1d1c64e04bfa8c5bf35886 (patch) | |
tree | 76dfa6b16e03b19ccec61c8f5a4864311f211965 /Modules | |
parent | d1a7da6c0d377d2296b79c4203d267ffe1664bfb (diff) | |
download | cpython-da9c5b35a3ee5fc5bc1d1c64e04bfa8c5bf35886.zip cpython-da9c5b35a3ee5fc5bc1d1c64e04bfa8c5bf35886.tar.gz cpython-da9c5b35a3ee5fc5bc1d1c64e04bfa8c5bf35886.tar.bz2 |
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.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/structmodule.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Modules/structmodule.c b/Modules/structmodule.c index 4a8886f..66b3ac3 100644 --- a/Modules/structmodule.c +++ b/Modules/structmodule.c @@ -874,6 +874,8 @@ bp_longlong(char *p, PyObject *v, const formatdef *f) { int res; v = get_pylong(v); + if (v == NULL) + return -1; res = _PyLong_AsByteArray((PyLongObject *)v, (unsigned char *)p, 8, @@ -888,6 +890,8 @@ bp_ulonglong(char *p, PyObject *v, const formatdef *f) { int res; v = get_pylong(v); + if (v == NULL) + return -1; res = _PyLong_AsByteArray((PyLongObject *)v, (unsigned char *)p, 8, @@ -1036,6 +1040,8 @@ lp_longlong(char *p, PyObject *v, const formatdef *f) { int res; v = get_pylong(v); + if (v == NULL) + return -1; res = _PyLong_AsByteArray((PyLongObject*)v, (unsigned char *)p, 8, @@ -1050,6 +1056,8 @@ lp_ulonglong(char *p, PyObject *v, const formatdef *f) { int res; v = get_pylong(v); + if (v == NULL) + return -1; res = _PyLong_AsByteArray((PyLongObject*)v, (unsigned char *)p, 8, |