Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ABCMeta metaclass, keep abstractmethods #4580

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions newsfragments/4579.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove `abc.ABCMeta` metaclass from abstract classes. `pypa/setuptools#4503 <https://github.com/pypa/setuptools/pull/4503>`_ had an unintended consequence of causing potential ``TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases`` -- by :user:`Avasam`
3 changes: 1 addition & 2 deletions pkg_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from __future__ import annotations

import sys
from abc import ABC

if sys.version_info < (3, 8): # noqa: UP036 # Check for unsupported versions
raise RuntimeError("Python 3.8 or later is required")
Expand Down Expand Up @@ -306,7 +305,7 @@ def get_supported_platform():
]


class ResolutionError(Exception, ABC):
class ResolutionError(Exception):
"""Abstract base for dependency resolution errors"""

def __repr__(self):
Expand Down
4 changes: 2 additions & 2 deletions setuptools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os
import re
import sys
from abc import ABC, abstractmethod
from abc import abstractmethod
from typing import TYPE_CHECKING, TypeVar, overload

sys.path.extend(((vendor_path := os.path.join(os.path.dirname(os.path.dirname(__file__)), 'setuptools', '_vendor')) not in sys.path) * [vendor_path]) # fmt: skip
Expand Down Expand Up @@ -120,7 +120,7 @@ def setup(**attrs):
_Command = monkey.get_unpatched(distutils.core.Command)


class Command(_Command, ABC):
class Command(_Command):
"""
Setuptools internal actions are organized using a *command design pattern*.
This means that each action (or group of closely related actions) executed during
Expand Down
3 changes: 1 addition & 2 deletions setuptools/command/setopt.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import configparser
import os
from abc import ABC

from .. import Command
from ..unicode_utils import _cfg_read_utf8_with_fallback
Expand Down Expand Up @@ -70,7 +69,7 @@ def edit_config(filename, settings, dry_run=False):
opts.write(f)


class option_base(Command, ABC):
class option_base(Command):
"""Abstract base class for commands that mess with config files"""

user_options = [
Expand Down
3 changes: 1 addition & 2 deletions setuptools/sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import sys
import tempfile
import textwrap
from abc import ABC

import pkg_resources
from pkg_resources import working_set
Expand Down Expand Up @@ -263,7 +262,7 @@ def run_setup(setup_script, args):
# Normal exit, just return


class AbstractSandbox(ABC):
class AbstractSandbox:
"""Wrap 'os' module and 'open()' builtin for virtualizing setup scripts"""

_active = False
Expand Down
Loading