Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
7f4bdb59
Commit
7f4bdb59
authored
Dec 13, 2014
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simple sq_item for testing; doesn't work on Pyston yet
parent
15e86e4f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
test/test_extension/slots_test.c
test/test_extension/slots_test.c
+23
-1
test/tests/capi_slots.py
test/tests/capi_slots.py
+1
-1
No files found.
test/test_extension/slots_test.c
View file @
7f4bdb59
...
...
@@ -45,8 +45,30 @@ slots_tester_call(slots_tester_object *obj, PyObject *args, PyObject *kw)
return
PyInt_FromLong
(
obj
->
n
);
}
static
PyObject
*
slots_tester_item
(
slots_tester_object
*
obj
,
Py_ssize_t
i
)
{
if
(
i
<
0
||
i
>=
5
)
{
PyErr_SetString
(
PyExc_IndexError
,
"tuple index out of range"
);
return
NULL
;
}
return
PyInt_FromLong
(
i
+
obj
->
n
);
}
PyDoc_STRVAR
(
slots_tester_doc
,
"slots_tester doc"
);
static
PySequenceMethods
slots_tester_as_sequence
=
{
(
lenfunc
)
0
,
(
binaryfunc
)
0
,
/* sq_concat */
(
ssizeargfunc
)
0
,
/* sq_repeat */
(
ssizeargfunc
)
slots_tester_item
,
/* sq_item */
(
ssizessizeargfunc
)
0
,
/* sq_slice */
0
,
/* sq_ass_item */
0
,
/* sq_ass_slice */
(
objobjproc
)
0
,
/* sq_contains */
};
static
PyTypeObject
slots_tester
=
{
PyVarObject_HEAD_INIT
(
NULL
,
0
)
"slots_test.slots_tester"
,
/* tp_name */
...
...
@@ -60,7 +82,7 @@ static PyTypeObject slots_tester = {
0
,
/* tp_compare */
(
reprfunc
)
slots_tester_repr
,
/* tp_repr */
0
,
/* tp_as_number */
0
,
/* tp_as_sequence */
&
slots_tester_as_sequence
,
/* tp_as_sequence */
0
,
/* tp_as_mapping */
0
,
/* tp_hash */
(
ternaryfunc
)
slots_tester_call
,
/* tp_call */
...
...
test/tests/capi_slots.py
View file @
7f4bdb59
...
...
@@ -2,7 +2,7 @@ import slots_test
for
i
in
xrange
(
3
):
t
=
slots_test
.
SlotsTester
(
i
+
5
)
print
t
,
repr
(
t
),
t
()
print
t
,
repr
(
t
),
t
()
,
t
[
2
]
print
slots_test
.
SlotsTester
.
set_through_tpdict
,
slots_test
.
SlotsTester
(
5
).
set_through_tpdict
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment