[PATCH] cbor: teach the encoder to handle python `long` type for Windows
Matt Harbison
mharbison72 at gmail.com
Wed Sep 5 02:32:24 UTC 2018
# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1536114578 14400
# Tue Sep 04 22:29:38 2018 -0400
# Node ID 5a44192e15a600f244ee7b77a77a2add7731b61c
# Parent 197521083166579f6c80d7532ec6e919af2fe2cf
cbor: teach the encoder to handle python `long` type for Windows
The tests for 2**32 and -7000000000 were blowing up, complaining about not
knowing how to encode type 'long'. sys.maxint tops out at 2**31-1 on Windows,
but I guess is 2^63-1 on Linux? I *think* we're OK on the decode side, as there
is an assertion that the decoded value is equal to the original primitive value.
diff --git a/mercurial/utils/cborutil.py b/mercurial/utils/cborutil.py
--- a/mercurial/utils/cborutil.py
+++ b/mercurial/utils/cborutil.py
@@ -190,6 +190,7 @@ def streamencodenone(v):
STREAM_ENCODERS = {
bytes: streamencodebytestring,
int: streamencodeint,
+ long: streamencodeint,
list: streamencodearray,
tuple: streamencodearray,
dict: streamencodemap,
More information about the Mercurial-devel
mailing list