Skip to contentSkip to conversation

pylibfdt: Add stdint include to fix uint32_t

PATCH In review Simon Glass 2 participants 2 messages Aug 14, 2017 – Aug 15, 2017 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pylibfdt: Add stdint include to fix uint32_t

Some types used by libfdt.h are not understood the Python module since they are defined outside it. An example is an attempt to do this:

import libfdt
result = libfdt.fdt_node_offset_by_phandle(fdt, phandle)

This results in:

TypeError: in method 'fdt_node_offset_by_phandle', argument 2 of

	type 'uint32_t'

Include the standard integer header file to fix this.

---

 pylibfdt/libfdt.i | 2 ++
 1 file changed, 2 insertions(+)
pylibfdt/libfdt.i +2 -0
index cd1c6a9..c7b79ec 100644
@@ -52,6 +52,8 @@
 
 %module libfdt
 
+%include <stdint.i>
+
 %{
 #define SWIG_FILE_WITH_INIT
 #include "libfdt.h"
Signature · 1 line
2.14.0.434.g98096fd7a8-goog

A message that is not in the archive (sent off-list or not yet received): 20170814190728.151775-1-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org

#2 lore raw
Quoted 6 lines · Simon Glass

Some types used by libfdt.h are not understood the Python module since they are defined outside it. An example is an attempt to do this:

import libfdt
result = libfdt.fdt_node_offset_by_phandle(fdt, phandle)

Quoted 8 lines

This results in:

TypeError: in method 'fdt_node_offset_by_phandle', argument 2 of

	type 'uint32_t'

Include the standard integer header file to fix this.

Applied, but it would be nice to add a testcase for this.

Quoted 18 lines

---

 pylibfdt/libfdt.i | 2 ++
 1 file changed, 2 insertions(+)
pylibfdt/libfdt.i +2 -0
index cd1c6a9..c7b79ec 100644
@@ -52,6 +52,8 @@
 
 %module libfdt
 
+%include <stdint.i>
+
 %{
 #define SWIG_FILE_WITH_INIT
 #include "libfdt.h"
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson