Issue 5741: SafeConfigParser incorrectly detects lone percent signs (original) (raw)

Created on 2009-04-12 12:35 by marcio, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg85899 - (view) Author: Márcio (marcio) Date: 2009-04-12 12:35
The SafeConfigParser class incorrectly detects lone percent signs, for example, it doesn't accept "100%%" as a valid value. The cause of this is the "_badpercent_re" regular expression: - The first alternative "%[^%]" fails with the string "%%_", because it matches "%_". - The second alternative "%$" fails with the string "%%", because it matches "%". --- from ConfigParser import * SafeConfigParser().set('DEFAULT', 'test', '100%%')
msg85911 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-04-12 17:24
Should be fixed in r71537. Will backport to 2.6.
msg85941 - (view) Author: Márcio (marcio) Date: 2009-04-13 11:43
Shouldn't the "replace('%%', '')" take place before "_interpvar_re.sub"? For example, the value "%%(test)s" should be accepted as valid but it isn't because "_interpvar_re" has already changed it to "%".
msg85942 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-04-13 12:36
You're right, of course. Fixed in r71564.
History
Date User Action Args
2022-04-11 14:56:47 admin set github: 49991
2009-04-13 12:36:43 georg.brandl set messages: +
2009-04-13 11:43:02 marcio set messages: +
2009-04-12 17:24:31 georg.brandl set status: open -> closednosy: + georg.brandlmessages: + resolution: fixed
2009-04-12 12:35:09 marcio create