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
6b17abf6
Kaydet (Commit)
6b17abf6
authored
Tem 09, 2002
tarafından
Thomas Heller
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix SF Bug 564931: compile() traceback must include filename.
üst
4254cbd2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
4 deletions
+55
-4
parsetok.h
Include/parsetok.h
+4
-0
pythonrun.h
Include/pythonrun.h
+4
-0
test_compile.py
Lib/test/test_compile.py
+9
-0
parsetok.c
Parser/parsetok.c
+11
-2
pythonrun.c
Python/pythonrun.c
+27
-2
No files found.
Include/parsetok.h
Dosyayı görüntüle @
6b17abf6
...
...
@@ -32,6 +32,10 @@ extern DL_IMPORT(node *) PyParser_ParseFileFlags(FILE *, char *, grammar *,
int
,
char
*
,
char
*
,
perrdetail
*
,
int
);
extern
DL_IMPORT
(
node
*
)
PyParser_ParseStringFlagsFilename
(
char
*
,
char
*
,
grammar
*
,
int
,
perrdetail
*
,
int
);
#ifdef __cplusplus
}
#endif
...
...
Include/pythonrun.h
Dosyayı görüntüle @
6b17abf6
...
...
@@ -45,6 +45,10 @@ DL_IMPORT(int) PyRun_InteractiveLoopFlags(FILE *, char *, PyCompilerFlags *);
DL_IMPORT
(
struct
_node
*
)
PyParser_SimpleParseString
(
char
*
,
int
);
DL_IMPORT
(
struct
_node
*
)
PyParser_SimpleParseFile
(
FILE
*
,
char
*
,
int
);
DL_IMPORT
(
struct
_node
*
)
PyParser_SimpleParseStringFlags
(
char
*
,
int
,
int
);
DL_IMPORT
(
struct
_node
*
)
PyParser_SimpleParseStringFlagsFilename
(
char
*
,
char
*
,
int
,
int
);
DL_IMPORT
(
struct
_node
*
)
PyParser_SimpleParseFileFlags
(
FILE
*
,
char
*
,
int
,
int
);
...
...
Lib/test/test_compile.py
Dosyayı görüntüle @
6b17abf6
...
...
@@ -22,6 +22,15 @@ try:
except
SyntaxError
:
pass
if
verbose
:
print
"compiling string with syntax error"
try
:
compile
(
"1+*3"
,
"filename"
,
"exec"
)
except
SyntaxError
,
detail
:
if
not
detail
.
filename
==
"filename"
:
raise
TestFailed
,
"expected 'filename', got
%
r"
%
detail
.
filename
try
:
exec
'def f(a = 0, a = 1): pass'
raise
TestFailed
,
"duplicate keyword arguments"
...
...
Parser/parsetok.c
Dosyayı görüntüle @
6b17abf6
...
...
@@ -26,10 +26,19 @@ PyParser_ParseString(char *s, grammar *g, int start, perrdetail *err_ret)
node
*
PyParser_ParseStringFlags
(
char
*
s
,
grammar
*
g
,
int
start
,
perrdetail
*
err_ret
,
int
flags
)
{
return
PyParser_ParseStringFlagsFilename
(
s
,
NULL
,
g
,
start
,
err_ret
,
0
);
}
node
*
PyParser_ParseStringFlagsFilename
(
char
*
s
,
char
*
filename
,
grammar
*
g
,
int
start
,
perrdetail
*
err_ret
,
int
flags
)
{
struct
tok_state
*
tok
;
initerr
(
err_ret
,
NULL
);
initerr
(
err_ret
,
filename
);
if
((
tok
=
PyTokenizer_FromString
(
s
))
==
NULL
)
{
err_ret
->
error
=
E_NOMEM
;
...
...
@@ -37,7 +46,7 @@ PyParser_ParseStringFlags(char *s, grammar *g, int start,
}
if
(
Py_TabcheckFlag
||
Py_VerboseFlag
)
{
tok
->
filename
=
"<string>"
;
tok
->
filename
=
filename
?
filename
:
"<string>"
;
tok
->
altwarning
=
(
tok
->
filename
!=
NULL
);
if
(
Py_TabcheckFlag
>=
2
)
tok
->
alterror
++
;
...
...
Python/pythonrun.c
Dosyayı görüntüle @
6b17abf6
...
...
@@ -1134,7 +1134,9 @@ Py_CompileStringFlags(char *str, char *filename, int start,
{
node
*
n
;
PyCodeObject
*
co
;
n
=
PyParser_SimpleParseStringFlags
(
str
,
start
,
PARSER_FLAGS
(
flags
));
n
=
PyParser_SimpleParseStringFlagsFilename
(
str
,
filename
,
start
,
PARSER_FLAGS
(
flags
));
if
(
n
==
NULL
)
return
NULL
;
co
=
PyNode_CompileFlags
(
n
,
filename
,
flags
);
...
...
@@ -1147,7 +1149,8 @@ Py_SymtableString(char *str, char *filename, int start)
{
node
*
n
;
struct
symtable
*
st
;
n
=
PyParser_SimpleParseString
(
str
,
start
);
n
=
PyParser_SimpleParseStringFlagsFilename
(
str
,
filename
,
start
,
0
);
if
(
n
==
NULL
)
return
NULL
;
st
=
PyNode_CompileSymtable
(
n
,
filename
);
...
...
@@ -1195,6 +1198,28 @@ PyParser_SimpleParseString(char *str, int start)
return
PyParser_SimpleParseStringFlags
(
str
,
start
,
0
);
}
node
*
PyParser_SimpleParseStringFlagsFilename
(
char
*
str
,
char
*
filename
,
int
start
,
int
flags
)
{
node
*
n
;
perrdetail
err
;
n
=
PyParser_ParseStringFlagsFilename
(
str
,
filename
,
&
_PyParser_Grammar
,
start
,
&
err
,
flags
);
if
(
n
==
NULL
)
err_input
(
&
err
);
return
n
;
}
node
*
PyParser_SimpleParseStringFilename
(
char
*
str
,
char
*
filename
,
int
start
)
{
return
PyParser_SimpleParseStringFlagsFilename
(
str
,
filename
,
start
,
0
);
}
/* Set the error appropriate to the given input error code (see errcode.h) */
static
void
...
...
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