1 git://github.com/pawelz/ekg2.git branch master:
3 commit a31760d809e3e464e5e26dc42de97a5e1c9ec53f
4 Author: Paweł Zuzelski <pawelz@pld-linux.org>
5 Date: Fri Jan 22 01:17:47 2010 +0100
7 fixed conversion from long to PyObject
9 The false assumption sizeof(long) == size(void*) exists where PyInt_FromLong
10 is used to represent a pointer. The safe Python call for this is
11 PyLong_FromVoidPtr. (On platforms where the above assumption *is* true a PyInt
12 is returned as before so there is no effective change.)
14 This fixes segfault on x86_64 machines. The simplest way to reproduce segfault
15 is to load the following python script:
19 def reply(session, uid, type, text, stime, ignore_level):
20 ekg.command("/msg "+uid+" "+text)
22 ekg.handler_bind('protocol-message', reply)
24 and receive any message.
26 diff --git a/plugins/python/python.c b/plugins/python/python.c
27 index 272ad4f..9a33049 100644
28 --- a/plugins/python/python.c
29 +++ b/plugins/python/python.c
30 @@ -222,7 +222,7 @@ int python_query(script_t *scr, script_query_t *scr_que, void **args)
32 switch ( scr_que->argv_type[i] ) {
34 - w = PyInt_FromLong((long) *(int *) args[i] );
35 + w = PyLong_FromVoidPtr( args[i] );
37 case (QUERY_ARG_CHARP): {
38 char *tmp = *(char **) args[i];