Skip to content

Commit 150782e

Browse files
committed
Fix tests after NumPy changes.
PullRequest: graalpython-open/54
2 parents 6a17f99 + b7c6bbd commit 150782e

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

graalpython/com.oracle.graal.python.cext/src/longobject.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ long PyLong_AsLongAndOverflow(PyObject *obj, int *overflow) {
5252
return -1;
5353
}
5454
long result = truffle_invoke_l(PY_TRUFFLE_CEXT, "PyLong_AsPrimitive", to_java(obj), true, sizeof(long), truffle_read_string("long"));
55-
*overflow = result == -1L && PyErr_Occurred();
55+
*overflow = result == -1L && PyErr_Occurred() != NULL;
5656
return result;
5757
}
5858

@@ -93,8 +93,13 @@ PyObject * PyLong_FromVoidPtr(void *p) {
9393
void * PyLong_AsVoidPtr(PyObject *obj){
9494
return (void *)PyLong_AsSsize_t(obj);
9595
}
96+
9697
PyObject * PyLong_FromLong(long n) {
97-
return PyLong_FromUnsignedLongLong(n);
98+
void *result = polyglot_invoke(PY_TRUFFLE_CEXT, "PyLong_FromLongLong", n, true);
99+
if (result == ERROR_MARKER) {
100+
return NULL;
101+
}
102+
return to_sulong(result);
98103
}
99104

100105
PyObject * PyLong_FromLongLong(long long n) {

graalpython/com.oracle.graal.python.cext/src/object.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -407,17 +407,18 @@ int PyType_Ready(PyTypeObject* cls) {
407407
// TODO ...
408408
}
409409

410+
// TODO link subclasses
410411
/* Link into each base class's list of subclasses */
411412
bases = cls->tp_bases;
412-
Py_ssize_t n = PyTuple_GET_SIZE(bases);
413-
Py_ssize_t i;
414-
for (i = 0; i < n; i++) {
415-
PyTypeObject *b = polyglot_as__typeobject(PyTuple_GET_ITEM(bases, i));
416-
if (PyType_Check(b) && add_subclass((PyTypeObject *)b, cls) < 0) {
417-
cls->tp_flags &= ~Py_TPFLAGS_READYING;
418-
return -1;
419-
}
420-
}
413+
// Py_ssize_t n = PyTuple_GET_SIZE(bases);
414+
// Py_ssize_t i;
415+
// for (i = 0; i < n; i++) {
416+
// PyTypeObject *b = polyglot_as__typeobject(PyTuple_GetItem(bases, i));
417+
// if (PyType_Check(b) && add_subclass((PyTypeObject *)b, cls) < 0) {
418+
// cls->tp_flags &= ~Py_TPFLAGS_READYING;
419+
// return -1;
420+
// }
421+
// }
421422

422423
// done
423424
cls->tp_flags = cls->tp_flags & ~Py_TPFLAGS_READYING;

graalpython/com.oracle.graal.python.test/src/tests/cpyext/test_capsule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def compile_module(self, name):
5656
''',
5757
resultspec="i",
5858
argspec='sn',
59-
arguments=["PyObject* name", "Py_ssize_t ptr"],
59+
arguments=["char* name", "Py_ssize_t ptr"],
6060
callfunction="wrap_PyCapsule_Check",
6161
cmpfunc=unhandled_error_compare
6262
)

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/frame/FrameBuiltins.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public Object clear(PFrame self, int idx) {
8383
@GenerateNodeFactory
8484
public abstract static class TruffleGetClassScopeNode extends PythonBuiltinNode {
8585
@Specialization
86+
@TruffleBoundary
8687
public Object add(PFrame self) {
8788
// TODO: remove me
8889
// TODO: do it properly via the python API in super.__init__ :

0 commit comments

Comments
 (0)