Add _PyUnicodeWriter_WriteSubstring() function
Write a function to enable more optimizations:
* If the substring is the whole string and overallocation is disabled, just
keep a reference to the string, don't copy characters
* Avoid a call to the expensive _PyUnicode_FindMaxChar() function when
possible
diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py
index bc56fbc..bbce970 100644
--- a/Lib/test/test_format.py
+++ b/Lib/test/test_format.py
@@ -324,6 +324,9 @@
self.assertIs("{0:1s}".format(text), text)
self.assertIs("{0:5s}".format(text), text)
+ self.assertIs(text % (), text)
+ self.assertIs(text.format(), text)
+
def test_main():
support.run_unittest(FormatTest)