Hi,
This patch series is based on a prior patch[1], splitting off changes as
requested and incorporating feedback from Richard Jones. It introduces type
validation to avoid segmentation faults (instead, it reports an exception) and
fixes handling of the bytes type in Python 3.
Major changes since that series:
- Drop newly introduced support for integer types for DWORD/QWORDS
- Reject Unicode string types for Python 3 (and restore bytes support).
- Adjusted tests due to new requirements.
These changes were tested with the following combinations:
- Arch Linux x86_64 - Python 2.7.8, 3.4.1
- Kubuntu 14.04 x86_64 - Python 2.7.6, 3.4.0
- Ubuntu 10.04 i686 - Python 2.6.5, 3.1.2. Note that Python 3.1.2 does not pass
the tests (syntax error) unless you remove the use of Unicode literals:
`sed 's/u"/"/' -i python/t/*.py`
Support for Unicode literals was removed in 3.0 and restored in 3.3 (PEP-414)
[1]:
https://www.redhat.com/archives/libguestfs/2014-August/msg00051.html
Peter Wu (6):
python: use errors more specific than RuntimeError
python: use PyErr_NoMemory
python: check some types for get_value
python: fix crash by validating key and value
python: add heavier tests for setvalue
generator: Fix mixed tabs/spaces
configure.ac | 4 -
generator/generator.ml | 570 +++++++++++++++++++++--------------------
python/t/200-write.py | 4 +-
python/t/210-setvalue.py | 28 +-
python/t/300-setvalue-types.py | 80 ++++++
5 files changed, 386 insertions(+), 300 deletions(-)
create mode 100644 python/t/300-setvalue-types.py
--
2.0.4