-
Notifications
You must be signed in to change notification settings - Fork 34
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
Device.__getstate__() is broken #86
Comments
I think I don't have "getstate" method in my tests, it may be a bug/typo. Let me check in deep |
Well, probably "return None" is the issue here. Introduced 10 months ago. Trying to remember, I think I founded some issue mapping the data. Probably left the none by a mistake. I'm going to have a look on how to rescue it. |
Actually I'm just trying to get psmqtt project to work. https://github.com/eschava/psmqtt/blob/master/src/handlers.py#L538 it's invoking the getstate() method to get a nice dictionary to perform a lookup using a key obtained from the configuration file. In practice in the config file of that utility you list whatever SMART attribute you're interested in... |
and thanks for the fast answer! |
Please, check when you are able. It should returns a valid dict now. You may be able to install the dev version from git or from pip ( https://pypi.org/project/pySMART/1.3.1.dev8/ ) If you can provide me more info about something you are missing in that representation I may be able to provide a better output. The more info the better. |
thanks @ralequi for the very fast fix! thanks! |
Hi, This is the reason behind getstate : https://docs.python.org/3/library/pickle.html#object.__getstate__ : to serialize the class under certain generic libs. The dict function you are suggesting is in fact defined by default. And do you know which name is? Yeah, exactly: https://docs.python.org/3/library/stdtypes.html#object.__dict__ I don't like that magics functions, but while there are people using it, I can't delete them. Thanks for your report, |
Describe the bug
The method getstate() of Device class used to return a dictionary.
Since this commit: b9e0a64#diff-75bf1e4cf04c226a1b9986d88bd9d3882dbb1e096e70920a63e243f83a9d278cR476
the implementation just returns "None".
Was that just a typo?
thanks!
The text was updated successfully, but these errors were encountered: