annotate Python/symtable.c @ 16539:a47d93ef103a legacy-trunk

Relax the rules for using 'from ... import *' and exec in the presence of nested functions. Either is allowed in a function if it contains no defs or lambdas or the defs and lambdas it contains have no free variables. If a function is itself nested and has free variables, either is illegal. Revise the symtable to use a PySymtableEntryObject, which holds all the revelent information for a scope, rather than using a bunch of st_cur_XXX pointers in the symtable struct. The changes simplify the internal management of the current symtable scope and of the stack. Added new C source file: Python/symtable.c. (Does the Windows build process need to be updated?) As part of these changes, the initial _symtable module interface introduced in 2.1a2 is replaced. A dictionary of PySymtableEntryObjects are returned.
author Jeremy Hylton <jeremy@alum.mit.edu>
date Fri, 09 Feb 2001 22:22:18 +0000
parents
children 51977af230fa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16539
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
1 #include "Python.h"
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
2 #include "symtable.h"
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
3 #include "graminit.h"
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
4 #include "structmember.h"
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
5
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
6 PyObject *
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
7 PySymtableEntry_New(struct symtable *st, char *name, int type, int lineno)
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
8 {
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
9 PySymtableEntryObject *ste = NULL;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
10 PyObject *k, *v;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
11
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
12 k = PyInt_FromLong(st->st_nscopes++);
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
13 if (k == NULL)
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
14 goto fail;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
15 v = PyDict_GetItem(st->st_symbols, k);
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
16 if (v) /* XXX could check that name, type, lineno match */
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
17 return v;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
18
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
19 ste = (PySymtableEntryObject *)PyObject_New(PySymtableEntryObject,
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
20 &PySymtableEntry_Type);
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
21 ste->ste_table = st;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
22 ste->ste_id = k;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
23
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
24 v = PyString_FromString(name);
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
25 if (v == NULL)
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
26 goto fail;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
27 ste->ste_name = v;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
28
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
29 v = PyDict_New();
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
30 if (v == NULL)
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
31 goto fail;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
32 ste->ste_symbols = v;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
33
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
34 v = PyList_New(0);
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
35 if (v == NULL)
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
36 goto fail;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
37 ste->ste_varnames = v;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
38
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
39 v = PyList_New(0);
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
40 if (v == NULL)
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
41 goto fail;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
42 ste->ste_children = v;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
43
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
44 ste->ste_optimized = 1;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
45 ste->ste_lineno = lineno;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
46 switch (type) {
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
47 case funcdef:
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
48 case lambdef:
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
49 ste->ste_type = TYPE_FUNCTION;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
50 break;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
51 case classdef:
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
52 ste->ste_type = TYPE_CLASS;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
53 break;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
54 case single_input:
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
55 case eval_input:
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
56 case file_input:
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
57 ste->ste_type = TYPE_MODULE;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
58 break;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
59 }
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
60
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
61 if (st->st_cur == NULL)
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
62 ste->ste_nested = 0;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
63 else if (st->st_cur->ste_nested
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
64 || st->st_cur->ste_type == TYPE_FUNCTION)
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
65 ste->ste_nested = 1;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
66 else
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
67 ste->ste_nested = 0;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
68 ste->ste_child_free = 0;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
69
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
70 if (PyDict_SetItem(st->st_symbols, ste->ste_id, (PyObject *)ste) < 0)
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
71 goto fail;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
72
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
73 return (PyObject *)ste;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
74 fail:
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
75 Py_XDECREF(ste);
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
76 return NULL;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
77 }
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
78
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
79 static PyObject *
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
80 ste_repr(PySymtableEntryObject *ste)
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
81 {
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
82 char buf[256];
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
83
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
84 sprintf(buf, "<symtable entry %.100s(%ld), line %d>",
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
85 PyString_AS_STRING(ste->ste_name),
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
86 PyInt_AS_LONG(ste->ste_id),
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
87 ste->ste_lineno);
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
88 return PyString_FromString(buf);
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
89 }
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
90
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
91 static void
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
92 ste_dealloc(PySymtableEntryObject *ste)
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
93 {
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
94 ste->ste_table = NULL;
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
95 Py_XDECREF(ste->ste_id);
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
96 Py_XDECREF(ste->ste_name);
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
97 Py_XDECREF(ste->ste_symbols);
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
98 Py_XDECREF(ste->ste_varnames);
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
99 Py_XDECREF(ste->ste_children);
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
100 PyObject_Del(ste);
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
101 }
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
102
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
103 #define OFF(x) offsetof(PySymtableEntryObject, x)
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
104
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
105 static struct memberlist ste_memberlist[] = {
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
106 {"id", T_OBJECT, OFF(ste_id), READONLY},
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
107 {"name", T_OBJECT, OFF(ste_name), READONLY},
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
108 {"symbols", T_OBJECT, OFF(ste_symbols), READONLY},
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
109 {"varnames", T_OBJECT, OFF(ste_varnames), READONLY},
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
110 {"children", T_OBJECT, OFF(ste_children), READONLY},
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
111 {"type", T_INT, OFF(ste_type), READONLY},
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
112 {"lineno", T_INT, OFF(ste_lineno), READONLY},
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
113 {"optimized",T_INT, OFF(ste_optimized), READONLY},
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
114 {"nested", T_INT, OFF(ste_nested), READONLY},
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
115 {NULL}
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
116 };
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
117
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
118 static PyObject *
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
119 ste_getattr(PySymtableEntryObject *ste, char *name)
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
120 {
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
121 return PyMember_Get((char *)ste, ste_memberlist, name);
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
122 }
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
123
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
124 PyTypeObject PySymtableEntry_Type = {
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
125 PyObject_HEAD_INIT(&PyType_Type)
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
126 0,
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
127 "symtable entry",
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
128 sizeof(PySymtableEntryObject),
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
129 0,
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
130 (destructor)ste_dealloc, /* tp_dealloc */
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
131 0, /* tp_print */
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
132 (getattrfunc)ste_getattr, /* tp_getattr */
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
133 0, /* tp_setattr */
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
134 0, /* tp_compare */
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
135 (reprfunc)ste_repr, /* tp_repr */
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
136 0, /* tp_as_number */
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
137 0, /* tp_as_sequence */
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
138 0, /* tp_as_mapping */
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
139 0, /* tp_hash */
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
140 0, /* tp_call */
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
141 0, /* tp_str */
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
142 0, /* tp_getattro */
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
143 0, /* tp_setattro */
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
144 0, /* tp_as_buffer */
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
145 Py_TPFLAGS_DEFAULT, /* tp_flags */
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
146 0, /* tp_doc */
a47d93ef103a Relax the rules for using 'from ... import *' and exec in the presence
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff changeset
147 };