Allow empty default/error value in substitution

This commit is contained in:
Mohamed Akram 2021-12-30 14:19:53 +04:00 committed by Muayyad Alsadi
parent 481c6d0a41
commit 0bd493f1ba

View File

@ -179,8 +179,8 @@ var_re = re.compile(r"""
(?:{
(?P<braced>[_a-zA-Z][_a-zA-Z0-9]*)
(?:(?P<empty>:)?(?:
(?:-(?P<default>[^}]+)) |
(?:\?(?P<err>[^}]+))
(?:-(?P<default>[^}]*)) |
(?:\?(?P<err>[^}]*))
))?
})
)