From eba8ecc6c39f38efaebd76aba206cc98f5936164 Mon Sep 17 00:00:00 2001
From: "Meredith L. Patterson" <mlp@thesmartpolitenerd.com>
Date: Mon, 18 Nov 2013 17:19:46 -0600
Subject: [PATCH] typemap to fix conversion from python strings to uint8_t*

---
 src/bindings/swig/hammer.i | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/bindings/swig/hammer.i b/src/bindings/swig/hammer.i
index f784f31e..bef82b9d 100644
--- a/src/bindings/swig/hammer.i
+++ b/src/bindings/swig/hammer.i
@@ -1,7 +1,16 @@
 %module hammer
 
-%include "typemaps.i"
 %include "stdint.i"
+%include "typemaps.i"
+%apply char [ANY] { uint8_t [ANY] };
+
+#if defined(SWIGPYTHON)
+%typemap(in) uint8_t* {
+  $1 = (uint8_t*)PyString_AsString($input);
+ }
+#else
+  #warning no "in" typemap defined
+#endif
 
  // All the include paths are relative to the build, i.e., ../../. If you need to build these manually (i.e., not with scons), keep that in mind.
 %{
@@ -12,5 +21,5 @@
 %include "allocator.h"
 %include "hammer.h"
 
-%apply const char* { const uint8_t* }
+
 
-- 
GitLab