File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 4242else :
4343 _EnumType = enum .EnumType
4444if sys .version_info [:2 ] < (3 , 13 ):
45+ import inspect
46+
4547 # prior to 3.13 the int.{to,from}_bytes docstrings had LaTeX-like
4648 # "`..'" quotations, which Sphinx can't parse correctly.
4749 def _fix_doc (ref ):
@@ -53,7 +55,8 @@ def _rewrite(func):
5355
5456 class IntEnum (enum .IntEnum ):
5557 __doc__ = (
56- """A compatibility wrapper around :class:`enum.IntEnum`
58+ inspect .cleandoc (
59+ """A compatibility wrapper around :class:`enum.IntEnum`
5760
5861 This wrapper class updates the :meth:`to_bytes` and
5962 :meth:`from_bytes` docstrings in Python <= 3.12 to suppress
@@ -62,7 +65,10 @@ class IntEnum(enum.IntEnum):
6265 .. rubric:: IntEnum
6366
6467 """
65- + enum .IntEnum .__doc__
68+ )
69+ + "\n \n "
70+ # There are environments where IntEnum.__doc__ is None (see #3710)
71+ + inspect .cleandoc (getattr (enum .IntEnum , "__doc__" , "" ) or "" )
6672 )
6773
6874 @_fix_doc (enum .IntEnum .to_bytes )
You can’t perform that action at this time.
0 commit comments