<meta name="robots" content="noindex" />
Future Work
- Extension of the RDA analysis for more complex interoperability aPIs, including use of DATALOG for analysis
- More extensive testing and comparisons of the CGs generated with those for existing CG tools
- Handling other ways of calling Python
- PyAPI _FUNC(int) PyRun _AnyFileExFlags(FILE *fp, const char *filename, int, PyCompilerFlags *);
- Also PyRun _AnyFile or PyRun _AnyFileEx or PyRun _AnyFileFlags
- if FP is associated with an interactive device, return PyRun _InteractiveLoop(); else return the result of PyRun _SimpleFile().
- IF filename is NULL, the function uses "???" as the filename
- PyAPI _FUNC(int) PyRun _SimpleStringFlags(const char * command, PyCompilerFlags *);
- also PyRun _SimpleString
- "command" is the python command(s) to be executed. The function will create a main function to add and run what is defined in "command"
- the string can be filtered to find default Python functions
- using a default name for this kind of python call to represent it in the graph (numbered default name to differ calls)
- PyAPI _FUNC(int) PyRun _InteractiveOneFlags(FILE *fp, const char *filename, PyCompilerFlags *);
- also PyRun _InteractiveOne
- fp is an interactive device (console, terminal) and filename is the name of the file
- executes only ONE statement from "filename"
- PyAPI _FUNC(int) PyRun _InteractiveLoopFlags(FILE *fp, const char *filename, PyCompilerFlags *);
- Also PyRun _InteractiveLoop
- fp is an interactive device (console, terminal) and filename is the name of the file
- executes statements from "filename"
- PyAPI _FUNC(PyObject *) PyRun _StringFlags(const char *str, int start, PyObject *globals, PyObject *locals, PyCompilerFlags *);
- Also PyRun _String
- runs "str" in the context specified by "globals" and "locals"
- create a default function name for this kind of call, then use it as nodes in the graph
- PyAPI _FUNC(PyObject *) PyRun _FileExFlags(FILE *, const char *, int, PyObject *, PyObject *, int, PyCompilerFlags *);
- Also PyRun _File or PyRun _FileExFlags or PyRun _FileExFlags
- Python source code is read from fp, and filename is the name of the file.
All these methods use a string as identifier to modules or commands. It should not be difficult to identify functions and analyze them. They are also similar to "PyRun_SimpleFile", which is already implemented .
- Pure Embedding (most safe and complete way of calling python)
- pFunc = PyObject _GetAttrString(PyObject *pModule, const char *func);
- func is the name of the function inside the module.
- pValue = PyObject _CallObject(PyObject *pFunc, PyObject *pArgs);
- pArgs is the list of arguments. pValue is the return value of the function. It must be converted to a C type
The problem with this approach is that there are multiple conversions and attributions before getting the reference to the function. A Reaching Definition Analysis is necessary to find the intermediate values.
There is a pattern for the steps to be performed, and it also gives more information about the function and the module. So it will make it easier to resolve scoping issues.
Future work for Pybind11
- Handling of C++ defined function import rather than whole C++ module import in Python file.( E.g., from example import Pet)
- Handling situation where the function is defined in the pybind11 binding statement. (E.g., m.def("add",[](int a){ return a+a;}) )
- Handling cases of function overloading i.e., more than one function defined with the same name but different parameters.
Permissions
- Persons/group who can view/change the page:
-- (c) Fordham University Robotics and Computer Vision
Topic revision: r3 - 2019-05-29
- LabTech