mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
fix: renamed_argument decorator error
Also, I removed hidden mutation of input in _handling function
This commit is contained in:
parent
3783e7052a
commit
b436cf8e27
1 changed files with 5 additions and 1 deletions
|
|
@ -102,14 +102,18 @@ def renamed_argument(old_name: str, new_name: str, until_version: str, stackleve
|
|||
is_coroutine = asyncio.iscoroutinefunction(func)
|
||||
|
||||
def _handling(kwargs):
|
||||
"""
|
||||
Returns updated version of kwargs.
|
||||
"""
|
||||
routine_type = 'coroutine' if is_coroutine else 'function'
|
||||
if old_name in kwargs:
|
||||
warn_deprecated(f"In {routine_type} '{func.__name__}' argument '{old_name}' "
|
||||
f"is renamed to '{new_name}' "
|
||||
f"and will be removed in aiogram {until_version}",
|
||||
stacklevel=stacklevel)
|
||||
kwargs = kwargs.copy()
|
||||
kwargs.update({new_name: kwargs.pop(old_name)})
|
||||
return kwargs
|
||||
return kwargs
|
||||
|
||||
if is_coroutine:
|
||||
@functools.wraps(func)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue