Issue 28289: ImportError.init doesn't reset not specified exception attributes (original) (raw)

ImportError.init sets only specified attributes ("msg", "name" or "path"), and left not explicitly specified attributes unchanged.

err = ImportError('test', name='name') err.args, err.msg, err.name, err.path (('test',), 'test', 'name', None) err.init(path='path') err.args, err.msg, err.name, err.path ((), 'test', 'name', 'path')

In above example err.init(path='path') sets attributes "args" and "path", but not "msg" and "name".

I'm not sure whether can this be considered as a bug.