Gentoo Archives: gentoo-commits

From: "Jesus Rivero (neurogeek)" <neurogeek@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-python/py-xmlrpc/files: py-xmlrpc_rpcDispatch.patch py-xmlrpc_patch-extra.patch py-xmlrpc_rpcDate.patch py-xmlrpc_rpcClient.patch py-xmlrpc_rpcSource.patch py-xmlrpc_rpcUtils.patch py-xmlrpc_rpcBase64.patch
Date: Mon, 01 Mar 2010 23:46:52
Message-Id: E1NmFK4-0000x6-Tn@stork.gentoo.org
1 neurogeek 10/03/01 23:46:48
2
3 Added: py-xmlrpc_rpcDispatch.patch
4 py-xmlrpc_patch-extra.patch py-xmlrpc_rpcDate.patch
5 py-xmlrpc_rpcClient.patch py-xmlrpc_rpcSource.patch
6 py-xmlrpc_rpcUtils.patch py-xmlrpc_rpcBase64.patch
7 Log:
8 Added patchs wrt bug #299023 (now closed), Thanks to Florian for the report
9 (Portage version: 2.2_rc63/cvs/Linux i686)
10
11 Revision Changes Path
12 1.1 dev-python/py-xmlrpc/files/py-xmlrpc_rpcDispatch.patch
13
14 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/py-xmlrpc/files/py-xmlrpc_rpcDispatch.patch?rev=1.1&view=markup
15 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/py-xmlrpc/files/py-xmlrpc_rpcDispatch.patch?rev=1.1&content-type=text/plain
16
17 Index: py-xmlrpc_rpcDispatch.patch
18 ===================================================================
19 Patch added by neurogeek@g.o
20 Patch added 03/01/2010
21 Taken from: http://www.freebsd.org/cgi/cvsweb.cgi/ports/net/py-xmlrpc/files/
22 Thanks to sobomax @ FreeBSD
23
24 --- src/rpcDispatch.c
25 +++ src/rpcDispatch.c
26 @@ -68,7 +68,7 @@
27 rpcDispClear(dp);
28 free(dp->srcs);
29 }
30 - PyMem_DEL(dp);
31 + PyObject_DEL(dp);
32 }
33
34
35
36
37
38 1.1 dev-python/py-xmlrpc/files/py-xmlrpc_patch-extra.patch
39
40 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/py-xmlrpc/files/py-xmlrpc_patch-extra.patch?rev=1.1&view=markup
41 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/py-xmlrpc/files/py-xmlrpc_patch-extra.patch?rev=1.1&content-type=text/plain
42
43 Index: py-xmlrpc_patch-extra.patch
44 ===================================================================
45 Patch added by neurogeek@g.o
46 Patch added 03/01/2010
47 Taken from: http://www.freebsd.org/cgi/cvsweb.cgi/ports/net/py-xmlrpc/files/
48 Thanks to sobomax @ FreeBSD
49
50 Due to unresponsiveness of the development team of the py-xmlrpc, I'm sending
51 this change request here in hope it can help the developers that use this
52 port.
53
54 The py-xmlrpc module has a problem with boolean type - it implements boolean
55 type internally thus creating difficulties on encode/decode path of the
56 boolean variables. I've changed the source code to use internal Python's
57 boolean type and this made things straight to the user of this module.
58
59 Another change I've made to the module is support for the <nil/> element.
60 Despite the fact this element isn't mentioned in the XML-RPC specification,
61 many of implementations support it, as this is the very convenient way to
62 pass null values from the environments with dynamic typing such as
63 Python, Perl, etc.
64
65
66 --- src/rpcBoolean.c.orig 2002-02-21 09:08:11.000000000 +0200
67 +++ src/rpcBoolean.c 2008-10-15 10:41:34.000000000 +0300
68 @@ -2,142 +2,3 @@
69 * Copyright (C) 2001, Shilad Sen, Sourcelight Technologies, Inc.
70 * See xmlrpc.h or the README for more copyright information.
71 */
72 -
73 -
74 -#include "xmlrpc.h"
75 -#include "rpcInternal.h"
76 -
77 -
78 -static void rpcBoolDealloc(rpcBool *bp);
79 -static int rpcBoolLength(rpcBool *bp);
80 -static int rpcBoolCompare(rpcBool *b1, rpcBool *b2);
81 -static PyObject *rpcBoolRepr(rpcBool *bp);
82 -
83 -
84 -/*
85 - * create a new edb boolean object
86 - */
87 -PyObject *
88 -rpcBoolNew(bool value)
89 -{
90 - rpcBool *bp;
91 -
92 - bp = PyObject_NEW(rpcBool, &rpcBoolType);
93 - if (bp == NULL)
94 - return NULL;
95 - bp->value = value;
96 - return (PyObject *)bp;
97 -}
98 -
99 -
100 -/*
101 - * get the value (true or false) of a boolean rpc object
102 - */
103 -bool
104 -rpcBoolValue(PyObject *obj)
105 -{
106 - return ((rpcBool *)obj)->value;
107 -}
108 -
109 -
110 -/*
111 - * free resources associated with a boolean object
112 - */
113 -static void
114 -rpcBoolDealloc(rpcBool *bp)
115 -{
116 - PyMem_DEL(bp);
117 -}
118 -
119 -
120 -/*
121 - * tell whether a boolean object is true or false
122 - */
123 -static int
124 -rpcBoolLength(rpcBool *bp)
125 -{
126 - if (bp->value)
127 - return 1;
128 - else
129 - return 0;
130 -}
131 -
132 -
133 -/*
134 - * bool object to dictionary conversion
135 - */
136 -static PyMappingMethods rpcBoolAsMapping = {
137 - (inquiry)rpcBoolLength, /* mapping length */
138 - (binaryfunc)NULL, /* mapping subscript */
139 - (objobjargproc)NULL, /* mapping associate subscript */
140 -};
141 -
142 -
143 -/*
144 - * boolean comparison
145 - */
146 -static int
147 -rpcBoolCompare(rpcBool *b1, rpcBool *b2)
148 -{
149 - if (not b1->value and not b2->value)
150 - return 0;
151 - else if (b1->value and b2->value)
152 - return 0;
153 - else
154 - return 1;
155 -}
156 -
157 -
158 -/*
159 - * represent a boolean xml object
160 - */
161 -static PyObject *
162 -rpcBoolStr(rpcBool *bp)
163 -{
164 - if (bp->value)
165 - return PyString_FromString("<xmlrpc boolean true>");
166 - else
167 - return PyString_FromString("<xmlrpc boolean false>");
168 -}
169 -
170 -
171 -/*
172 - * represent a boolean xml object
173 - */
174 -static PyObject *
175 -rpcBoolRepr(rpcBool *bp)
176 -{
177 - if (bp->value)
178 - return PyString_FromString("boolean(1)");
179 - else
180 - return PyString_FromString("boolean(0)");
181 -}
182 -
183 -
184 -/*
185 - * map characterstics of a boolean
186 - */
187 -PyTypeObject rpcBoolType = {
188 - PyObject_HEAD_INIT(0)
189 - 0,
190 - "rpcBoolean",
191 - sizeof(rpcBool),
192 - 0,
193 - (destructor)rpcBoolDealloc, /* tp_dealloc */
194 - 0, /* tp_print */
195 - 0, /* tp_getattr */
196 - 0, /* tp_setattr */
197 - (cmpfunc)rpcBoolCompare, /* tp_compare */
198 - (reprfunc)rpcBoolRepr, /* tp_repr */
199 - 0, /* tp_as_number */
200 - 0, /* tp_as_sequence */
201 - &rpcBoolAsMapping, /* tp_as_mapping */
202 - 0, /* tp_hash */
203 - 0, /* tp_call */
204 - (reprfunc)rpcBoolStr, /* tp_str */
205 - 0, /* tp_getattro */
206 - 0, /* tp_setattro */
207 - 0, /* tp_as_buffer */
208 - 0, /* tp_xxx4 */
209 - 0, /* tp_doc */
210 -};
211 --- src/rpcBoolean.h.orig 2008-10-15 10:46:52.000000000 +0300
212 +++ src/rpcBoolean.h 2008-10-15 10:46:59.000000000 +0300
213 @@ -6,26 +6,3 @@
214 *
215 */
216
217 -
218 -#ifndef _RPCBOOL_H_
219 -#define _RPCBOOL_H_
220 -
221 -
222 -#include "rpcInclude.h"
223 -PyTypeObject rpcBoolType;
224 -
225 -
226 -/*
227 - * boolean object
228 - */
229 -typedef struct {
230 - PyObject_HEAD /* python standard */
231 - bool value; /* true/false value */
232 -} rpcBool;
233 -
234 -
235 -PyObject *rpcBoolNew(bool value);
236 -bool rpcBoolValue(PyObject *obj);
237 -
238 -
239 -#endif /* _RPCBOOL_H_ */
240 --- src/rpcUtils.c.orig 2003-04-21 18:39:15.000000000 +0300
241 +++ src/rpcUtils.c 2008-10-15 10:45:01.000000000 +0300
242 @@ -47,6 +47,7 @@
243
244 static strBuff *encodeValue(strBuff *sp, PyObject *value, uint tabs);
245 static strBuff *encodeBool(strBuff *sp, PyObject *value);
246 +static strBuff *encodeNone(strBuff *sp);
247 static strBuff *encodeInt(strBuff *sp, PyObject *value);
248 static strBuff *encodeDouble(strBuff *sp, PyObject *value);
249 static strBuff *encodeString(strBuff *sp, PyObject *value);
250 @@ -63,6 +64,7 @@
251 static PyObject *decodeString(char **cp, char *ep, ulong *lines);
252 static PyObject *decodeTaglessString(char **cp, char *ep, ulong *lines);
253 static PyObject *decodeBool(char **cp, char *ep, ulong *lines);
254 +static PyObject *decodeNone(char **cp, char *ep, ulong *lines);
255 static PyObject *decodeBase64(char **cp, char *ep, ulong *lines);
256 static PyObject *decodeArray(char **cp, char *ep, ulong *lines);
257 static PyObject *decodeStruct(char **cp, char *ep, ulong *lines);
258 @@ -205,11 +207,13 @@
259 {
260 if (buffConstant(sp, "<value>") == NULL)
261 return NULL;
262 - if (PyInt_Check(value) or PyLong_Check(value))
263 + if (PyInt_CheckExact(value) or PyLong_Check(value))
264 sp = encodeInt(sp, value);
265 + else if (value == Py_None)
266 + sp = encodeNone(sp);
267 else if (PyFloat_Check(value))
268 sp = encodeDouble(sp, value);
269 - else if (value->ob_type == &rpcBoolType)
270 + else if (PyBool_Check(value))
271 sp = encodeBool(sp, value);
272 else if (value->ob_type == &rpcDateType)
273 sp = encodeDate(sp, value);
274 @@ -286,12 +290,25 @@
275 }
276
277 /*
278 + * encode the None as: "<nil/>"
279 + */
280 +static strBuff *
281 +encodeNone(strBuff *sp)
282 +{
283 + if (buffConstant(sp, "<nil/>") == NULL)
284 + return NULL;
285 +
286 + return sp;
287 +}
288 +
289 +/*
290 +/*
291 * encode the boolean true (for example) as: "<boolean>1</boolean>"
292 */
293 static strBuff *
294 encodeBool(strBuff *sp, PyObject *value)
295 {
296 - if (((rpcBool *)value)->value)
297 + if (value == Py_True)
298 return buffConstant(sp, "<boolean>1</boolean>");
299 else
300 return buffConstant(sp, "<boolean>0</boolean>");
301 @@ -569,6 +586,8 @@
302 res = decodeDate(cp, ep, lines);
303 else if (strncmp(*cp, "<base64>", 8) == 0)
304 res = decodeBase64(cp, ep, lines);
305 + else if (strncmp(*cp, "<nil/>", 6) == 0)
306 + res = decodeNone(cp, ep, lines);
307 else { /* it must be a string */
308 *cp = tp;
309 res = decodeTaglessString(cp, ep, lines);
310 @@ -619,6 +638,20 @@
311
312
313 static PyObject *
314 +decodeNone(char **cp, char *ep, ulong *lines)
315 +{
316 + if (*cp + 6 >= ep)
317 + return eosErr();
318 + *cp += 6;
319 + if (chompStr(cp, ep, lines) >= ep)
320 + return eosErr();
321 +
322 + Py_INCREF(Py_None);
323 + return Py_None;
324 +}
325 +
326 +
327 +static PyObject *
328 decodeBool(char **cp, char *ep, ulong *lines)
329 {
330 PyObject *res;
331 @@ -638,7 +671,12 @@
332 if (chompStr(cp, ep, lines) >= ep)
333 return eosErr();
334
335 - return rpcBoolNew(value);
336 + if (value) {
337 + Py_INCREF(Py_True);
338 + return Py_True;
339 + }
340 + Py_INCREF(Py_False);
341 + return Py_False;
342 }
343
344
345 --- src/xmlrpc.c.orig 2003-04-21 18:39:15.000000000 +0300
346 +++ src/xmlrpc.c 2008-10-15 10:47:23.000000000 +0300
347 @@ -45,7 +45,6 @@
348 rpcLogLevel = 3;
349 rpcLogger = stderr;
350 rpcDateFormat = XMLRPC_DATE_FORMAT_US;
351 - rpcBoolType.ob_type = &PyType_Type;
352 rpcDateType.ob_type = &PyType_Type;
353 rpcBase64Type.ob_type = &PyType_Type;
354 rpcClientType.ob_type = &PyType_Type;
355 --- src/xmlrpc.h.orig 2003-04-21 18:39:15.000000000 +0300
356 +++ src/xmlrpc.h 2008-10-15 10:40:35.000000000 +0300
357 @@ -45,7 +45,6 @@
358 #define XMLRPC_DATE_FORMAT_EUROPE 2
359
360 #include "rpcBase64.h"
361 -#include "rpcBoolean.h"
362 #include "rpcClient.h"
363 #include "rpcDate.h"
364 #include "rpcDispatch.h"
365 --- src/xmlrpcmodule.c.orig 2003-04-21 19:22:54.000000000 +0300
366 +++ src/xmlrpcmodule.c 2008-10-15 10:48:42.000000000 +0300
367 @@ -197,7 +197,12 @@
368 unless (PyArg_ParseTuple(args, "i", &value))
369 return NULL;
370
371 - return rpcBoolNew(value);
372 + if (value) {
373 + Py_INCREF(Py_True);
374 + return Py_True;
375 + }
376 + Py_INCREF(Py_False);
377 + return Py_False;
378 }
379
380
381
382
383
384
385
386 1.1 dev-python/py-xmlrpc/files/py-xmlrpc_rpcDate.patch
387
388 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/py-xmlrpc/files/py-xmlrpc_rpcDate.patch?rev=1.1&view=markup
389 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/py-xmlrpc/files/py-xmlrpc_rpcDate.patch?rev=1.1&content-type=text/plain
390
391 Index: py-xmlrpc_rpcDate.patch
392 ===================================================================
393 Patch added by neurogeek@g.o
394 Patch added 03/01/2010
395 Taken from: http://www.freebsd.org/cgi/cvsweb.cgi/ports/net/py-xmlrpc/files/
396 Thanks to sobomax @ FreeBSD
397
398 --- src/rpcDate.c
399 +++ src/rpcDate.c
400 @@ -75,7 +75,7 @@
401 if (dp->value) {
402 Py_DECREF(dp->value);
403 }
404 - PyMem_DEL(dp);
405 + PyObject_DEL(dp);
406 }
407
408
409
410
411
412 1.1 dev-python/py-xmlrpc/files/py-xmlrpc_rpcClient.patch
413
414 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/py-xmlrpc/files/py-xmlrpc_rpcClient.patch?rev=1.1&view=markup
415 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/py-xmlrpc/files/py-xmlrpc_rpcClient.patch?rev=1.1&content-type=text/plain
416
417 Index: py-xmlrpc_rpcClient.patch
418 ===================================================================
419 Patch added by neurogeek@g.o
420 Patch added 03/01/2010
421 Taken from: http://www.freebsd.org/cgi/cvsweb.cgi/ports/net/py-xmlrpc/files/
422 Thanks to sobomax @ FreeBSD
423
424 --- src/rpcClient.c
425 +++ src/rpcClient.c
426 @@ -179,7 +179,7 @@
427 cp->url = NULL;
428 Py_DECREF(cp->src);
429 Py_DECREF(cp->disp);
430 - PyMem_DEL(cp);
431 + PyObject_DEL(cp);
432 }
433
434
435
436
437 1.1 dev-python/py-xmlrpc/files/py-xmlrpc_rpcSource.patch
438
439 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/py-xmlrpc/files/py-xmlrpc_rpcSource.patch?rev=1.1&view=markup
440 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/py-xmlrpc/files/py-xmlrpc_rpcSource.patch?rev=1.1&content-type=text/plain
441
442 Index: py-xmlrpc_rpcSource.patch
443 ===================================================================
444 Patch added by neurogeek@g.o
445 Patch added 03/01/2010
446 Taken from: http://www.freebsd.org/cgi/cvsweb.cgi/ports/net/py-xmlrpc/files/
447 Thanks to sobomax @ FreeBSD
448
449 --- src/rpcSource.c
450 +++ src/rpcSource.c
451 @@ -61,7 +61,7 @@
452 if (srcp->onErr and srcp->onErrType == ONERR_TYPE_PY) {
453 Py_DECREF((PyObject *)srcp->onErr);
454 }
455 - PyMem_DEL(srcp);
456 + PyObject_DEL(srcp);
457 }
458
459
460
461
462
463 1.1 dev-python/py-xmlrpc/files/py-xmlrpc_rpcUtils.patch
464
465 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/py-xmlrpc/files/py-xmlrpc_rpcUtils.patch?rev=1.1&view=markup
466 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/py-xmlrpc/files/py-xmlrpc_rpcUtils.patch?rev=1.1&content-type=text/plain
467
468 Index: py-xmlrpc_rpcUtils.patch
469 ===================================================================
470 Patch added by neurogeek@g.o
471 Patch added 03/01/2010
472 Taken from: http://www.freebsd.org/cgi/cvsweb.cgi/ports/net/py-xmlrpc/files/
473 Thanks to sobomax @ FreeBSD
474
475 --- src/rpcUtils.c.orig
476 +++ src/rpcUtils.c
477 @@ -276,7 +280,7 @@
478 double d;
479
480 d = PyFloat_AS_DOUBLE(value);
481 - snprintf(buff, 255, "%f", d);
482 + snprintf(buff, 255, "%.17f", d);
483 if ((buffConstant(sp, "<double>") == NULL)
484 or (buffConcat(sp, buff) == NULL)
485 or (buffConstant(sp, "</double>") == NULL))
486
487
488
489 1.1 dev-python/py-xmlrpc/files/py-xmlrpc_rpcBase64.patch
490
491 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/py-xmlrpc/files/py-xmlrpc_rpcBase64.patch?rev=1.1&view=markup
492 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/py-xmlrpc/files/py-xmlrpc_rpcBase64.patch?rev=1.1&content-type=text/plain
493
494 Index: py-xmlrpc_rpcBase64.patch
495 ===================================================================
496 Patch added by neurogeek@g.o
497 Patch added 03/01/2010
498 Taken from: http://www.freebsd.org/cgi/cvsweb.cgi/ports/net/py-xmlrpc/files/
499 Thanks to sobomax @ FreeBSD
500
501 --- src/rpcBase64.c
502 +++ src/rpcBase64.c
503 @@ -239,7 +239,7 @@
504 if (bp->value) {
505 Py_DECREF(bp->value);
506 }
507 - PyMem_DEL(bp);
508 + PyObject_DEL(bp);
509 }