[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH for-next RFC 4/4] pygrub: make it build with python 3



On Tue, Mar 05, 2019 at 05:42:07PM +0000, Andrew Cooper wrote:
> 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.liu2@xxxxxxxxxx>
> 
> 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>

I knew.

> 
> Which in particular handle strings differently in the Py2 case.


I am not sure his changes for the string APIs are correct -- they seem
to deviate from the official porting guide. But hey, I don't use these
bindings myself, so he probably knows better.

CC Marek.

Wei.

> 
> ~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.