pylibfdt: Test fdt.setprop take bytes on Python 3, add error handling
Signed-off-by: Petr Viktorin <pviktori@redhat.com> Message-Id: <20190218164856.23861-3-frenzy@frenzy.cz> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
committed by
David Gibson
parent
cb0f454f73
commit
364631626b
@@ -1084,6 +1084,10 @@ typedef uint32_t fdt32_t;
|
||||
/* typemap used for fdt_setprop() */
|
||||
%typemap(in) (const void *val) {
|
||||
%#if PY_VERSION_HEX >= 0x03000000
|
||||
if (!PyBytes_Check($input)) {
|
||||
SWIG_exception_fail(SWIG_TypeError, "bytes expected in method '" "$symname"
|
||||
"', argument " "$argnum"" of type '" "$type""'");
|
||||
}
|
||||
$1 = PyBytes_AsString($input);
|
||||
%#else
|
||||
$1 = PyString_AsString($input); /* char *str */
|
||||
|
||||
Reference in New Issue
Block a user