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

Two bugs found via another PR #636

Merged
merged 1 commit into from
Nov 21, 2022
Merged

Two bugs found via another PR #636

merged 1 commit into from
Nov 21, 2022

Conversation

rocky
Copy link
Member

@rocky rocky commented Nov 21, 2022

rules.py __setstate__():
mathics.builtin.builtins was renamed to mathics.builtin._builtins
I guess on the assumption it was private.

It turns out it wasn't. And we were using the older (more correct) name "builtins" instead of "_builtins". Use "_builtins" to make this work. __setstate__ apparently isn't used right now, but would be if we used deepcopy(). Note that in #635, this variable is renamed system_builtins_dict.

rest:
Change imports of Builtin from mathics.builtin to mathics.builtin.base. mathics.builtin only accidentially imports Builtin.

rules.py __setstate__()
   `mathics.builtin.builtins` was renamed to `mathics.builtin._builtins`
   I guess on the assumption it was private.
   It turns out it wasn't. And we were using the older (more correct) name
   "builtins" instead of "_builtins". Use "_builtins" to make this
   work. `__setstate__` apparently isn't used right now, but would be if
   we used `deepcopy()`. Note that in another PR, this variable is
   renamed `system_builtins_dict`.

rest:
   Change imports of Builtin from `mathics.builtin` to
   mathics.builtin.base. `mathics.builtin only accidentially imports `Builtin`.
@rocky
Copy link
Member Author

rocky commented Nov 21, 2022

(After this goes in there will be a small merge conflict with #635 but that should be easy to fix)

Copy link
Contributor

@TiagoCavalcante TiagoCavalcante left a comment

Choose a reason for hiding this comment

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

LGTM


self.function = getattr(builtins[cls], name)
self.function = getattr(_builtins[class_name], name)
Copy link
Contributor

Choose a reason for hiding this comment

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

I Just wonder, is it OK to keep the name _builtins for something that is not private to the module?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a temporary change. #635 or a stripped down version of that has the more complete fix.

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case, let's merge and iterate.

@rocky rocky mentioned this pull request Nov 21, 2022
@rocky rocky merged commit 086fae3 into master Nov 21, 2022
@rocky rocky deleted the two-small-bugfixes branch November 21, 2022 19:25
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