Author: Armin Rigo <[email protected]>
Branch: cpyext-gc-support-2
Changeset: r82226:373f38b1e4ac
Date: 2016-02-13 17:29 +0100
http://bitbucket.org/pypy/pypy/changeset/373f38b1e4ac/
Log: Small fix to avoid being thrown into pdb when running
test_complexobject with "-s" (the test passes anyway)
diff --git a/pypy/module/cpyext/complexobject.py
b/pypy/module/cpyext/complexobject.py
--- a/pypy/module/cpyext/complexobject.py
+++ b/pypy/module/cpyext/complexobject.py
@@ -43,7 +43,7 @@
# lltype does not handle functions returning a structure. This implements a
# helper function, which takes as argument a reference to the return value.
-@cpython_api([PyObject, Py_complex_ptr], lltype.Void)
+@cpython_api([PyObject, Py_complex_ptr], rffi.INT_real, error=-1)
def _PyComplex_AsCComplex(space, w_obj, result):
"""Return the Py_complex value of the complex number op.
@@ -60,7 +60,7 @@
# if the above did not work, interpret obj as a float giving the
# real part of the result, and fill in the imaginary part as 0.
result.c_real = PyFloat_AsDouble(space, w_obj) # -1 on failure
- return
+ return 0
if not PyComplex_Check(space, w_obj):
raise OperationError(space.w_TypeError, space.wrap(
@@ -69,3 +69,4 @@
assert isinstance(w_obj, W_ComplexObject)
result.c_real = w_obj.realval
result.c_imag = w_obj.imagval
+ return 0
diff --git a/pypy/module/cpyext/include/complexobject.h
b/pypy/module/cpyext/include/complexobject.h
--- a/pypy/module/cpyext/include/complexobject.h
+++ b/pypy/module/cpyext/include/complexobject.h
@@ -15,7 +15,7 @@
} Py_complex;
/* generated function */
-PyAPI_FUNC(void) _PyComplex_AsCComplex(PyObject *, Py_complex *);
+PyAPI_FUNC(int) _PyComplex_AsCComplex(PyObject *, Py_complex *);
PyAPI_FUNC(PyObject *) _PyComplex_FromCComplex(Py_complex *);
Py_LOCAL_INLINE(Py_complex) PyComplex_AsCComplex(PyObject *obj)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit