Python 3.12 compatibility (#5157)

This commit is contained in:
David Lord 2023-06-07 13:21:49 -07:00 committed by GitHub
commit 9930b0fe8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 8 deletions

View file

@ -3,6 +3,9 @@ Version 2.3.3
Unreleased
- Python 3.12 compatibility.
- Update Werkzeug requirement to >=2.3.5.
Version 2.3.2
-------------

View file

@ -19,7 +19,7 @@ classifiers = [
]
requires-python = ">=3.8"
dependencies = [
"Werkzeug>=2.3.3",
"Werkzeug>=2.3.5",
"Jinja2>=3.1.2",
"itsdangerous>=2.1.2",
"click>=8.1.3",

View file

@ -1,4 +1,4 @@
Werkzeug==2.3.3
Werkzeug==2.3.5
Jinja2==3.1.2
MarkupSafe==2.1.1
itsdangerous==2.1.2

View file

@ -1,4 +1,4 @@
# SHA1:0b58503b99aabc227b7f39357216d676d9987a12
# SHA1:c4bfd085a9d4e81c583daf70671803d5e388c656
#
# This file is autogenerated by pip-compile-multi
# To update, run:
@ -18,5 +18,5 @@ markupsafe==2.1.1
# -r requirements/tests-pallets-min.in
# jinja2
# werkzeug
werkzeug==2.3.3
werkzeug==2.3.5
# via -r requirements/tests-pallets-min.in

View file

@ -1,7 +1,7 @@
from __future__ import annotations
import importlib.util
import os
import pkgutil
import socket
import sys
import typing as t
@ -575,7 +575,8 @@ def get_root_path(import_name: str) -> str:
return os.path.dirname(os.path.abspath(mod.__file__))
# Next attempt: check the loader.
loader = pkgutil.get_loader(import_name)
spec = importlib.util.find_spec(import_name)
loader = spec.loader if spec is not None else None
# Loader does not exist or we're referring to an unloaded main
# module or a main module without path (interactive sessions), go

View file

@ -3,7 +3,6 @@ from __future__ import annotations
import importlib.util
import os
import pathlib
import pkgutil
import sys
import typing as t
from collections import defaultdict
@ -856,7 +855,8 @@ def _find_package_path(import_name):
return os.path.dirname(root_spec.origin)
# we were unable to find the `package_path` using PEP 451 loaders
loader = pkgutil.get_loader(root_mod_name)
spec = importlib.util.find_spec(root_mod_name)
loader = spec.loader if spec is not None else None
if loader is None or root_mod_name == "__main__":
# import name is not found, or interactive/main module