Skip to content

Alvik instance error #31

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

Merged
merged 1 commit into from
Nov 19, 2024
Merged

Alvik instance error #31

merged 1 commit into from
Nov 19, 2024

Conversation

eigen-value
Copy link
Contributor

On multiple calls to ArduinoAlvik.stop you got the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/lib/arduino_alvik/arduino_alvik.py", line 381, in stop
AttributeError: 'type' object has no attribute '_instance'

Unbinding the current instance from the ArduinoAlvik singleton class in the stop method is IMO useless and has potential side effects like:

  • If one alvik obj is stopped and another one is created you will have 2 instances of ArduinoAlvik which beats the purpose of the singleton class

The right way would be unbinding the instance right before it is deleted. Unfortunately the special method 'del' is not implemented in MP for user defined classes, see here

@eigen-value eigen-value requested review from ubidefeo and gbr1 November 8, 2024 11:15
@eigen-value eigen-value changed the base branch from main to dev November 8, 2024 11:17
Copy link
Member

@gbr1 gbr1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gbr1
Copy link
Member

gbr1 commented Nov 19, 2024

please @ubidefeo make your review

@eigen-value eigen-value requested a review from gbr1 November 19, 2024 14:11
Copy link
Contributor

@ubidefeo ubidefeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested and works as expected:
after the first call to .stop() on the instance, any other .stop() call won't produce the error reported

@eigen-value eigen-value merged commit e55f163 into dev Nov 19, 2024
1 check passed
@gbr1 gbr1 deleted the alvik-instance-error branch November 25, 2024 10:48
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

Successfully merging this pull request may close these issues.

3 participants