[pypy-svn] r73248 - in pypy/branch/cpython-extension/pypy/module/cpyext: . test

trundle at codespeak.net trundle at codespeak.net
Thu Apr 1 16:28:05 CEST 2010


Author: trundle
Date: Thu Apr  1 16:28:04 2010
New Revision: 73248

Modified:
   pypy/branch/cpython-extension/pypy/module/cpyext/structmember.py
   pypy/branch/cpython-extension/pypy/module/cpyext/test/test_typeobject.py
Log:
Remove wrong error checking and add a test.


Modified: pypy/branch/cpython-extension/pypy/module/cpyext/structmember.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/structmember.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/structmember.py	Thu Apr  1 16:28:04 2010
@@ -28,8 +28,6 @@
     member_type = w_member.c_type
     if member_type == structmemberdefs.T_INT:
         w_long_value = PyInt_AsLong(space, w_value)
-        if w_long_value == -1 and PyErr_Occurred(space):
-            return -1
         array = rffi.cast(rffi.INTP, ptr + w_member.c_offset)
         array[0] = rffi.cast(rffi.INT, w_long_value)
     else:

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/test/test_typeobject.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/test/test_typeobject.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/test/test_typeobject.py	Thu Apr  1 16:28:04 2010
@@ -31,6 +31,8 @@
         assert obj.int_member == obj.foo
         obj.int_member = 23
         assert obj.int_member == 23
+        obj.int_member = 42
+        raises(TypeError, "obj.int_member = 'not a number'")
         raises(TypeError, "obj.int_member_readonly = 42")
         raises(SystemError, "obj.broken_member")
         raises(SystemError, "obj.broken_member = 42")



More information about the Pypy-commit mailing list