Skip to content

Commit 7572dbc

Browse files
committed
Add IO check before save configuration1
1 parent c4709d2 commit 7572dbc

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

news/11920.bugfix.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Add permission check before configuration
1+
Add permission check before configuration

src/pip/_internal/configuration.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,10 @@ def save(self) -> None:
216216
parser.write(f)
217217
except IOError as error:
218218
raise ConfigurationError(
219-
"An error occurred while writing to the configuration file: {0}\n \
220-
Error message: {1}".format(fname, error)
219+
"An error occurred while writing to the configuration file: {0}\n \
220+
Error message: {1}".format(
221+
fname, error
222+
)
221223
)
222224

223225
#
@@ -346,7 +348,7 @@ def iter_config_files(self) -> Iterable[Tuple[Kind, List[str]]]:
346348
# per-user configuration next
347349
should_load_user_config = not self.isolated and not (
348350
config_file and os.path.exists(config_file)
349-
)
351+
)
350352

351353
if should_load_user_config:
352354
# The legacy config file is overridden by the new config file

0 commit comments

Comments
 (0)