mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-14 07:47:09 +08:00
Fix ResourceWarning (#520)
This commit is contained in:
@@ -81,7 +81,8 @@ def extract_django_settings_module(config_file_path: Optional[str]) -> str:
|
|||||||
|
|
||||||
parser = configparser.ConfigParser()
|
parser = configparser.ConfigParser()
|
||||||
try:
|
try:
|
||||||
parser.read_file(open(cast(str, config_file_path)), source=config_file_path)
|
with open(cast(str, config_file_path)) as handle:
|
||||||
|
parser.read_file(handle, source=config_file_path)
|
||||||
except (IsADirectoryError, OSError):
|
except (IsADirectoryError, OSError):
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user