diff --git a/cssselect/xpath.py b/cssselect/xpath.py index f51cfb4..2f546e6 100644 --- a/cssselect/xpath.py +++ b/cssselect/xpath.py @@ -14,6 +14,7 @@ import re import typing +import warnings from typing import Optional from cssselect.parser import ( @@ -37,6 +38,17 @@ ) +@typing.no_type_check +def _unicode_safe_getattr(obj, name, default=None): + warnings.warn( + "_unicode_safe_getattr is deprecated and will be removed in the" + " next release, use getattr() instead", + DeprecationWarning, + stacklevel=2, + ) + return getattr(obj, name, default) + + class ExpressionError(SelectorError, RuntimeError): """Unknown or unsupported selector (eg. pseudo-class)."""