Skip to content

Commit f6e115c

Browse files
committed
Support 'PySequence_Fast_GET_SIZE' macro.
1 parent aa28502 commit f6e115c

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,21 @@ def compile_module(self, name):
450450
),
451451
resultspec="O",
452452
argspec='On',
453-
arguments=["PyObject* tuple", "Py_ssize_t idx"],
453+
arguments=["PyObject* sequence", "Py_ssize_t idx"],
454+
)
455+
456+
test_PySequence_Fast_GET_SIZE = CPyExtFunction(
457+
lambda args: len(args[0]),
458+
lambda: (
459+
(tuple(),),
460+
((1,2,3),),
461+
((None,),),
462+
([],),
463+
(['a','b','c'],),
464+
([None],),
465+
),
466+
resultspec="n",
467+
argspec='O',
468+
arguments=["PyObject* sequence"],
454469
)
455470

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cpyobject/PythonObjectNativeWrapperMR.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Object doObType(PythonObject object, @SuppressWarnings("unused") String key) {
134134
}
135135

136136
@Specialization(guards = "eq(OB_SIZE, key)")
137-
int doObSize(PythonObject object, @SuppressWarnings("unused") String key,
137+
long doObSize(PythonObject object, @SuppressWarnings("unused") String key,
138138
@Cached("create(__LEN__)") LookupAndCallUnaryNode callLenNode) {
139139
try {
140140
return callLenNode.executeInt(object);

0 commit comments

Comments
 (0)