Skip to content

Commit

Permalink
userNameToFileName should not have a mutable default parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
madig committed Oct 7, 2021
1 parent a7e4d86 commit 31c3409
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Lib/fontTools/ufoLib/filenames.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class NameTranslationError(Exception):
pass


def userNameToFileName(userName: str, existing=set(), prefix="", suffix=""):
def userNameToFileName(userName: str, existing=None, prefix="", suffix=""):
"""
existing should be a case-insensitive list
existing should be a case-insensitive set
of all existing file names.
>>> userNameToFileName("a") == "a"
Expand Down Expand Up @@ -98,7 +98,7 @@ def userNameToFileName(userName: str, existing=set(), prefix="", suffix=""):
userName = ".".join(parts)
# test for clash
fullName = prefix + userName + suffix
if fullName.lower() in existing:
if existing is not None and fullName.lower() in existing:
fullName = handleClash1(userName, existing, prefix, suffix)
# finished
return fullName
Expand Down

0 comments on commit 31c3409

Please sign in to comment.