Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9a0f04d

Browse files
committed
Get rid of obsolete support for access statement.
1 parent 6a33de9 commit 9a0f04d

1 file changed

Lines changed: 0 additions & 67 deletions

File tree

Python/compile.c

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -2164,68 +2164,6 @@ com_newlocal(c, name)
21642164
return i;
21652165
}
21662166

2167-
#ifdef SUPPORT_OBSOLETE_ACCESS
2168-
2169-
#define strequ(a, b) (strcmp((a), (b)) == 0)
2170-
2171-
static void
2172-
com_access_stmt(c, n)
2173-
struct compiling *c;
2174-
node *n;
2175-
{
2176-
int i, j, k, mode, imode;
2177-
PyObject *vmode;
2178-
REQ(n, access_stmt);
2179-
/* 'access' NAME (',' NAME)* ':' accesstype (',' accesstype)*
2180-
accesstype: NAME+ */
2181-
2182-
/* Find where the colon is */
2183-
i = 1;
2184-
while (TYPE(CHILD(n,i-1)) != COLON)
2185-
i += 1;
2186-
2187-
/* Calculate the mode mask */
2188-
mode = 0;
2189-
for (j = i; j < NCH(n); j += 2) {
2190-
int r = 0, w = 0, p = 0;
2191-
for (k = 0; k < NCH(CHILD(n,j)); k++) {
2192-
if (strequ(STR(CHILD(CHILD(n,j),k)), "public"))
2193-
p = 0;
2194-
else if (strequ(STR(CHILD(CHILD(n,j),k)), "protected"))
2195-
p = 1;
2196-
else if (strequ(STR(CHILD(CHILD(n,j),k)), "private"))
2197-
p = 2;
2198-
else if (strequ(STR(CHILD(CHILD(n,j),k)), "read"))
2199-
r = 1;
2200-
else if (strequ(STR(CHILD(CHILD(n,j),k)), "write"))
2201-
w = 1;
2202-
else /* XXX should make this an exception */
2203-
fprintf(stderr, "bad access type %s\n",
2204-
STR(CHILD(CHILD(n,j),k)));
2205-
}
2206-
if (r == 0 && w == 0)
2207-
r = w = 1;
2208-
if (p == 0) {
2209-
if (r == 1) mode |= AC_R_PUBLIC;
2210-
if (w == 1) mode |= AC_W_PUBLIC;
2211-
} else if (p == 1) {
2212-
if (r == 1) mode |= AC_R_PROTECTED;
2213-
if (w == 1) mode |= AC_W_PROTECTED;
2214-
} else {
2215-
if (r == 1) mode |= AC_R_PRIVATE;
2216-
if (w == 1) mode |= AC_W_PRIVATE;
2217-
}
2218-
}
2219-
vmode = PyInt_FromLong((long)mode);
2220-
imode = com_addconst(c, vmode);
2221-
Py_XDECREF(vmode);
2222-
for (i = 1; TYPE(CHILD(n,i-1)) != COLON; i+=2) {
2223-
com_addoparg(c, LOAD_CONST, imode);
2224-
com_addopname(c, ACCESS_MODE, CHILD(n, i));
2225-
}
2226-
}
2227-
#endif
2228-
22292167
static void
22302168
com_exec_stmt(c, n)
22312169
struct compiling *c;
@@ -2938,11 +2876,6 @@ com_node(c, n)
29382876
case global_stmt:
29392877
com_global_stmt(c, n);
29402878
break;
2941-
#ifdef SUPPORT_OBSOLETE_ACCESS
2942-
case access_stmt:
2943-
com_access_stmt(c, n);
2944-
break;
2945-
#endif
29462879
case exec_stmt:
29472880
com_exec_stmt(c, n);
29482881
break;

0 commit comments

Comments
 (0)