Bug 450787
Summary: | optparse doesn't handle Unicode help text | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 5 | Reporter: | Bryan Mason <nobody+bjmason> | ||||||
Component: | python | Assignee: | James Antill <james.antill> | ||||||
Status: | CLOSED WONTFIX | QA Contact: | Martin Jenner <mjenner> | ||||||
Severity: | low | Docs Contact: | |||||||
Priority: | low | ||||||||
Version: | 5.2 | CC: | crobinso | ||||||
Target Milestone: | rc | ||||||||
Target Release: | --- | ||||||||
Hardware: | All | ||||||||
OS: | Linux | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | Environment: | ||||||||
Last Closed: | 2008-06-12 16:34:34 UTC | Type: | --- | ||||||
Regression: | --- | Mount Type: | --- | ||||||
Documentation: | --- | CRM: | |||||||
Verified Versions: | Category: | --- | |||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||
Embargoed: | |||||||||
Bug Depends On: | |||||||||
Bug Blocks: | 446950 | ||||||||
Attachments: |
|
Description
Bryan Mason
2008-06-11 00:38:53 UTC
Created attachment 308878 [details]
Test case
I should have a proposed patch that fixes this shortly. Created attachment 309010 [details] Proposed patch Make optparse handle Unicode correctly. Adapted from upstream patches to optparse.py here: http://svn.python.org/view/python/trunk/Lib/optparse.py?rev=46861&r1=46507&r2=46861 and here: http://svn.python.org/view/python/trunk/Lib/optparse.py?rev=50791&r1=46863&r2=50791 Was this intended to be filed against python-virtinst? It seems like the patch you are presenting is against python itself. D'oh! I was working on two bugs at once and got confused. Yes, this should be against python, not python-virtinst. Sorry. In general python just doesn't play well with unicode, IMO. The whole API pretty much guarantees tracebacks. python 2.5.1 does the same thing, we we worked around it in yum by doing: - self.optparser.print_help() + sys.stdout.write(self.optparser.format_help()) - self.optparser.print_usage() + sys.stdout.write(self.optparser.format_usage()) ...see upstream commit: a3a53f16b45e06aeaa3666b47705dc879b182724 I'm loath to change anything in python/optparse to try and fix/workaround this, because as I said, it's almost impossible to end up with something you _know_ won't traceback under all sets of input. |