Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for loading Python at runtime (supports both Python 3 a…
…nd 2) (#20674) * Added new PythonLibrary struct to load Python library and symbols dynamically at runtime - This adds support for both Python 3 and 2 with the same codebase. - You can force a version of Python with the PYTHON_VERSION environment variable, a Python library path with PYTHON_LIBRARY and enable logging with PYTHON_LOADER_LOGGING. - The implementation comes from the PythonKit Swift package (https://github.com/pvieito/PythonKit) removing the Foundation dependency. * Style and structure changes * Adding support for setting a Python version on-process * Default minor version to nil * Cleaned private method * Update CMakeLists adding new files and removing CPython module * Force setting an non-nil value type for Linux * Redefined Python symbols to avoid libSyntax bug (SR-9316) * Update tests * `init(owning:)` should retain, while `init(borrowing:)` should not. * Use loaded symbol values instead of their addresses as the type argument to `isType(_:type:)`. * Make loaded symbols `let`s since they are themselves the address we need * Minor clean-up. - `()` -> `Void`. - Drop parentheses at the result position from single-result function signatures. - Replace !(==) with != in `isType(_:type:)`. * Delete `_Py_TrueStructb` * Fix ParsableInterface tests
- Loading branch information