Skip to content

Commit e42d17d

Browse files
committed
more tests in cext/test_abstract.py
1 parent 100d90f commit e42d17d

File tree

2 files changed

+258
-105
lines changed

2 files changed

+258
-105
lines changed

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
22
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
33
#
44
# The Universal Permissive License (UPL), Version 1.0
@@ -516,6 +516,18 @@ def CPyExtType(name, code, **kwargs):
516516
""" if sys.version_info.minor >= 6 else "") + """
517517
}};
518518
519+
static PySequenceMethods {name}_sequence_methods = {{
520+
{sq_length}, /* sq_length */
521+
0, /* sq_concat */
522+
0, /* sq_repeat */
523+
{sq_item}, /* sq_item */
524+
}};
525+
526+
static PyMappingMethods {name}_mapping_methods = {{
527+
{mp_length}, /* mp_length */
528+
{mp_subscript}, /* mp_subscript */
529+
}};
530+
519531
static struct PyMethodDef {name}_methods[] = {{
520532
{tp_methods},
521533
{{NULL, NULL, 0, NULL}}
@@ -533,8 +545,8 @@ def CPyExtType(name, code, **kwargs):
533545
0, /* tp_reserved */
534546
{tp_repr},
535547
&{name}_number_methods,
536-
{tp_as_sequence},
537-
{tp_as_mapping},
548+
&{name}_sequence_methods,
549+
&{name}_mapping_methods,
538550
{tp_hash},
539551
{tp_call},
540552
{tp_str},

0 commit comments

Comments
 (0)