Skip to content

Commit

Permalink
pylint does not crash when PYLINT_HOME does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
AWhetter committed Aug 21, 2021
1 parent bbc4f66 commit 0624dc8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ What's New in Pylint 2.10.1?
============================
Release date: TBA

..
Put bug fixes that should not wait for a new minor version here
* pylint does not crash when PYLINT_HOME does not exist.

Closes #4883


What's New in Pylint 2.10.0?
Expand Down
15 changes: 9 additions & 6 deletions pylint/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE

import os
import pathlib
import pickle
import sys
from datetime import datetime
Expand Down Expand Up @@ -86,12 +87,14 @@
file=sys.stderr,
)
# Remove old spam prevention file
for filename in os.listdir(PYLINT_HOME):
if prefix_spam_prevention in filename:
try:
os.remove(os.path.join(PYLINT_HOME, filename))
except OSError:
pass
if os.path.exists(PYLINT_HOME):
for filename in os.listdir(PYLINT_HOME):
if prefix_spam_prevention in filename:
try:
os.remove(os.path.join(PYLINT_HOME, filename))
except OSError:
pass

# Create spam prevention file for today
try:
with open(spam_prevention_file, "w", encoding="utf8") as f:
Expand Down

0 comments on commit 0624dc8

Please sign in to comment.