Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Kirill Smelkov
cpython
Commits
b1955534
Commit
b1955534
authored
Aug 15, 2001
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add 'state' as a read-only attribute to spamdict. This serves as an
example.
parent
f91de8ea
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
Modules/xxsubtype.c
Modules/xxsubtype.c
+7
-1
No files found.
Modules/xxsubtype.c
View file @
b1955534
#include "Python.h"
#include "structmember.h"
/* Examples showing how to subtype the builtin list and dict types from C. */
...
...
@@ -136,6 +137,11 @@ spamdict_init(spamdictobject *self, PyObject *args, PyObject *kwds)
return
0
;
}
static
struct
memberlist
spamdict_members
[]
=
{
{
"state"
,
T_INT
,
offsetof
(
spamdictobject
,
state
),
READONLY
},
{
0
}
};
static
PyTypeObject
spamdict_type
=
{
PyObject_HEAD_INIT
(
&
PyType_Type
)
0
,
...
...
@@ -166,7 +172,7 @@ static PyTypeObject spamdict_type = {
0
,
/* tp_iter */
0
,
/* tp_iternext */
spamdict_methods
,
/* tp_methods */
0
,
/* tp_members */
spamdict_members
,
/* tp_members */
0
,
/* tp_getset */
&
PyDict_Type
,
/* tp_base */
0
,
/* tp_dict */
...
...
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