From ea69043409ed4cd7fdf89044756e5af1791f2f64 Mon Sep 17 00:00:00 2001 From: Anthon van der Neut Date: Wed, 9 Aug 2017 20:03:45 +0200 Subject: fix issue #147: not able to dump floats This happened when dumping without loading, e.g.: python -c "import ruamel.yaml, sys; ruamel.yaml.round_trip_dump([3.14])" When this fix solves the problem, please close this issue --- representer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'representer.py') diff --git a/representer.py b/representer.py index cd4ae49..03dcbf4 100644 --- a/representer.py +++ b/representer.py @@ -309,7 +309,7 @@ class SafeRepresenter(BaseRepresenter): value = u'-.inf' else: value = to_unicode(repr(data)).lower() - if self.dumper.version == (1, 1): # type: ignore + if self.serializer.use_version == (1, 1): # type: ignore if u'.' not in value and u'e' in value: # Note that in some cases `repr(data)` represents a float number # without the decimal parts. For instance: -- cgit v1.2.1