Skip to content

Custom Exceptions Causing TypeErrors #15

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

Closed
sommersoft opened this issue Apr 14, 2020 · 9 comments
Closed

Custom Exceptions Causing TypeErrors #15

sommersoft opened this issue Apr 14, 2020 · 9 comments
Labels
bug Something isn't working

Comments

@sommersoft
Copy link
Collaborator

A user in Discord brought this issue up. They receive the following exception when trying to use the library:

File "adafruit_am2320.py", line 84, in <module>
TypeError: multiple bases have instance lay-out conflict

Line 84 points to a custom exception, which came from #9. This was included in release 1.1.4 onward.

The user confirmed that release 1.1.3 does not raise the TypeError exception.

@jerryneedell
Copy link
Contributor

jerryneedell commented Apr 16, 2020

hmm -- I reproduced this error on a few CP boards -- grandcentral, teensy 4.0
but (v1.2.1) it works fine an a Raspberry Pi 4...

reintroducing the "pass" statements does not fix it for the CP boards.
possibly a CPython incompatibility in CP?

@jepler
Copy link

jepler commented Apr 16, 2020

Yes, it looks like this construct is not supported on CircuitPython. We're not likely to be able to add support for it, so unfortunately I don't see a way forward except for reverting it. Perhaps someone else does.

>>> class E(Exception): pass
... 
>>> class D(E, ValueError): pass
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: multiple bases have instance lay-out conflict

Any time an inheritance tree of classes includes more than one native base class among all its bases, this error will occur.

@jerryneedell
Copy link
Contributor

I must say that this is one of most perplexing error messages I have ever received TypeError: multiple bases have instance lay-out conflict mostly due to my own ignorance of Python details, but still, could it be a bit more obtuse? ;-)

@tannewt
Copy link
Member

tannewt commented Apr 21, 2020

Could we just have the custom Exceptions not inherit from two types? Specifically, I think we can remove AM2320Exception and just leave the stock parents.

@jerryneedell
Copy link
Contributor

Could we just have the custom Exceptions not inherit from two types? Specifically, I think we can remove AM2320Exception and just leave the stock parents.

I have no idea what that means, but it sounds fine to me ;-)
I only jumped in because it was suggested that it be reverted and it was simple to do.
If you can tell me what to change, I can update the PR or feel free to take control of this.

@jerryneedell
Copy link
Contributor

jerryneedell commented Apr 21, 2020

@tannewt ah -- I see the PR was merged -- Do you want to create a new PR to address this? Should I hold off on releasing?

@tannewt
Copy link
Member

tannewt commented Apr 22, 2020

@jerryneedell I don't plan on making a PR but it'd be great if someone else would. I think it's ok to do a major release now to get the fix out.

@kattni kattni added the bug Something isn't working label May 4, 2020
@jposada202020
Copy link
Contributor

According to what I see this was resolved with 1.2.2 - Reverted PR #9. If there is no disagreement I think we can proceed to close this issue

@jposada202020
Copy link
Contributor

Closing. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants