From 4e4c8aa62ab77e472c27bfd3436ad4f3f6386c79 Mon Sep 17 00:00:00 2001 From: Inseok Lee Date: Mon, 25 Nov 2024 14:01:57 +0900 Subject: [PATCH] CPLAT-4632 Fix for python 3.12 --- django/utils/six.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/django/utils/six.py b/django/utils/six.py index 52627592b750..481a03974aa4 100644 --- a/django/utils/six.py +++ b/django/utils/six.py @@ -186,6 +186,15 @@ def find_module(self, fullname, path=None): return self return None + # For python 3.12 + def find_spec(self, fullname, path, target=None): + from importlib.util import spec_from_loader + loader = self.find_module(fullname, path) + if loader is None: + return None + + return spec_from_loader(fullname, loader) + def __get_module(self, fullname): try: return self.known_modules[fullname]