Skip to content

Fix __slots__ error with metaCookie #71 #72

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
Jul 11, 2018
Merged

Conversation

craig-sh
Copy link
Contributor

@craig-sh craig-sh commented Jul 10, 2018

Tested fix on python 2.7 and 3.6

@grisha
Copy link
Owner

grisha commented Jul 10, 2018

Could you, for posterity, explain what is happening here? (I wrote this so long ago I cannot remember how the metaclass stuff worked).

@craig-sh
Copy link
Contributor Author

I haven't completely wrapped my head around metaclasses but from what I understand the fix works because the return statement return type.__new__(...) in metaCookie's __new__(...) function returns an instance of metaCookie.
This is why the __init__ of metaCookie is called. Adding in the expires property at init stage instead doesn't cause any issues.

However, I'm not sure what changed in the newer versions of python that actually trigger ValueError: 'expires' in __slots__ conflicts with class variable...

@grisha grisha merged commit 902bb87 into grisha:master Jul 11, 2018
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.

2 participants