[New-bugs-announce] [issue11694] xdrlib raises ConversionError in inconsistent way

Filip Gruszczyński report at bugs.python.org
Sun Mar 27 13:12:16 CEST 2011

New submission from Filip Gruszczyński <gruszczy at gmail.com>:

xdrlib defines ConversionError, but very seldom uses it. For example:

    def pack_float(self, x):
        try: self.__buf.write(struct.pack('>f', x))
        except struct.error as msg:
            raise ConversionError(msg)

But it doesn't do so here:

    def pack_uint(self, x):
        self.__buf.write(struct.pack('>L', x))

Shouldn't that be more consistent?

I am happy to write a patch, that will make xdrlib raise ConversionError, as well as write proper test (I believe xdrlib tests should get some love altogether, so I would add a separate test case for this).

components: Library (Lib)
messages: 132309
nosy: gruszczy
priority: normal
severity: normal
status: open
title: xdrlib raises ConversionError in inconsistent way
type: behavior
versions: Python 3.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list