mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-12 23:16:31 +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()
|
||||
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):
|
||||
exit(1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user