constant, we cannot guarantee its immutability once we return it inside of a zval.
…ult, we now intercept sys.stdout and sys.stderr. The former is redirected into PHP's output stream while the latter results in E_NOTICE errors.
…n false on all errors (instead of null).
version string. We use this in our shell example.
…string from the "info" output. The latter isn't very useful because the extension is comprised of mulitple source files.
the command line ('php -i') output.
…n C API. python_error() now asserts the thread state before touching the Python C API.
using a thread state request global. Each interpreter thread is basically its own Python environment within the global Python process. This prevents Python environment "pollution" between multiple requests and allows us to implement interesting features like stdout/stderr redirection. It also allows us to run more efficiently (and correctly!) in multithreaded (i.e. ZTS) environments.
…ning. The result is truly const, however, which allows us to avoid duplicating the string value here.
…thin the embedded Python environment).
…e. This allows them to be used with a wider range of existing PHP functions (such as get_object_vars()).
…oved efficiency and error handling. All of these functions now return a status code and assign their result to a pre-allocated / pre-initialized zval*.
…e can perform our own error reporting. (PyRun_SimpleString() uses Pythons error printing routines internally.) The implementations of python_eval() and python_exec() are now quite similar, differing only in how they handle return values. They may be merged into a single routine in the future.
command string. The former is handled by the python_eval() function and the latter by the (new) python_exec() function.
…object may be NULL, free our string references in python_error(), and correct some whitespace.
This round of work also includes a rather large number of iterative improvements to the previous code brought about by both my increased understanding of PHP object internals and the benefit of having a working codebase on which to iterate and improve. A two year break from the code didn't hurt much, either. There is still quite a bit to be done before this code can emerge from its current 'alpha' state, but it's starting to shape up rather nicely. A lot of functionality is still missing, however, so I wouldn't consider any of this to actually be usable at this state, though. At the moment, only the "embedded Python" code has been reborn. The Python PHP extension module (i.e., the code which gives the embedded Python environment access to the PHP runtime) still needs to be rewritten. At the moment, I'm only developing in a Win32 environment. I'll test the Unix build some time soon once I feel like tinkering with it. I don't expect there to be particularly broken there, however, aside from perhaps the build infrastructure itself. In addition to the source-level changes, I've also relicensed this extension under an MIT License.
This is still very much a work-in-progress.
…extension from loading under Windows.
- Capitalize the name of the Python class (used to be "python"). - Prefer zval to pval for consistency.
…sion functions. - Use these functions to convert variable PHP function arguments to Python argument tuples. - Python functions now accept a variable list of arguments instead of a discrete array of argument. Passing an array of arguments no longer yields the expected result.
directives, and Python copyright. - Add a few more TODO items.
…TRING where I had intended ZVAL_STRINGL, but I ended up having that syntax wrong, too. - Change the way that python_attribute_handler's return value is handled. - Correct some comments.
- Split python.pythonpath into python.prepend_path and python.append_path - Added py_path(), py_path_prepend(), and py_path_append() - Added py_import(), which imports a module into the Python environment - Added py_call(), which calls a function in a given Python module - Corrected the conversion of None values from Python - Added tests for all of the above
- Add some more TODO items - Return NULL for Python None objects