Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that CompondValue class as a __values__ attribute in __init__ #1383

Open
dagostinelli opened this issue Jun 25, 2023 · 0 comments
Open

Comments

@dagostinelli
Copy link

Looking in valueobjects.py, around here:

I see:

class CompoundValue:
    """Represents a data object for a specific xsd:complexType."""

    _xsd_type: "ComplexType"
    _xsd_elm: "Element"

    def __init__(self, *args, **kwargs):
        values = OrderedDict()

        # Can be done after unpickle
        if self._xsd_type is None:
            return

        # <omit>
        self.__values__ = values        

Since there's an early return, the self.__values__ attribute does not exist.

Looking at the rest of the class, I see that many of the dunder methods are looking for self.__values__ attribute (ex: __repr__ looks for it)

It could be the cause for #1155 and a similar error that I am seeing. In my case, my code is hitting __repr__ and the object doesn't have __values__ attribute yet.

I think the fix is to ensure that __values__ attribute exists before returning from __init__

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

No branches or pull requests

1 participant