jenkins-bot submitted this change.
[bugfix] Only ignore FileExistsError when creating the api cache
Bug: T295924
Change-Id: Ib2e83060857e748ddf56a019d9fd615c6ed9a229
---
M pywikibot/data/api.py
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 2cf5144..acde07e 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -12,8 +12,8 @@
import pprint
import re
import traceback
+
from collections.abc import Container, MutableMapping, Sized
-from contextlib import suppress
from email.generator import BytesGenerator
from email.mime.multipart import MIMEMultipart as MIMEMultipartOrig
from email.mime.nonmultipart import MIMENonMultipart
@@ -1933,13 +1933,14 @@
def _make_dir(dir_name: str) -> str:
"""Create directory if it does not exist already.
- The directory name (dir_name) is returned unmodified.
+ .. versionchanged:: 7.0
+ Only `FileExistsError` is ignored but other OS exceptions can
+ be still raised
:param dir_name: directory path
- :return: directory name
+ :return: unmodified directory name for test purpose
"""
- with suppress(OSError): # directory already exists
- os.makedirs(dir_name)
+ os.makedirs(dir_name, exist_ok=True)
return dir_name
def _uniquedescriptionstr(self) -> str:
To view, visit change 740297. To unsubscribe, or for help writing mail filters, visit settings.