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

xreload likely breaks for classmethods #11

Open
d-maurer opened this issue Feb 25, 2019 · 0 comments
Open

xreload likely breaks for classmethods #11

d-maurer opened this issue Feb 25, 2019 · 0 comments

Comments

@d-maurer
Copy link

plone.reload.xreload._update_class assumes that Python 3 does not use method objects on class access. However, this is wrong for classmethods: accessing a @classmethod on a class returns a method object (not a function).

The _update_method function uses `six.get_unbound_function" in order to get a function. However, for Python 3, this is the identity function; thus, is does not change a method into a function object.

The upcoming dm.plonepatches.reload will use an auxiliary function def func(f): return getattr(f, "__func__", f) to transform a function or method object into the associated function. This works reliably for Python 2.7 and Python 3.

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