summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelie <elie>2011-10-18 09:57:07 +0000
committerelie <elie>2011-10-18 09:57:07 +0000
commit3cce2401f532b3814a45a38b1b3c50f8c51cf472 (patch)
tree2e9625dbd863681181bc0dcedf191aaff169c301
parentdfd00d526bc3089ce18bed99ee225cb99e94fe29 (diff)
downloadpyasn1-3cce2401f532b3814a45a38b1b3c50f8c51cf472.tar.gz
fix to float() infinity compatibility issue (affects 2.5 and earlier)
-rw-r--r--CHANGES1
-rw-r--r--pyasn1/type/univ.py9
2 files changed, 8 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 1697180..1fd8cd1 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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)