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
897b8212
Commit
897b8212
authored
Mar 23, 2001
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make it illegal to assign to __debug__ as per Guido's request.
parent
e280c06d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
Python/compile.c
Python/compile.c
+12
-1
No files found.
Python/compile.c
View file @
897b8212
...
@@ -66,6 +66,9 @@ int Py_OptimizeFlag = 0;
...
@@ -66,6 +66,9 @@ int Py_OptimizeFlag = 0;
#define LATE_FUTURE \
#define LATE_FUTURE \
"from __future__ imports must occur at the beginning of the file"
"from __future__ imports must occur at the beginning of the file"
#define ASSIGN_DEBUG \
"can not assign to __debug__"
#define MANGLE_LEN 256
#define MANGLE_LEN 256
#define OFF(x) offsetof(PyCodeObject, x)
#define OFF(x) offsetof(PyCodeObject, x)
...
@@ -5181,8 +5184,16 @@ symtable_assign(struct symtable *st, node *n, int flag)
...
@@ -5181,8 +5184,16 @@ symtable_assign(struct symtable *st, node *n, int flag)
if
(
TYPE
(
tmp
)
==
LPAR
||
TYPE
(
tmp
)
==
LSQB
)
{
if
(
TYPE
(
tmp
)
==
LPAR
||
TYPE
(
tmp
)
==
LSQB
)
{
n
=
CHILD
(
n
,
1
);
n
=
CHILD
(
n
,
1
);
goto
loop
;
goto
loop
;
}
else
if
(
TYPE
(
tmp
)
==
NAME
)
}
else
if
(
TYPE
(
tmp
)
==
NAME
)
{
if
(
strcmp
(
STR
(
tmp
),
"__debug__"
)
==
0
)
{
PyErr_SetString
(
PyExc_SyntaxError
,
ASSIGN_DEBUG
);
PyErr_SyntaxLocation
(
st
->
st_filename
,
n
->
n_lineno
);
st
->
st_errors
++
;
}
symtable_add_def
(
st
,
STR
(
tmp
),
DEF_LOCAL
|
flag
);
symtable_add_def
(
st
,
STR
(
tmp
),
DEF_LOCAL
|
flag
);
}
return
;
return
;
case
dotted_as_name
:
case
dotted_as_name
:
if
(
NCH
(
n
)
==
3
)
if
(
NCH
(
n
)
==
3
)
...
...
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