Don't get code_context when calling inspect.stack (#48849)
* Don't get code_context when calling inspect.stack * Update homeassistant/helpers/config_validation.py
This commit is contained in:
parent
19e047e801
commit
d1df6e6fba
3 changed files with 3 additions and 3 deletions
|
@ -711,7 +711,7 @@ def deprecated(
|
|||
- No warning if neither key nor replacement_key are provided
|
||||
- Adds replacement_key with default value in this case
|
||||
"""
|
||||
module = inspect.getmodule(inspect.stack()[1][0])
|
||||
module = inspect.getmodule(inspect.stack(context=0)[1].frame)
|
||||
if module is not None:
|
||||
module_name = module.__name__
|
||||
else:
|
||||
|
|
|
@ -59,7 +59,7 @@ def get_deprecated(
|
|||
and a warning is issued to the user.
|
||||
"""
|
||||
if old_name in config:
|
||||
module = inspect.getmodule(inspect.stack()[1][0])
|
||||
module = inspect.getmodule(inspect.stack(context=0)[1].frame)
|
||||
if module is not None:
|
||||
module_name = module.__name__
|
||||
else:
|
||||
|
|
|
@ -85,7 +85,7 @@ def async_activate_log_queue_handler(hass: HomeAssistant) -> None:
|
|||
|
||||
def log_exception(format_err: Callable[..., Any], *args: Any) -> None:
|
||||
"""Log an exception with additional context."""
|
||||
module = inspect.getmodule(inspect.stack()[1][0])
|
||||
module = inspect.getmodule(inspect.stack(context=0)[1].frame)
|
||||
if module is not None:
|
||||
module_name = module.__name__
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue