Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fixed bug of Exec method #591 #594

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

Conversation

yagweb
Copy link
Contributor

@yagweb yagweb commented Jan 10, 2018

What does this implement/fix? Explain your changes.

This PR makes the RunString method acts just like the exec/eval method in CPython.

In CPython, the default value of parameter 'locals' of exec/eval method is obtained by calling the method locals() when its given value is None. So only when the exec/eval method is called in a function, the default value of parameter 'locals' is different from the value of 'globals'.

Since in pythonnet the Eval/Exce method can only be called from the global/module scope, it meaningful to directly set the value of locals to the value of globals when it is null.

...

Does this close any currently open issues?

#591

...

Any other comments?

No.

...

Checklist

Check all those that are applicable and complete.

  • Make sure to include one or more tests for your change
  • If an enhancement PR, please create docs and at best an example
  • Add yourself to AUTHORS
  • Updated the CHANGELOG

@den-run-ai
Copy link
Contributor

@yagweb looks great! let's wait for one more approval. the tests on appveyor fail for 2 environments due to github connection failure with OpenSSL. so nothing to worry about!

Copy link
Member

@filmor filmor left a comment

Choose a reason for hiding this comment

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

I dislike Python's default here, but it is good to be consistent with it, thanks for the patch :)

@den-run-ai den-run-ai merged commit 9b62597 into pythonnet:master Jan 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.

3 participants