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: unable to reload top level modules correctly #10

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

xreload: unable to reload top level modules correctly #10

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

Comments

@d-maurer
Copy link

d-maurer commented Feb 25, 2019

plone.reload.xreload.Reloader.reload determines a wrong __name__ for top level modules. For those modules, pkgname is defined as None and the name is defined as '%s.%s' % (pkgname, modname). As a consequence, the objects in the temporary module get a wrong __module__ attribute (of the form None.<modname>) which causes later that the old objects are overridden (instead of updated).

Recommendation: Replace

        tmpns = {'__name__': '%s.%s' % (pkgname  modname),
                 '__file__': filename,
                 '__doc__': modns['__doc__']}

by

        tmpns = {'__name__': self.mod.__name__,
                 '__file__': filename,
                 '__doc__': modns['__doc__']}
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