diff options
author | elie <elie> | 2011-10-18 09:57:07 +0000 |
---|---|---|
committer | elie <elie> | 2011-10-18 09:57:07 +0000 |
commit | 3cce2401f532b3814a45a38b1b3c50f8c51cf472 (patch) | |
tree | 2e9625dbd863681181bc0dcedf191aaff169c301 | |
parent | dfd00d526bc3089ce18bed99ee225cb99e94fe29 (diff) | |
download | pyasn1-3cce2401f532b3814a45a38b1b3c50f8c51cf472.tar.gz |
fix to float() infinity compatibility issue (affects 2.5 and earlier)
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | pyasn1/type/univ.py | 9 |
2 files changed, 8 insertions, 2 deletions
@@ -1,6 +1,7 @@ Revision 0.0.14 --------------- +- Fixed float() infinity compatibility issue (affects 2.5 and earlier) - Fixed a bug/typo at Boolean CER encoder. - Major overhawl for Python 2.4 -- 3.2 compatibility: + get rid of old-style types diff --git a/pyasn1/type/univ.py b/pyasn1/type/univ.py index 4ccd1f4..c4ffd4d 100644 --- a/pyasn1/type/univ.py +++ b/pyasn1/type/univ.py @@ -433,8 +433,13 @@ else: intTypes = int class Real(base.AbstractSimpleAsn1Item): - _plusInf = float('inf') - _minusInf = float('-inf') + try: + _plusInf = float('inf') + _minusInf = float('-inf') + except ValueError: + # Python <2.6 does not reliably support infinity + _plusInf = 1e30000 + _minusInf = -1e30000 _inf = (_plusInf, _minusInf) tagSet = baseTagSet = tag.initTagSet( tag.Tag(tag.tagClassUniversal, tag.tagFormatSimple, 0x09) |