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
2bae36f6
Commit
2bae36f6
authored
Jan 09, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests for tp_dictoffset
parent
338af286
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
2 deletions
+29
-2
test/test_extension/slots_test.c
test/test_extension/slots_test.c
+5
-2
test/tests/capi_slots.py
test/tests/capi_slots.py
+24
-0
No files found.
test/test_extension/slots_test.c
View file @
2bae36f6
#include <Python.h>
#include <Python.h>
#include <stddef.h>
/* For offsetof */
typedef
struct
{
typedef
struct
{
PyObject_HEAD
PyObject_HEAD
;
PyObject
*
dict
;
int
n
;
int
n
;
}
slots_tester_object
;
}
slots_tester_object
;
...
@@ -252,7 +255,7 @@ static PyTypeObject slots_tester_map= {
...
@@ -252,7 +255,7 @@ static PyTypeObject slots_tester_map= {
0
,
/* tp_dict */
0
,
/* tp_dict */
0
,
/* tp_descr_get */
0
,
/* tp_descr_get */
0
,
/* tp_descr_set */
0
,
/* tp_descr_set */
0
,
/* tp_dictoffset */
offsetof
(
slots_tester_object
,
dict
),
/* tp_dictoffset */
0
,
/* tp_init */
0
,
/* tp_init */
0
,
/* tp_alloc */
0
,
/* tp_alloc */
slots_tester_new
,
/* tp_new */
slots_tester_new
,
/* tp_new */
...
...
test/tests/capi_slots.py
View file @
2bae36f6
...
@@ -88,3 +88,27 @@ try:
...
@@ -88,3 +88,27 @@ try:
pass
pass
except
TypeError
,
e
:
except
TypeError
,
e
:
print
e
print
e
try
:
slots_test
.
SlotsTesterSeq
(
5
).
foo
=
1
except
AttributeError
,
e
:
print
e
try
:
print
slots_test
.
SlotsTesterSeq
(
5
).
__dict__
except
AttributeError
,
e
:
print
e
c
=
C3
(
5
)
c
.
foo
=
1
print
c
.
foo
print
c
.
__dict__
s
=
slots_test
.
SlotsTesterMap
(
6
)
s
.
bar
=
2
print
s
.
bar
print
hasattr
(
s
,
"bar"
),
hasattr
(
s
,
"foo"
)
try
:
print
s
.
__dict__
except
AttributeError
,
e
:
print
e
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