Skip to content

Commit

Permalink
Fix Python 3.8 compatibility (#6154)
Browse files Browse the repository at this point in the history
  • Loading branch information
jleclanche authored and rpkilby committed Sep 11, 2018
1 parent 4d57d46 commit 612a7b9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions rest_framework/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
from django.utils import six
from django.views.generic import View

try:
# Python 3 (required for 3.8+)
from collections.abc import Mapping # noqa
except ImportError:
# Python 2.7
from collections import Mapping # noqa

try:
from django.urls import ( # noqa
URLPattern,
Expand Down
4 changes: 2 additions & 2 deletions rest_framework/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import copy
import inspect
import traceback
from collections import Mapping, OrderedDict
from collections import OrderedDict

from django.core.exceptions import ImproperlyConfigured
from django.core.exceptions import ValidationError as DjangoValidationError
Expand All @@ -27,7 +27,7 @@
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _

from rest_framework.compat import postgres_fields, unicode_to_repr
from rest_framework.compat import Mapping, postgres_fields, unicode_to_repr
from rest_framework.exceptions import ErrorDetail, ValidationError
from rest_framework.fields import get_error_detail, set_value
from rest_framework.settings import api_settings
Expand Down

0 comments on commit 612a7b9

Please sign in to comment.