Avoid a Python deprecation warning with the collections patch.

Review Request #12312 — Created May 31, 2022 and submitted

Information

Django Evolution
release-2.x

Reviewers

Django Evolution provides a compatibility patch to enable
collections.Callable on Python 3.10 with Django <= 2.0. To check
whether to apply the patch, we were checking for the existence of
collections.Callable and the Django version.

The first check led to a deprecation warning on modern versions of
Python, which is annoying when running on a version of Django not
susceptible to the old imports. Instead, we now check the Django version
first, avoiding the warning.

Started up a dev server and saw that the warning no longer appeared.

Summary ID
Avoid a Python deprecation warning with the collections patch.
Django Evolution provides a compatibility patch to enable `collections.Callable` on Python 3.10 with Django <= 2.0. To check whether to apply the patch, we were checking for the existence of `collections.Callable` and the Django version. The first check led to a deprecation warning on modern versions of Python, which is annoying when running on a version of Django not susceptible to the old imports. Instead, we now check the Django version first, avoiding the warning.
8b237c4f53d6fa0e10fcb30814e12047a5c9cf9d
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.x (dd98bf5)
Loading...