Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
280e6bd7
Kaydet (Commit)
280e6bd7
authored
Mar 22, 2001
tarafından
Jeremy Hylton
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make error messages clearer for illegal combinations of nested
functions and import */exec.
üst
6e9c0baa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
15 deletions
+36
-15
compile.c
Python/compile.c
+36
-15
No files found.
Python/compile.c
Dosyayı görüntüle @
280e6bd7
...
@@ -4191,32 +4191,53 @@ symtable_check_unoptimized(struct compiling *c,
...
@@ -4191,32 +4191,53 @@ symtable_check_unoptimized(struct compiling *c,
||
(
ste
->
ste_nested
&&
si
->
si_nimplicit
)))
||
(
ste
->
ste_nested
&&
si
->
si_nimplicit
)))
return
0
;
return
0
;
#define ILLEGAL_CONTAINS "contains a nested function with free variables"
#define ILLEGAL_IS "is a nested function"
#define ILLEGAL_IMPORT_STAR \
#define ILLEGAL_IMPORT_STAR \
"import * is not allowed in function '%.100s' " \
"import * is not allowed in function '%.100s' because it %s"
"because it contains a nested function with free variables"
#define ILLEGAL_BARE_EXEC \
#define ILLEGAL_BARE_EXEC \
"unqualified exec is not allowed in function '%.100s' " \
"unqualified exec is not allowed in function '%.100s' it %s"
"because it contains a nested function with free variables"
#define ILLEGAL_EXEC_AND_IMPORT_STAR \
#define ILLEGAL_EXEC_AND_IMPORT_STAR \
"function '%.100s' uses import * and bare exec, which are illegal" \
"function '%.100s' uses import * and bare exec, which are illegal" \
"because it
contains a nested function with free variable
s"
"because it
%
s"
/* XXX perhaps the linenos for these opt-breaking statements
/* XXX perhaps the linenos for these opt-breaking statements
should be stored so the exception can point to them. */
should be stored so the exception can point to them. */
if
(
ste
->
ste_optimized
==
OPT_IMPORT_STAR
)
if
(
ste
->
ste_child_free
)
{
sprintf
(
buf
,
ILLEGAL_IMPORT_STAR
,
if
(
ste
->
ste_optimized
==
OPT_IMPORT_STAR
)
PyString_AS_STRING
(
ste
->
ste_name
));
sprintf
(
buf
,
ILLEGAL_IMPORT_STAR
,
else
if
(
ste
->
ste_optimized
==
(
OPT_BARE_EXEC
|
OPT_EXEC
))
PyString_AS_STRING
(
ste
->
ste_name
),
sprintf
(
buf
,
ILLEGAL_BARE_EXEC
,
ILLEGAL_CONTAINS
);
PyString_AS_STRING
(
ste
->
ste_name
));
else
if
(
ste
->
ste_optimized
==
(
OPT_BARE_EXEC
|
OPT_EXEC
))
else
{
sprintf
(
buf
,
ILLEGAL_BARE_EXEC
,
sprintf
(
buf
,
ILLEGAL_EXEC_AND_IMPORT_STAR
,
PyString_AS_STRING
(
ste
->
ste_name
),
PyString_AS_STRING
(
ste
->
ste_name
));
ILLEGAL_CONTAINS
);
else
{
sprintf
(
buf
,
ILLEGAL_EXEC_AND_IMPORT_STAR
,
PyString_AS_STRING
(
ste
->
ste_name
),
ILLEGAL_CONTAINS
);
}
}
else
{
if
(
ste
->
ste_optimized
==
OPT_IMPORT_STAR
)
sprintf
(
buf
,
ILLEGAL_IMPORT_STAR
,
PyString_AS_STRING
(
ste
->
ste_name
),
ILLEGAL_IS
);
else
if
(
ste
->
ste_optimized
==
(
OPT_BARE_EXEC
|
OPT_EXEC
))
sprintf
(
buf
,
ILLEGAL_BARE_EXEC
,
PyString_AS_STRING
(
ste
->
ste_name
),
ILLEGAL_IS
);
else
{
sprintf
(
buf
,
ILLEGAL_EXEC_AND_IMPORT_STAR
,
PyString_AS_STRING
(
ste
->
ste_name
),
ILLEGAL_IS
);
}
}
}
if
(
c
->
c_symtable
->
st_nested_scopes
)
{
if
(
c
->
c_symtable
->
st_nested_scopes
)
{
PyErr_SetString
(
PyExc_SyntaxError
,
buf
);
PyErr_SetString
(
PyExc_SyntaxError
,
buf
);
PyErr_SyntaxLocation
(
c
->
c_symtable
->
st_filename
,
PyErr_SyntaxLocation
(
c
->
c_symtable
->
st_filename
,
...
...
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