[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pyamf-commits
Subject:    [pyamf-commits] r1614 - pyamf/branches/gerard-cpyamf-225/cpyamf
From:       commits () pyamf ! org (SVN commit logs for PyAMF)
Date:       2008-08-27 21:43:32
Message-ID: 20080827214332.C822324001 () mail ! collab ! eu
[Download RAW message or body]

Author: gerard
Date: 2008-08-27 23:43:32 +0200 (Wed, 27 Aug 2008)
New Revision: 1614

Modified:
   pyamf/branches/gerard-cpyamf-225/cpyamf/util.c
Log:
More code fixes for cpyamf.  On Windows (Python 2.3-2.5), there are only a couple \
tests which still fail (all related to NaN).


Modified: pyamf/branches/gerard-cpyamf-225/cpyamf/util.c
===================================================================
--- pyamf/branches/gerard-cpyamf-225/cpyamf/util.c	2008-08-27 02:31:59 UTC (rev 1613)
+++ pyamf/branches/gerard-cpyamf-225/cpyamf/util.c	2008-08-27 21:43:32 UTC (rev 1614)
@@ -48,8 +48,17 @@
 get_ulong(PyObject *v, unsigned long *p)
 {
     unsigned long x;
+    PyObject* py_long;
     
-    x = PyLong_AsUnsignedLong(v);
+    py_long = PyNumber_Long(v);
+    if (py_long==NULL)
+    {
+        PyErr_SetNone(PyExc_ValueError);
+        return -1;
+    }
+
+    x = PyLong_AsUnsignedLong(py_long);
+    Py_XDECREF(py_long);
     if (PyErr_Occurred()) {
         return -1;
     }
@@ -432,7 +441,7 @@
 static PyObject *
 BufferedByteStream_truncate(BufferedByteStream *self, PyObject *args, PyObject * \
kwargs)  {
-    PyObject *obj_size = NULL, *tmp;
+    PyObject *obj_size = NULL;
     static char *kwlist[] = {"size", NULL};
 
     if(!self->buffer) {
@@ -446,9 +455,11 @@
     if (!obj_size)
         obj_size = PyInt_FromLong(0);
     
-    tmp = PyObject_CallMethod(self->buffer, "truncate", "O", obj_size);
-    Py_XDECREF(tmp);
+    Py_XDECREF(self->buffer);
+    self->buffer = NULL;
 
+    BufferedByteStream_init_(self, NULL, 0); 
+
     Py_INCREF(Py_None);
     return Py_None;
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic