Skip to content
This repository has been archived by the owner on Apr 29, 2023. It is now read-only.

creating an instance of a union does not name the actual type in the resulting exception #127

Open
apexo opened this issue Jul 14, 2020 · 0 comments

Comments

@apexo
Copy link

apexo commented Jul 14, 2020

pyxb/pyxb/binding/basis.py

Lines 1295 to 1296 in 14737c2

def __new__ (self, *args, **kw):
raise pyxb.LogicError('%s: cannot construct instances of union' % (self.__class__.__name__,))

Because in __new__ the first argument is actually the class (of which an instance is to be constructed), so if we actually want this message to be helpful, it should probably look like this (i.e.: without the .__class__):

raise pyxb.LogicError('%s: cannot construct instances of union' % (self.__name__,)) 

… otherwise the message will always be "type: cannot construct instance of union"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant