• Dan's avatar
    Call PySys_SetArgv when initializing interpreter. (#2341) · 930bb16c
    Dan authored
    
    
    * Call PySys_SetArgv when initializing interpreter.
    
    * Document argc/argv parameters in initialize_interpreter.
    
    * Remove manual memory management from set_interpreter_argv in favor of smart pointers.
    
    * Use size_t for indexers in set_interpreter_argv.
    
    * Minimize macros for flow control in set_interpreter_argv.
    
    * Fix 'unused variable' warning on Py2
    
    * whitespace
    
    * Define wide_char_arg_deleter outside set_interpreter_argv.
    
    * Do sys.path workaround in C++ rather than eval.
    
    * Factor out wchar conversion to a separate function.
    
    * Restore widened_argv variable declaration.
    
    * Fix undeclared widened_arg variable on some paths.
    
    * Use delete[] to match new wchar_t[].
    
    * Fix compiler errors
    
    * Use PY_VERSION_HEX for a cleaner CVE-2008-5983 mode check.
    
    * Fix typo
    
    * Use explicit type for deleter so delete[] works cross-compiler.
    
    * Always use PySys_SetArgvEx because pybind11 doesn't support pythons that don't include it.
    
    * Remove pointless ternary operator.
    
    * Use unique_ptr.reset instead of a second initialization.
    
    * Rename add_program_dir_to_path parameter to clarify intent.
    
    * Add defined() check before evaluating HAVE_BROKEN_MBSTOWCS.
    
    * Apply clang-tidy fixes
    
    * Pre-commit
    
    * refactor: use const for set_interpreter_argv
    
    * Try to fix const issue and allocate vector properly
    
    * fix: copy strings on Python 2
    
    * Applying clang-format-diff relative to master.
    
    The only manual change is an added empty line between pybind11 and system `#include`s.
    
    ```
    git diff -U0 --no-color master | python3 $HOME/clone/llvm-project/clang/tools/clang-format/clang-format-diff.py -p1 -style=file -i
    ```
    Co-authored-by: default avatarBoris Staletic <boris.staletic@gmail.com>
    Co-authored-by: default avatarAaron Gokaslan <skylion.aaron@gmail.com>
    Co-authored-by: default avatarHenry Schreiner <henryschreineriii@gmail.com>
    Co-authored-by: default avatarRalf W. Grosse-Kunstleve <rwgk@google.com>
    930bb16c
test_interpreter.cpp 11.6 KB