  from rest_framework.compat import coreapi
  from rest_framework.utils.encoders import JSONEncoder
  from rest_framework.utils.serializer_helpers import ReturnList
  
  
  class MockList:
      def tolist(self):
          return [1, 2, 3]
 
</s> remove from django.utils.timezone import utc
 </s> add  </s> remove             return timezone.make_naive(value, utc)
 </s> add             return timezone.make_naive(value, datetime.timezone.utc) </s> remove                 array_field = ListField(allow_empty=False, child=CharField(label='Array field', validators=[<django.core.validators.MaxLengthValidator object>]))
                array_field_with_blank = ListField(child=CharField(label='Array field with blank', validators=[<django.core.validators.MaxLengthValidator object>]), required=False)
        """)
 </s> add                 array_field = ListField(allow_empty=False, child=CharField(label='Array field'%s))
                array_field_with_blank = ListField(child=CharField(label='Array field with blank'%s), required=False)
        """ % (validators, validators)) </s> remove         django40: Django>=4.0,<5.0
 </s> add         django40: Django>=4.0,<4.1
        django41: Django>=4.1a1,<4.2
utc = timezone.utc

  from rest_framework.compat import coreapi
  from rest_framework.utils.encoders import JSONEncoder
  from rest_framework.utils.serializer_helpers import ReturnList
  
utc = timezone.utc

  
  class MockList:
      def tolist(self):
          return [1, 2, 3]
keep keep keep add keep keep keep keep
 Confirmed support for Django 4.1. (#8498) 
tests/test_encoders.py