-
Notifications
You must be signed in to change notification settings - Fork 4
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
Forward port old bindings code which handled python import from ruby/perl, etc #21
Conversation
This version builds and works with python2 and python3. Python yast modules most be declared like this:
The parameters to Declare are the return type, followed by the types of the parameters. Valid types include any, boolean, string, integer, term, symbol, path, float, void, map, and list (the YCP types). |
Well, importing a python module via python code succeeds. I just got a segfault import python from ruby. |
I mistakenly removed the python initialization code (which isn't needed when a python module is called from python). Added this back and now python import from ruby is working. |
… YPythonNamespace These components allow python to be imported from ruby/perl bindings
We need all the bindings available in py2lang in order for python import from ruby/perl to work.
Import from file and path doesn't work in py3
- int ret = PyDict_SetItem(YPython::_pMainDicts, pModuleName, PyModule_GetDict(pMain)); + int ret = PyDict_SetItemString(YPython::_pMainDicts, module_name.c_str(), PyModule_GetDict(pMain)); Had to change the Dict access above because it didn't work from py3 when getting called from ruby. OTOH it worked fined from python (where the python client was calling import_module "aPythonModule"
* Make private data private * limit access to static methods, try and force access via the singleton instance These changes should make it easier to control access to the dirty internals such as pMainDicts. Probably there should be only one place where pMainDicts is created (the ctor ?).
Instead make sure there is just a single instance of _pMainDicts owned by the YPython singleton. This should make it easier to track problems
create new independant module (to store the references to the actual python module) This will avoid clashes with internal dictionaries for module objects created with the same name as already imported modules
Following the previous fix decrementing the Module pointer causes a crash on exit
For simplification lets remove stuff we don't use
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM good steps forward (more to go :-))
❌ Internal Jenkins job #8 failed |
❌ Public Jenkins job #7 failed |
Importing python modules from ruby/perl is now possible using this old code that's been re-integrated (and builds via python3).