Mercurial > cpython-lru_cache-weakref
annotate Include/structseq.h @ 20737:00a581bdedeb legacy-trunk
When overriding __str__ or __repr__, set the tp_print slot to NULL.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Mon, 29 Oct 2001 14:33:44 +0000 |
| parents | 2d599a36b67a |
| children | c1eb668525e1 |
| rev | line source |
|---|---|
|
20539
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1 |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2 /* Tuple object interface */ |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
3 |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
4 #ifndef Py_STRUCTSEQ_H |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
5 #define Py_STRUCTSEQ_H |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
6 #ifdef __cplusplus |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
7 extern "C" { |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
8 #endif |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
9 |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
10 typedef struct PyStructSequence_Field { |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
11 char *name; |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
12 char *doc; |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
13 } PyStructSequence_Field; |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
14 |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
15 typedef struct PyStructSequence_Desc { |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
16 char *name; |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
17 char *doc; |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
18 struct PyStructSequence_Field *fields; |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
19 int n_in_sequence; |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
20 } PyStructSequence_Desc; |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
21 |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
22 extern DL_IMPORT(void) PyStructSequence_InitType(PyTypeObject *type, |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
23 PyStructSequence_Desc *desc); |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
24 |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
25 extern DL_IMPORT(PyObject *) PyStructSequence_New(PyTypeObject* type); |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
26 |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
27 typedef struct { |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
28 PyObject_VAR_HEAD |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
29 PyObject *ob_item[1]; |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
30 } PyStructSequence; |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
31 |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
32 /* Macro, *only* to be used to fill in brand new objects */ |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
33 #define PyStructSequence_SET_ITEM(op, i, v) \ |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
34 (((PyStructSequence *)(op))->ob_item[i] = v) |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
35 |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
36 #ifdef __cplusplus |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
37 } |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
38 #endif |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
39 #endif /* !Py_STRUCTSEQ_H */ |
