Skip to content

Commit d8e8e72

Browse files
committed
use hack if FLOAT_REPR is not available
1 parent 2d42e6f commit d8e8e72

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

djgeojson/serializers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from six import StringIO # NOQA
1212
import json
1313
import logging
14-
import sys
1514

1615
from contextlib import contextmanager
1716

@@ -71,7 +70,7 @@ def json_encoder_with_precision(precision, JSONEncoderClass):
7170
"""
7271
Context manager to set float precision during json encoding
7372
"""
74-
needs_class_hack = (3, 5) <= sys.version_info < (3, 6) # python 3.5 does not have json.encoder.FLOAT_REPR
73+
needs_class_hack = not hasattr(json.encoder, 'FLOAT_REPR')
7574
try:
7675
if precision is not None:
7776
def float_repr(o):

0 commit comments

Comments
 (0)