diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 22110a83..84d93cb1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ repos: hooks: - id: pyupgrade args: ["--py38-plus"] - - repo: https://github.com/asottile/reorder_python_imports + - repo: https://github.com/asottile/reorder-python-imports rev: v3.9.0 hooks: - id: reorder-python-imports diff --git a/CHANGES.rst b/CHANGES.rst index 4d651204..b36e1b60 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,12 @@ +Version 2.3.3 +------------- + +Unreleased + +- Python 3.12 compatibility. +- Update Werkzeug requirement to >=2.3.5. + + Version 2.3.2 ------------- diff --git a/pyproject.toml b/pyproject.toml index 1fae1bcb..24de15dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", @@ -54,8 +54,8 @@ version = {attr = "flask.__version__"} testpaths = ["tests"] filterwarnings = [ "error", - # change in Python 3.12 alpha causes warning from inside pytest - "ignore:onerror argument:DeprecationWarning", + # change in Python 3.12 causes warning from inside pytest + "ignore:ast:DeprecationWarning", ] [tool.coverage.run] diff --git a/requirements/tests-pallets-min.in b/requirements/tests-pallets-min.in index 5b2a6ff7..140b6bd1 100644 --- a/requirements/tests-pallets-min.in +++ b/requirements/tests-pallets-min.in @@ -1,4 +1,4 @@ -Werkzeug==2.3.3 +Werkzeug==2.3.5 Jinja2==3.1.2 MarkupSafe==2.1.1 itsdangerous==2.1.2 diff --git a/requirements/tests-pallets-min.txt b/requirements/tests-pallets-min.txt index 1a79a37b..14adc43a 100644 --- a/requirements/tests-pallets-min.txt +++ b/requirements/tests-pallets-min.txt @@ -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 diff --git a/src/flask/__init__.py b/src/flask/__init__.py index 0bef2213..dfe2a0aa 100644 --- a/src/flask/__init__.py +++ b/src/flask/__init__.py @@ -38,7 +38,7 @@ from .templating import render_template_string as render_template_string from .templating import stream_template as stream_template from .templating import stream_template_string as stream_template_string -__version__ = "2.3.2" +__version__ = "2.3.3.dev" def __getattr__(name): diff --git a/src/flask/helpers.py b/src/flask/helpers.py index 61a0f818..4e8bc8b8 100644 --- a/src/flask/helpers.py +++ b/src/flask/helpers.py @@ -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 diff --git a/src/flask/scaffold.py b/src/flask/scaffold.py index 9d3498fc..3c23ef97 100644 --- a/src/flask/scaffold.py +++ b/src/flask/scaffold.py @@ -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