[pypy-svn] r73406 - in pypy/branch/cpython-extension/pypy/module/cpyext: . test
fijal at codespeak.net
fijal at codespeak.net
Mon Apr 5 05:14:54 CEST 2010
Author: fijal
Date: Mon Apr 5 05:14:52 2010
New Revision: 73406
Modified:
pypy/branch/cpython-extension/pypy/module/cpyext/getargs.py
pypy/branch/cpython-extension/pypy/module/cpyext/test/test_getargs.py
Log:
Support ':'. Copying code from C seems like a lot of hassle, since
we need to support PyCObject
Modified: pypy/branch/cpython-extension/pypy/module/cpyext/getargs.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/getargs.py (original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/getargs.py Mon Apr 5 05:14:52 2010
@@ -20,8 +20,10 @@
c = fmt[i]
if c == "\x00":
return 1
- if c == "i":
+ elif c == "i":
arr = api.va_get_int_star(va_list_p)
arr[0] = rffi.cast(rffi.INT,
space.int_w(space.getitem(w_obj, space.wrap(i))))
+ elif c == ':':
+ return 1
i += 1
Modified: pypy/branch/cpython-extension/pypy/module/cpyext/test/test_getargs.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/test/test_getargs.py (original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/test/test_getargs.py Mon Apr 5 05:14:52 2010
@@ -13,7 +13,15 @@
}
return PyInt_FromLong(l);
'''
- )])
+ ),
+ ('oneargandform', 'METH_VARARGS',
+ '''
+ int l;
+ if (!PyArg_ParseTuple(args, "i:oneargandstuff", &l)) {
+ return NULL;
+ }
+ return PyInt_FromLong(l);
+ ''')])
assert mod.oneargint(1) == 1
raises(TypeError, mod.oneargint, None)
try:
@@ -22,3 +30,5 @@
pass
else:
raise Exception("DID NOT RAISE")
+ assert mod.oneargandform(1) == 1
+
More information about the Pypy-commit
mailing list