[New-bugs-announce] [issue26126] Possible subtle bug when normalizing and str.translate()ing

Mark Summerfield report at bugs.python.org
Fri Jan 15 13:04:50 EST 2016


New submission from Mark Summerfield:

I am using Python 3.4.3 on Xubuntu 14.04 LTS 64-bit.

I have a program that when run repeatedly sometimes what I expect, and sometimes does not:

$ ~/tmp/normbug.py 
OK ('The AEnid oevre', '==', 'The AEnid oevre')
$ ~/tmp/normbug.py 
OK ('The AEnid oevre', '==', 'The AEnid oevre')
$ ~/tmp/normbug.py 
OK ('The AEnid oevre', '==', 'The AEnid oevre')
$ ~/tmp/normbug.py 
BUG ('The aenid oevre', '!=', 'The AEnid oevre')
$ ~/tmp/normbug.py 
OK ('The AEnid oevre', '==', 'The AEnid oevre')
$ ~/tmp/normbug.py 
OK ('The AEnid oevre', '==', 'The AEnid oevre')
$ ~/tmp/normbug.py 
OK ('The AEnid oevre', '==', 'The AEnid oevre')
$ ~/tmp/normbug.py 
OK ('The AEnid oevre', '==', 'The AEnid oevre')
$ ~/tmp/normbug.py 
OK ('The AEnid oevre', '==', 'The AEnid oevre')
$ ~/tmp/normbug.py 
BUG ('The aenid oevre', '!=', 'The AEnid oevre')
$ ~/tmp/normbug.py 
BUG ('The aenid oevre', '!=', 'The AEnid oevre')
$ ~/tmp/normbug.py 
OK ('The AEnid oevre', '==', 'The AEnid oevre')

As you can see, sometimes the left (actual) is case-folded, and sometimes it isn't which is surprising given the code (which is attached).

Of course this could be a mistake on my part; maybe I've misunderstood how the unicode normalizing works.

----------
files: normbug.py
messages: 258314
nosy: mark
priority: normal
severity: normal
status: open
title: Possible subtle bug when normalizing and str.translate()ing
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file41627/normbug.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26126>
_______________________________________


More information about the New-bugs-announce mailing list