Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
documentation fixes
  • Loading branch information
ben avrahami committed Oct 1, 2020
commit 61c4f40ede01206ccfdb5b78005299e927ad1245
2 changes: 1 addition & 1 deletion Doc/library/abc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ The :mod:`abc` module also provides the following functions:
A function to recalculate an abstract class's abstraction status. This
function should be called if a class's abstract methods have been
implemented or changed after it was created. Usually, this function should
be called from within class decorator.
be called from within a class decorator.

Returns *cls*, to allow usage as a class decorator.

Expand Down
8 changes: 4 additions & 4 deletions Lib/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,18 @@ def update_abstractmethods(cls):
If a class has had one of its abstract methods implemented after the
class was created, the method will not be considered implemented until
this function is called. Alternativly, if a new abstract method has been
added to the class, it will not be considered to require that method
implemented until this function is called.
added to the class, it will only be considered an abstract method of the
class after this function is called.

This function should be called before any use is made of the class,
usually in class decorators that implement methods.
usually in class decorators that add methods to the subject class.

Returns cls, to allow usage as a class decorator.

If cls is has any subclasses, raises a RuntimeError.
"""
if cls.__subclasses__():
raise RuntimeError("cannot update abstract method of class after suclassing")
raise RuntimeError("cannot update abstract methods of class after subclassing")
abstracts = set()
# check the existing abstract methods, keep only the ones that are
# still abstract
Expand Down
2 changes: 1 addition & 1 deletion Lib/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ def _process_class(cls, init, repr, eq, order, unsafe_hash, frozen):
cls.__doc__ = (cls.__name__ +
str(inspect.signature(cls)).replace(' -> None', ''))

# update the abstract methods of the class, if it is abstract
# Update the abstract methods of the class, if it is abstract.
if isinstance(cls, abc.ABCMeta):
abc.update_abstractmethods(cls)

Expand Down