5c21081
From 76b89df0efc0fe817d320b7b34b2b0530ffd5538 Mon Sep 17 00:00:00 2001
5c21081
From: David King <dking@redhat.com>
5c21081
Date: Fri, 4 Mar 2016 14:19:29 +0000
5c21081
Subject: [PATCH] python: Avoid a crash on 64-bit systems
5c21081
5c21081
Annotate the return type of px_proxy_factory_new() to be void *, as otherwise
5c21081
int is assumed. This works fine on 32-bit systems, where void * and int are the
5c21081
same width, but is invalid on 64-bit (Linux) systems.
5c21081
5c21081
Additionally, annotate the argument type of free() and px_proxy_factory_free()
5c21081
to be void * to match.
5c21081
5c21081
https://code.google.com/archive/p/libproxy/issues/146
5c21081
---
5c21081
 bindings/python/libproxy.py | 4 ++++
5c21081
 1 file changed, 4 insertions(+)
5c21081
5c21081
diff --git a/bindings/python/libproxy.py b/bindings/python/libproxy.py
5c21081
index cb75a4d..7bddba9 100644
5c21081
--- a/bindings/python/libproxy.py
5c21081
+++ b/bindings/python/libproxy.py
5c21081
@@ -40,8 +40,12 @@ if platform.system() == "Windows":
5c21081
 else:
5c21081
     _libc = _load("c", 6)
5c21081
 
5c21081
+_libc.free.argtypes = ctypes.c_void_p,
5c21081
+
5c21081
 # Load libproxy
5c21081
 _libproxy = _load("proxy", 1)
5c21081
+_libproxy.px_proxy_factory_new.restype = ctypes.POINTER(ctypes.c_void_p)
5c21081
+_libproxy.px_proxy_factory_free.argtypes = ctypes.c_void_p,
5c21081
 _libproxy.px_proxy_factory_get_proxies.restype = ctypes.POINTER(ctypes.c_void_p)
5c21081
 
5c21081
 class ProxyFactory(object):
5c21081
-- 
5c21081
2.7.2
5c21081