mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-12-22 14:35:00 +01:00
Improve Deprecation Warning for __slots__ (#2574)
* add stacklevel to `set_new_attribute_deprecated` * detail warning message and change stacklevel
This commit is contained in:
parent
9aec8deec6
commit
fce2993d21
1 changed files with 3 additions and 1 deletions
|
@ -40,6 +40,8 @@ def set_new_attribute_deprecated(self: object, key: str, value: object) -> None:
|
|||
new = len(self.__dict__)
|
||||
if new > org:
|
||||
warnings.warn(
|
||||
"Setting custom attributes on objects of the PTB library is deprecated.",
|
||||
f"Setting custom attributes such as {key!r} on objects such as "
|
||||
f"{self.__class__.__name__!r} of the PTB library is deprecated.",
|
||||
TelegramDeprecationWarning,
|
||||
stacklevel=3,
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue