Hello, Am 25.07.20 um 23:45 schrieb Philipp Hahn: > Am 27.04.20 um 15:44 schrieb Philipp Hahn: >> I'm working on adding PEP 484 type hints >> <https://www.python.org/dev/peps/pep-0484/> to the Python binding of >> libvirt. ... > I just opened a merge request > <https://gitlab.com/libvirt/libvirt-python/-/merge_requests/9> for my > code at <https://gitlab.com/pmhahn/libvirt-python/-/tree/typing>. While working on that I stumbled over two issues: 1. generator.skip_impl contained a list of the function names, which were also defined in `libvirt-override-api.xml`. Adding an override requires adding it in *two* locations. With <https://gitlab.com/libvirt/libvirt-python/-/merge_requests/9/diffs?commit_id=96e7414e488af84f7be04a50f5cd7457142c898d> it took the liberty to remove the list from generator.py and to extends it by parsing "api.xml" where file="python*". 2. Historically "api*.xml" used "char *" to indicate some custom Python type. Mapping this to "str" is obviously wrong, so I had to review them and changed many of them to "Any" or more specific types with <https://gitlab.com/libvirt/libvirt-python/-/merge_requests/9/diffs?commit_id=c3b26fccfc5e4e23ad93db51a41a85275f0ea5b5>. As that information is both used to generate the low-level "C-to-Python" mapping for "libvirtmod" but also the high-level Python module "libvirt", changing `type` to something other then a C-type might breaks the C-level wrapper. Using a Python-type there which must be declared in "generator.py" is also somehow cumbersome as there are many types which are used only once. So I would like to extend this file with a new attribute like "pytype", which then can be used to overwrite the type used by generator.py. > <function name='virDomainGetVcpus' file='python'> > <info>Extract information about virtual CPUs of domain, store it in info array and also in cpumaps.</info> > <return type='char *' info='None in case of error, returns a tuple of vcpu info and vcpu map.'/> > <return type='PyAny' info='None in case of error, returns a tuple of vcpu info and vcpu map.'/><!-- Tuple[List[Tuple[int, int, int, int]], List[Tutple[int, ...]]] --> > <arg name='domain' type='virDomainPtr' info='pointer to domain object, or NULL for Domain0'/> > </function> Is that okay? Philipp