summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcmaumet <c.m.j.maumet@warwick.ac.uk>2016-10-13 09:34:40 +0100
committercmaumet <c.m.j.maumet@warwick.ac.uk>2016-10-13 09:34:40 +0100
commitca28e61c2b8ad66bc206d102d1f7faa9e48e58b8 (patch)
tree0ce9a31bc77cf771cfced6f2f7dc2b641fd6ce2b
parente2c89dc4e236e60b95226d1ed946226e3262d11a (diff)
downloadrdflib-ca28e61c2b8ad66bc206d102d1f7faa9e48e58b8.tar.gz
Only doubles can be infinity or NaN
(otherwise fails when parsing a string)
-rw-r--r--rdflib/term.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/rdflib/term.py b/rdflib/term.py
index 0d70e792..65db8cf4 100644
--- a/rdflib/term.py
+++ b/rdflib/term.py
@@ -1197,7 +1197,8 @@ class Literal(Identifier):
# If self is infinity or not-a-number, we must use a xsd:float datatype
# (no plain representation)
- is_inf_nan = math.isinf(float(self)) or math.isnan(float(self))
+ is_inf_nan = (self.datatype == _XSD_DOUBLE) and \
+ (math.isinf(float(self)) or math.isnan(float(self)))
if use_plain and self.datatype in _PLAIN_LITERAL_TYPES \
and not is_inf_nan: