replit / prybar

Pry open those interpreters.
GNU General Public License v2.0
253 stars 52 forks source link

Python 3.11 #115

Closed airportyh closed 1 year ago

airportyh commented 1 year ago

Why?

Want to support python 3.11. But we had some API incompatibilities with the new Python.

Changes

  1. Made custom changes to pry_python311.c and pry_python311.h for 3.11.
  2. Remove some stuff from flake to reduce development time
  3. Only change to pry_python311.c vs pry_python3.c: renamed _PyObject_CallNoArg to PyObject_CallNoArgs.

There are still 2 warnings:

  1. Py_DEPRECATED(3.11) PyAPI_FUNC(void) Py_SetProgramName(const wchar_t *);
  2. Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_SetArgvEx(int, wchar_t **, int)

after trying for a few hours I decided to give up for now. Main issue:

PySys_SetArgvEx has logic that updates the python sys.path and I found replicating that logic to be hard. You'd have to make sure the main file's dir is added to the sys.path, plus anything in PYTHONPATH, plus Python's home directory.

Testing

  1. cli args should work
  2. -i flag should work
  3. should be able to import a library from a sibling .py file