Issue 5708: Tiny code polishing to unicode_repeat (original) (raw)

Issue5708

Created on 2009-04-06 08:41 by larry, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
lch.unicoderepeat.r71304.diff larry,2009-04-06 08:41
Messages (2)
msg85620 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2009-04-06 08:41
Two minor tweaks to unicode_repeat: * If the number of repeats (len) is < 1, we're always going to return the empty Unicode string. So I incr and return unicode_empty. * The current code has "if (done < nchars)" around the first copy. A little data-flow analysis of the code will show you that done is always 0 and nchars is always >= str->length. So the check is unnecessary--we're always going to do that first copy. I removed the if and set done to str->length directly. Hope I got it right!
msg85896 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-04-12 12:01
Committed in r71506.
History
Date User Action Args
2022-04-11 14:56:47 admin set github: 49958
2009-04-12 12:01:57 georg.brandl set status: open -> closedresolution: acceptedmessages: +
2009-04-07 22:59:39 georg.brandl set assignee: georg.brandlnosy: + georg.brandl
2009-04-06 08:41:43 larry create