Skip to content

Commit 18963fb

Browse files
authored
Merge pull request #4580 from Avasam/no-ABCMeta
Remove `ABCMeta` metaclass, keep `abstractmethod`s
2 parents 477f713 + b7ee00d commit 18963fb

File tree

5 files changed

+6
-8
lines changed

5 files changed

+6
-8
lines changed

newsfragments/4579.bugfix.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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`

pkg_resources/__init__.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
from __future__ import annotations
2424

2525
import sys
26-
from abc import ABC
2726

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

308307

309-
class ResolutionError(Exception, ABC):
308+
class ResolutionError(Exception):
310309
"""Abstract base for dependency resolution errors"""
311310

312311
def __repr__(self):

setuptools/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import os
77
import re
88
import sys
9-
from abc import ABC, abstractmethod
9+
from abc import abstractmethod
1010
from typing import TYPE_CHECKING, TypeVar, overload
1111

1212
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
@@ -120,7 +120,7 @@ def setup(**attrs):
120120
_Command = monkey.get_unpatched(distutils.core.Command)
121121

122122

123-
class Command(_Command, ABC):
123+
class Command(_Command):
124124
"""
125125
Setuptools internal actions are organized using a *command design pattern*.
126126
This means that each action (or group of closely related actions) executed during

setuptools/command/setopt.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import configparser
22
import os
3-
from abc import ABC
43

54
from .. import Command
65
from ..unicode_utils import _cfg_read_utf8_with_fallback
@@ -70,7 +69,7 @@ def edit_config(filename, settings, dry_run=False):
7069
opts.write(f)
7170

7271

73-
class option_base(Command, ABC):
72+
class option_base(Command):
7473
"""Abstract base class for commands that mess with config files"""
7574

7675
user_options = [

setuptools/sandbox.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import sys
1212
import tempfile
1313
import textwrap
14-
from abc import ABC
1514

1615
import pkg_resources
1716
from pkg_resources import working_set
@@ -263,7 +262,7 @@ def run_setup(setup_script, args):
263262
# Normal exit, just return
264263

265264

266-
class AbstractSandbox(ABC):
265+
class AbstractSandbox:
267266
"""Wrap 'os' module and 'open()' builtin for virtualizing setup scripts"""
268267

269268
_active = False

0 commit comments

Comments
 (0)