dev-python/numpydoc: Add a quick patch for upstream regression

Add a quick patch for the regression causing `AttributeError`
in dev-python/scikit-learn.

Bug: https://github.com/numpy/numpydoc/issues/638
Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny 2025-07-19 08:28:00 +02:00
parent 3851512584
commit 945f051c52
No known key found for this signature in database
GPG Key ID: 639ADAE2329E240E
2 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,16 @@
diff --git a/numpydoc/validate.py b/numpydoc/validate.py
index d0debfa..6d7b369 100644
--- a/numpydoc/validate.py
+++ b/numpydoc/validate.py
@@ -640,9 +640,9 @@ def validate(obj_name, validator_cls=None, **validator_kwargs):
# Check if the object is a class and has a docstring in the constructor
# Also check if code_obj is defined, as undefined for the AstValidator in validate_docstrings.py.
if (
- doc.name.endswith(".__init__")
- and doc.is_function_or_method
+ doc.is_function_or_method
and hasattr(doc, "code_obj")
+ and doc.name.endswith(".__init__")
):
cls_name = doc.code_obj.__qualname__.split(".")[0]
cls = Validator._load_obj(f"{doc.code_obj.__module__}.{cls_name}")

View File

@ -34,6 +34,11 @@ BDEPEND="
)
"
PATCHES=(
# https://github.com/numpy/numpydoc/issues/638
"${FILESDIR}/${P}-638.patch"
)
EPYTEST_PLUGINS=()
distutils_enable_tests pytest