-
Notifications
You must be signed in to change notification settings - Fork 20
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
Dylink doesn't allow us to call functions that start with '_' #164
Comments
These tests try to illustrate Python's behavior on `import`ing or `from MODULE import *`ing a name that starts with an underscore (``_'') character, and check whether `dylink`'s corresponding functions `dy_import_module` and `dy_import_module_symbols` perform like their Python counterparts. The expected behavior is to * do import `module._underscorename`, but * don't add `_underscorename` via `from module import *` Alas, `dylink` doesn't conform currently: SeattleTestbed#164 .
Indeed, this issue (and also #153) shows that
However, the corresponding |
See also here for Python's import behavior: https://docs.python.org/2/reference/simple_stmts.html#the-import-statement |
This patch makes `dylink.r2py`'s import functions behave more like their Python counterparts. Specifically, * `dy_import_module_symbols` (akin to Python's `from MODULE import *`) now correctly *skips* names that start with an underscort ("_"), and * `dy_import_module` (akin to Python's `import MODULE`) now *does* correctly import these names. The new test cases supplied by the parent commit, bb285e4 , thus all pass now.
Note: This was SeattleTestbed/repy_v2#60 previously. I'm just attaching it to the correct issue tracker, but have not reviewed it for aptness.
If we import a file using dylink, it won't allow us to call functions that start with an underscore. This is different from how python import works. Not sure if this is an intended behaviour or not. Below is a piece of code that fails.
foo.py:
bar.py:
If we run bar.py, we get the following error when calling foo._foo() (when using dylink):
However once we use 'import' to import it, we are able to call foo._foo().
The text was updated successfully, but these errors were encountered: