summaryrefslogtreecommitdiffstats
path: root/Lib/string.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2004-11-01 03:52:43 (GMT)
committerBarry Warsaw <barry@python.org>2004-11-01 03:52:43 (GMT)
commit8c72eae2378fde4e473feadd4c7139d9ec9cb8e3 (patch)
tree6d780db607a15f5d3c025cbfaa7f7fb6811da93d /Lib/string.py
parent4590c00e89e349d6ec7247d1c4e7e22222e8ae76 (diff)
downloadcpython-8c72eae2378fde4e473feadd4c7139d9ec9cb8e3.zip
cpython-8c72eae2378fde4e473feadd4c7139d9ec9cb8e3.tar.gz
cpython-8c72eae2378fde4e473feadd4c7139d9ec9cb8e3.tar.bz2
SF patch #1056967, changes the semantics of Template.safe_substitute() to not
raise a ValueError for dangling delimiters (the delimiter itself is returned).
Diffstat (limited to 'Lib/string.py')
-rw-r--r--Lib/string.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/string.py b/Lib/string.py
index e10087e..7c0e001 100644
--- a/Lib/string.py
+++ b/Lib/string.py
@@ -199,7 +199,7 @@ class Template:
if mo.group('escaped') is not None:
return self.delimiter
if mo.group('invalid') is not None:
- self._invalid(mo)
+ return self.delimiter
raise ValueError('Unrecognized named group in pattern',
self.pattern)
return self.pattern.sub(convert, self.template)