On 05/03/2019 16:42, Wei Liu wrote: > With the help of two porting guides and cpython source code: > > 1. Use PyUnicode to replace PyString counterparts. > 2. Use PyVarObject_HEAD_INIT and provide compatibility for 2.5 and > earlier. > 3. Remove usage of Py_FindMethod. > 4. Use new module initialisation routine. > > For #3, Py_FindMethod was removed, yet an alternative wasn't > documented. The code is the result of reverse-engineering cpython > commit 6116d4a1d1 > > https://docs.python.org/3/howto/cporting.html > http://python3porting.com/cextensions.html > > Signed-off-by: Wei Liu <wei.l...@citrix.com>
Marek already made the tools/python/* libraries compatible with Py2 and Py3 The following commits are the relevant ones: * be6b316 - python: handle long type in scripts (2 years ago) <Marek Marczykowski-Górecki> * e16c705 - python: adjust module initalization for Python3 (2 years ago) <Marek Marczykowski-Górecki> * dd986cd - python: use PyLong_* for constructing 'int' type in Python3 (2 years ago) <Marek Marczykowski-Górecki> * 121d9d4 - python: use PyBytes/PyUnicode instead of PyString (2 years ago) <Marek Marczykowski-Górecki> * 0c8981f - python: initialize specific fields of PyTypeObject (2 years ago) <Marek Marczykowski-Górecki> * 7b1e5f7 - python: use Py_TYPE instead of looking directly into PyObject_HEAD (2 years ago) <Marek Marczykowski-Górecki> * 96d1ee6 - python: drop tp_getattr implementation (2 years ago) <Marek Marczykowski-Górecki> * 6b28df3 - python: check return value of PyErr_NewException (2 years ago) <Marek Marczykowski-Górecki> Which in particular handle strings differently in the Py2 case. ~Andrew
_______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel