Skip to content

Commit 056dd07

Browse files
committed
Use None as the sentinel
1 parent e28e43f commit 056dd07

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

Lib/string.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ def capwords(s, sep=None):
5050

5151
####################################################################
5252
_sentinel_dict = {}
53-
_sentinel_flags = object()
5453

5554

5655
class _TemplatePattern:
@@ -71,7 +70,7 @@ class Template:
7170
# See https://bugs.python.org/issue31672
7271
idpattern = r'(?a:[_a-z][_a-z0-9]*)'
7372
braceidpattern = None
74-
flags = _sentinel_flags # default: re.IGNORECASE
73+
flags = None # default: re.IGNORECASE
7574

7675
pattern = _TemplatePattern() # use a descriptor to compile the pattern
7776

@@ -99,7 +98,7 @@ def _compile_pattern(cls):
9998
(?P<invalid>) # Other ill-formed delimiter exprs
10099
)
101100
"""
102-
if cls.flags is _sentinel_flags:
101+
if cls.flags is None:
103102
cls.flags = re.IGNORECASE
104103
pat = cls.pattern = re.compile(pattern, cls.flags | re.VERBOSE)
105104
return pat

0 commit comments

Comments
 (0)