From 3bcc74e90ed8523e9373379499d8d8f3f641b9fd Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Thu, 14 Mar 2024 12:43:52 +0100 Subject: [PATCH] Support for Python 3.12 --- .github/workflows/test.yml | 2 +- pflake8/__init__.py | 13 ++++++++++--- pyproject.toml | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4fa6de3..ae1cda7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] name: Python ${{ matrix.python-version }} testing steps: - uses: actions/checkout@v3 diff --git a/pflake8/__init__.py b/pflake8/__init__.py index f0d84d7..4154b5e 100644 --- a/pflake8/__init__.py +++ b/pflake8/__init__.py @@ -52,13 +52,20 @@ class DivertingConfigParser(ConfigParserTomlMixin, configparser.ConfigParser): pass -class DivertingSafeConfigParser(ConfigParserTomlMixin, configparser.SafeConfigParser): - pass +try: + + class DivertingSafeConfigParser( + ConfigParserTomlMixin, configparser.SafeConfigParser + ): + pass + + configparser.SafeConfigParser = DivertingSafeConfigParser +except AttributeError: + pass # does not exist on Python 3.12 (https://github.com/python/cpython/issues/89336#issuecomment-1094366625) configparser.RawConfigParser = DivertingRawConfigParser configparser.ConfigParser = DivertingConfigParser -configparser.SafeConfigParser = DivertingSafeConfigParser class FixFilenames(ast.NodeTransformer): diff --git a/pyproject.toml b/pyproject.toml index ba08832..c96b155 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ classifiers = [] requires-python = ">=3.8.1" dependencies = [ "tomli; python_version < '3.11'", - "flake8 == 6.1.0" + "flake8 == 7.0.0" ] [project.urls]