[merge] python 2.5 fixes

Martin Pool mbp at canonical.com
Fri Sep 22 02:27:27 BST 2006


On 22 Sep 2006, Marien Zwart <marienz at gentoo.org> wrote:
> The problem is that this problem is entirely inside optparse. The
> "self.error(str(err))" at the end of the traceback is
> "self.error(err)" in python 2.4's optparse, and "err" is an instance
> of optparse.BadOptionError that was initialized with the unicode
> string from the test, causing its __str__ method to return unicode.

Thanks very much for this.  I already have a branch where I fixed the
optparse, but not all of the others.  My reasoning was

 - either this is a bug in optparse, or optparse intends to disallow 
   unicode options; either way they do not work in python2.5

 - unicode options are not actually used by any bzr commands, and 
   i doubt they are used by any options

 - therefore we should just go along with optparse and remove support 
   for options whose names are non-ascii, and remove this from the test

> The only way I can think of to fix this inside bzr would be to copy
> the python 2.4 version of "parse_args" into bzr's OptionParser
> subclass, which is not exactly pretty.

If we really needed unicode options we could do that, but I don't think
we do.

> I think it would be nice if this could be merged for bzr 0.11.

I agree it would be nice but it's Robert's call as the release manager,
and I suspect this is too late for 0.11.

+1 for post-0.11 at least, or 0.11 if it's allowed.

-- 
Martin




More information about the bazaar mailing list