Skip to content

Commit 4aafce6

Browse files
committed
Fix for Python 3
1 parent fb0f915 commit 4aafce6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

rest_framework/utils/encoders.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import decimal
88
import json
99
import uuid
10-
from json.encoder import (FLOAT_REPR, INFINITY, _make_iterencode,
10+
from json.encoder import (INFINITY, _make_iterencode,
1111
encode_basestring, encode_basestring_ascii)
1212

1313
from django.db.models.query import QuerySet
@@ -17,6 +17,11 @@
1717

1818
from rest_framework.compat import coreapi, total_seconds
1919

20+
try:
21+
from json.encoder import FLOAT_REPR
22+
except:
23+
FLOAT_REPR = float.__repr__
24+
2025

2126
class JSONEncoder(json.JSONEncoder):
2227
"""

0 commit comments

Comments
 (0)