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:
Erik Montnemery 2021-04-09 07:26:09 +02:00 committed by GitHub
parent 19e047e801
commit d1df6e6fba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View file

@ -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: