diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-11-15 17:41:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-15 17:41:05 +0200 |
commit | 00987f6230fcdbecc8d9ab4b2b9fae8f99a1a4a9 (patch) | |
tree | b0a5e7419441a09543abb78eb8378328bfbc6bae /Python | |
parent | ddbce1378644f9d5ad0651e1c9035bd8c6502edc (diff) | |
download | cpython-git-00987f6230fcdbecc8d9ab4b2b9fae8f99a1a4a9.tar.gz |
bpo-32011: Revert "Issue #15480: Remove the deprecated and unused TYPE_INT64 code from marshal." (#4381)
Simplify the reverted code.
This reverts commit e9bbe8b87ba2874efba0474af5cc7d5941dbf742.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/marshal.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Python/marshal.c b/Python/marshal.c index 7b583eef1a..e23daf6497 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -39,6 +39,9 @@ module marshal #define TYPE_STOPITER 'S' #define TYPE_ELLIPSIS '.' #define TYPE_INT 'i' +/* TYPE_INT64 is not generated anymore. + Supported for backward compatibility only. */ +#define TYPE_INT64 'I' #define TYPE_FLOAT 'f' #define TYPE_BINARY_FLOAT 'g' #define TYPE_COMPLEX 'x' @@ -783,6 +786,19 @@ r_long(RFILE *p) return x; } +/* r_long64 deals with the TYPE_INT64 code. */ +static PyObject * +r_long64(RFILE *p) +{ + const unsigned char *buffer = (const unsigned char *) r_string(8, p); + if (buffer == NULL) { + return NULL; + } + return _PyLong_FromByteArray(buffer, 8, + 1 /* little endian */, + 1 /* signed */); +} + static PyObject * r_PyLong(RFILE *p) { @@ -982,6 +998,11 @@ r_object(RFILE *p) R_REF(retval); break; + case TYPE_INT64: + retval = r_long64(p); + R_REF(retval); + break; + case TYPE_LONG: retval = r_PyLong(p); R_REF(retval); |