summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES3
-rw-r--r--README.rst3
-rw-r--r--__init__.py4
-rw-r--r--_test/test_int.py9
-rw-r--r--compat.py4
-rw-r--r--scalarint.py6
6 files changed, 25 insertions, 4 deletions
diff --git a/CHANGES b/CHANGES
index ceac327..3494b59 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+[0, 15, 23]: 2017-08-01
+ - fix for round_tripping integers on 2.7.X > sys.maxint (reported by ccatterina)
+
[0, 15, 22]: 2017-07-28
- fix for round_tripping singe excl. mark tags doubling (reported and fix by Jan Brezina)
diff --git a/README.rst b/README.rst
index ecb4dbf..ce37f5e 100644
--- a/README.rst
+++ b/README.rst
@@ -35,6 +35,9 @@ ChangeLog
.. should insert NEXT: at the beginning of line for next key
+0.15.23 (2017-08-01):
+ - fix for round_tripping integers on 2.7.X > sys.maxint (reported by ccatterina)
+
0.15.22 (2017-07-28):
- fix for round_tripping singe excl. mark tags doubling (reported and fix by Jan Brezina)
diff --git a/__init__.py b/__init__.py
index 5c53c7e..87adcd7 100644
--- a/__init__.py
+++ b/__init__.py
@@ -7,8 +7,8 @@ if False: # MYPY
_package_data = dict(
full_package_name='ruamel.yaml',
- version_info=(0, 15, 23, 'dev'),
- __version__='0.15.23.dev',
+ version_info=(0, 15, 23),
+ __version__='0.15.23',
author='Anthon van der Neut',
author_email='a.van.der.neut@ruamel.eu',
description='ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order', # NOQA
diff --git a/_test/test_int.py b/_test/test_int.py
index 241d14a..080eb54 100644
--- a/_test/test_int.py
+++ b/_test/test_int.py
@@ -98,3 +98,12 @@ class TestBinHexOct:
assert d[0] == 42424242
assert d[1] == '_42_42_'
assert d[2] == 4242
+
+ def test_big(self):
+ # bitbucket issue 144 reported by ccatterina
+ d = round_trip_load("""\
+ - 2_147_483_647
+ - 9_223_372_036_854_775_808
+ """)
+ assert d[0] == 2147483647
+ assert d[1] == 9223372036854775808
diff --git a/compat.py b/compat.py
index 7fffedf..6b05d5a 100644
--- a/compat.py
+++ b/compat.py
@@ -81,6 +81,8 @@ if PY3:
import io
StringIO = io.StringIO
BytesIO = io.BytesIO
+ # have unlimited precision
+ no_limit_int = int
else:
string_types = basestring # NOQA
@@ -95,6 +97,8 @@ else:
StringIO = _StringIO
import cStringIO
BytesIO = cStringIO.StringIO
+ # have unlimited precision
+ no_limit_int = long # NOQA not available on Python 3
if False: # MYPY
# StreamType = Union[BinaryIO, IO[str], IO[unicode], StringIO]
diff --git a/scalarint.py b/scalarint.py
index 9f17b0c..d609236 100644
--- a/scalarint.py
+++ b/scalarint.py
@@ -7,13 +7,15 @@ if False: # MYPY
__all__ = ["ScalarInt", "BinaryInt", "OctalInt", "HexInt", "HexCapsInt"]
+from .compat import no_limit_int # NOQA
-class ScalarInt(int):
+
+class ScalarInt(no_limit_int):
def __new__(cls, *args, **kw):
# type: (Any, Any, Any) -> Any
width = kw.pop('width', None) # type: ignore
underscore = kw.pop('underscore', None) # type: ignore
- v = int.__new__(cls, *args, **kw) # type: ignore
+ v = no_limit_int.__new__(cls, *args, **kw) # type: ignore
v._width = width
v._underscore = underscore
return v