pygrub/fsimage: make it work with python 3
authorWei Liu <wei.liu2@citrix.com>
Tue, 5 Mar 2019 14:13:17 +0000 (14:13 +0000)
committerWei Liu <wei.liu2@citrix.com>
Tue, 12 Mar 2019 14:24:53 +0000 (14:24 +0000)
commit83a204e6951c6358f995da3b60dd61224e9d41ac
treecca8399283d9465c2e125e131d0550907a16d975
parent0aabd89dcfee9ee2a6caaa2ec7a475daf5cada53
pygrub/fsimage: make it work with python 3

With the help of two porting guides and cpython source code:

1. Use PyBytes to replace PyString counterparts.
2. Use PyVarObject_HEAD_INIT.
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@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
tools/pygrub/src/fsimage/fsimage.c