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
7a46fc58
Commit
7a46fc58
authored
Dec 11, 2002
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Constify filenames and scripts. Fixes #651362.
parent
6ff52808
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
126 additions
and
121 deletions
+126
-121
Include/compile.h
Include/compile.h
+3
-3
Include/parsetok.h
Include/parsetok.h
+7
-7
Include/pyerrors.h
Include/pyerrors.h
+5
-4
Include/pythonrun.h
Include/pythonrun.h
+32
-32
Include/symtable.h
Include/symtable.h
+2
-2
Parser/parsetok.c
Parser/parsetok.c
+7
-7
Parser/tokenizer.c
Parser/tokenizer.c
+5
-3
Parser/tokenizer.h
Parser/tokenizer.h
+2
-2
Python/compile.c
Python/compile.c
+13
-11
Python/errors.c
Python/errors.c
+5
-5
Python/future.c
Python/future.c
+4
-4
Python/pythonrun.c
Python/pythonrun.c
+41
-41
No files found.
Include/compile.h
View file @
7a46fc58
...
...
@@ -52,7 +52,7 @@ PyAPI_DATA(PyTypeObject) PyCode_Type;
/* Public interface */
struct
_node
;
/* Declare the existence of this type */
PyAPI_FUNC
(
PyCodeObject
*
)
PyNode_Compile
(
struct
_node
*
,
char
*
);
PyAPI_FUNC
(
PyCodeObject
*
)
PyNode_Compile
(
struct
_node
*
,
c
onst
c
har
*
);
PyAPI_FUNC
(
PyCodeObject
*
)
PyCode_New
(
int
,
int
,
int
,
int
,
PyObject
*
,
PyObject
*
,
PyObject
*
,
PyObject
*
,
PyObject
*
,
PyObject
*
,
PyObject
*
,
PyObject
*
,
int
,
PyObject
*
);
...
...
@@ -67,8 +67,8 @@ typedef struct {
int
ff_features
;
}
PyFutureFeatures
;
PyAPI_FUNC
(
PyFutureFeatures
*
)
PyNode_Future
(
struct
_node
*
,
char
*
);
PyAPI_FUNC
(
PyCodeObject
*
)
PyNode_CompileFlags
(
struct
_node
*
,
char
*
,
PyAPI_FUNC
(
PyFutureFeatures
*
)
PyNode_Future
(
struct
_node
*
,
c
onst
c
har
*
);
PyAPI_FUNC
(
PyCodeObject
*
)
PyNode_CompileFlags
(
struct
_node
*
,
c
onst
c
har
*
,
PyCompilerFlags
*
);
#define FUTURE_NESTED_SCOPES "nested_scopes"
...
...
Include/parsetok.h
View file @
7a46fc58
...
...
@@ -9,7 +9,7 @@ extern "C" {
typedef
struct
{
int
error
;
char
*
filename
;
c
onst
c
har
*
filename
;
int
lineno
;
int
offset
;
char
*
text
;
...
...
@@ -21,19 +21,19 @@ typedef struct {
#define PyPARSE_YIELD_IS_KEYWORD 0x0001
#endif
PyAPI_FUNC
(
node
*
)
PyParser_ParseString
(
char
*
,
grammar
*
,
int
,
PyAPI_FUNC
(
node
*
)
PyParser_ParseString
(
c
onst
c
har
*
,
grammar
*
,
int
,
perrdetail
*
);
PyAPI_FUNC
(
node
*
)
PyParser_ParseFile
(
FILE
*
,
char
*
,
grammar
*
,
int
,
PyAPI_FUNC
(
node
*
)
PyParser_ParseFile
(
FILE
*
,
c
onst
c
har
*
,
grammar
*
,
int
,
char
*
,
char
*
,
perrdetail
*
);
PyAPI_FUNC
(
node
*
)
PyParser_ParseStringFlags
(
char
*
,
grammar
*
,
int
,
PyAPI_FUNC
(
node
*
)
PyParser_ParseStringFlags
(
c
onst
c
har
*
,
grammar
*
,
int
,
perrdetail
*
,
int
);
PyAPI_FUNC
(
node
*
)
PyParser_ParseFileFlags
(
FILE
*
,
char
*
,
grammar
*
,
PyAPI_FUNC
(
node
*
)
PyParser_ParseFileFlags
(
FILE
*
,
c
onst
c
har
*
,
grammar
*
,
int
,
char
*
,
char
*
,
perrdetail
*
,
int
);
PyAPI_FUNC
(
node
*
)
PyParser_ParseStringFlagsFilename
(
char
*
,
char
*
,
PyAPI_FUNC
(
node
*
)
PyParser_ParseStringFlagsFilename
(
c
onst
c
har
*
,
c
onst
c
har
*
,
grammar
*
,
int
,
perrdetail
*
,
int
);
#ifdef __cplusplus
...
...
Include/pyerrors.h
View file @
7a46fc58
...
...
@@ -130,16 +130,17 @@ PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *);
/* Issue a warning or exception */
PyAPI_FUNC
(
int
)
PyErr_Warn
(
PyObject
*
,
char
*
);
PyAPI_FUNC
(
int
)
PyErr_WarnExplicit
(
PyObject
*
,
char
*
,
char
*
,
int
,
char
*
,
PyObject
*
);
PyAPI_FUNC
(
int
)
PyErr_WarnExplicit
(
PyObject
*
,
const
char
*
,
const
char
*
,
int
,
const
char
*
,
PyObject
*
);
/* In sigcheck.c or signalmodule.c */
PyAPI_FUNC
(
int
)
PyErr_CheckSignals
(
void
);
PyAPI_FUNC
(
void
)
PyErr_SetInterrupt
(
void
);
/* Support for adding program text to SyntaxErrors */
PyAPI_FUNC
(
void
)
PyErr_SyntaxLocation
(
char
*
,
int
);
PyAPI_FUNC
(
PyObject
*
)
PyErr_ProgramText
(
char
*
,
int
);
PyAPI_FUNC
(
void
)
PyErr_SyntaxLocation
(
c
onst
c
har
*
,
int
);
PyAPI_FUNC
(
PyObject
*
)
PyErr_ProgramText
(
c
onst
c
har
*
,
int
);
#ifdef Py_USING_UNICODE
/* The following functions are used to create and modify unicode
...
...
Include/pythonrun.h
View file @
7a46fc58
...
...
@@ -26,47 +26,47 @@ PyAPI_FUNC(int) Py_IsInitialized(void);
PyAPI_FUNC
(
PyThreadState
*
)
Py_NewInterpreter
(
void
);
PyAPI_FUNC
(
void
)
Py_EndInterpreter
(
PyThreadState
*
);
PyAPI_FUNC
(
int
)
PyRun_AnyFile
(
FILE
*
,
char
*
);
PyAPI_FUNC
(
int
)
PyRun_AnyFileEx
(
FILE
*
,
char
*
,
int
);
PyAPI_FUNC
(
int
)
PyRun_AnyFileFlags
(
FILE
*
,
char
*
,
PyCompilerFlags
*
);
PyAPI_FUNC
(
int
)
PyRun_AnyFileExFlags
(
FILE
*
,
char
*
,
int
,
PyCompilerFlags
*
);
PyAPI_FUNC
(
int
)
PyRun_SimpleString
(
char
*
);
PyAPI_FUNC
(
int
)
PyRun_SimpleStringFlags
(
char
*
,
PyCompilerFlags
*
);
PyAPI_FUNC
(
int
)
PyRun_SimpleFile
(
FILE
*
,
char
*
);
PyAPI_FUNC
(
int
)
PyRun_SimpleFileEx
(
FILE
*
,
char
*
,
int
);
PyAPI_FUNC
(
int
)
PyRun_SimpleFileExFlags
(
FILE
*
,
char
*
,
int
,
PyCompilerFlags
*
);
PyAPI_FUNC
(
int
)
PyRun_InteractiveOne
(
FILE
*
,
char
*
);
PyAPI_FUNC
(
int
)
PyRun_InteractiveOneFlags
(
FILE
*
,
char
*
,
PyCompilerFlags
*
);
PyAPI_FUNC
(
int
)
PyRun_InteractiveLoop
(
FILE
*
,
char
*
);
PyAPI_FUNC
(
int
)
PyRun_InteractiveLoopFlags
(
FILE
*
,
char
*
,
PyCompilerFlags
*
);
PyAPI_FUNC
(
struct
_node
*
)
PyParser_SimpleParseString
(
char
*
,
int
);
PyAPI_FUNC
(
struct
_node
*
)
PyParser_SimpleParseFile
(
FILE
*
,
char
*
,
int
);
PyAPI_FUNC
(
struct
_node
*
)
PyParser_SimpleParseStringFlags
(
char
*
,
int
,
int
);
PyAPI_FUNC
(
struct
_node
*
)
PyParser_SimpleParseStringFlagsFilename
(
char
*
,
char
*
,
PyAPI_FUNC
(
int
)
PyRun_AnyFile
(
FILE
*
,
c
onst
c
har
*
);
PyAPI_FUNC
(
int
)
PyRun_AnyFileEx
(
FILE
*
,
c
onst
c
har
*
,
int
);
PyAPI_FUNC
(
int
)
PyRun_AnyFileFlags
(
FILE
*
,
c
onst
c
har
*
,
PyCompilerFlags
*
);
PyAPI_FUNC
(
int
)
PyRun_AnyFileExFlags
(
FILE
*
,
c
onst
c
har
*
,
int
,
PyCompilerFlags
*
);
PyAPI_FUNC
(
int
)
PyRun_SimpleString
(
c
onst
c
har
*
);
PyAPI_FUNC
(
int
)
PyRun_SimpleStringFlags
(
c
onst
c
har
*
,
PyCompilerFlags
*
);
PyAPI_FUNC
(
int
)
PyRun_SimpleFile
(
FILE
*
,
c
onst
c
har
*
);
PyAPI_FUNC
(
int
)
PyRun_SimpleFileEx
(
FILE
*
,
c
onst
c
har
*
,
int
);
PyAPI_FUNC
(
int
)
PyRun_SimpleFileExFlags
(
FILE
*
,
c
onst
c
har
*
,
int
,
PyCompilerFlags
*
);
PyAPI_FUNC
(
int
)
PyRun_InteractiveOne
(
FILE
*
,
c
onst
c
har
*
);
PyAPI_FUNC
(
int
)
PyRun_InteractiveOneFlags
(
FILE
*
,
c
onst
c
har
*
,
PyCompilerFlags
*
);
PyAPI_FUNC
(
int
)
PyRun_InteractiveLoop
(
FILE
*
,
c
onst
c
har
*
);
PyAPI_FUNC
(
int
)
PyRun_InteractiveLoopFlags
(
FILE
*
,
c
onst
c
har
*
,
PyCompilerFlags
*
);
PyAPI_FUNC
(
struct
_node
*
)
PyParser_SimpleParseString
(
c
onst
c
har
*
,
int
);
PyAPI_FUNC
(
struct
_node
*
)
PyParser_SimpleParseFile
(
FILE
*
,
c
onst
c
har
*
,
int
);
PyAPI_FUNC
(
struct
_node
*
)
PyParser_SimpleParseStringFlags
(
c
onst
c
har
*
,
int
,
int
);
PyAPI_FUNC
(
struct
_node
*
)
PyParser_SimpleParseStringFlagsFilename
(
c
onst
c
har
*
,
c
onst
c
har
*
,
int
,
int
);
PyAPI_FUNC
(
struct
_node
*
)
PyParser_SimpleParseFileFlags
(
FILE
*
,
char
*
,
PyAPI_FUNC
(
struct
_node
*
)
PyParser_SimpleParseFileFlags
(
FILE
*
,
c
onst
c
har
*
,
int
,
int
);
PyAPI_FUNC
(
PyObject
*
)
PyRun_String
(
char
*
,
int
,
PyObject
*
,
PyObject
*
);
PyAPI_FUNC
(
PyObject
*
)
PyRun_File
(
FILE
*
,
char
*
,
int
,
PyObject
*
,
PyObject
*
);
PyAPI_FUNC
(
PyObject
*
)
PyRun_FileEx
(
FILE
*
,
char
*
,
int
,
PyAPI_FUNC
(
PyObject
*
)
PyRun_String
(
c
onst
c
har
*
,
int
,
PyObject
*
,
PyObject
*
);
PyAPI_FUNC
(
PyObject
*
)
PyRun_File
(
FILE
*
,
c
onst
c
har
*
,
int
,
PyObject
*
,
PyObject
*
);
PyAPI_FUNC
(
PyObject
*
)
PyRun_FileEx
(
FILE
*
,
c
onst
c
har
*
,
int
,
PyObject
*
,
PyObject
*
,
int
);
PyAPI_FUNC
(
PyObject
*
)
PyRun_StringFlags
(
char
*
,
int
,
PyObject
*
,
PyObject
*
,
PyAPI_FUNC
(
PyObject
*
)
PyRun_StringFlags
(
c
onst
c
har
*
,
int
,
PyObject
*
,
PyObject
*
,
PyCompilerFlags
*
);
PyAPI_FUNC
(
PyObject
*
)
PyRun_FileFlags
(
FILE
*
,
char
*
,
int
,
PyObject
*
,
PyAPI_FUNC
(
PyObject
*
)
PyRun_FileFlags
(
FILE
*
,
c
onst
c
har
*
,
int
,
PyObject
*
,
PyObject
*
,
PyCompilerFlags
*
);
PyAPI_FUNC
(
PyObject
*
)
PyRun_FileExFlags
(
FILE
*
,
char
*
,
int
,
PyObject
*
,
PyAPI_FUNC
(
PyObject
*
)
PyRun_FileExFlags
(
FILE
*
,
c
onst
c
har
*
,
int
,
PyObject
*
,
PyObject
*
,
int
,
PyCompilerFlags
*
);
PyAPI_FUNC
(
PyObject
*
)
Py_CompileString
(
c
har
*
,
char
*
,
int
);
PyAPI_FUNC
(
PyObject
*
)
Py_CompileStringFlags
(
c
har
*
,
char
*
,
int
,
PyAPI_FUNC
(
PyObject
*
)
Py_CompileString
(
c
onst
char
*
,
const
char
*
,
int
);
PyAPI_FUNC
(
PyObject
*
)
Py_CompileStringFlags
(
c
onst
char
*
,
const
char
*
,
int
,
PyCompilerFlags
*
);
PyAPI_FUNC
(
struct
symtable
*
)
Py_SymtableString
(
c
har
*
,
char
*
,
int
);
PyAPI_FUNC
(
struct
symtable
*
)
Py_SymtableString
(
c
onst
char
*
,
const
char
*
,
int
);
PyAPI_FUNC
(
void
)
PyErr_Print
(
void
);
PyAPI_FUNC
(
void
)
PyErr_PrintEx
(
int
);
...
...
@@ -76,7 +76,7 @@ PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
PyAPI_FUNC
(
void
)
Py_Exit
(
int
);
PyAPI_FUNC
(
int
)
Py_FdIsInteractive
(
FILE
*
,
char
*
);
PyAPI_FUNC
(
int
)
Py_FdIsInteractive
(
FILE
*
,
c
onst
c
har
*
);
/* Bootstrap */
PyAPI_FUNC
(
int
)
Py_Main
(
int
argc
,
char
**
argv
);
...
...
Include/symtable.h
View file @
7a46fc58
...
...
@@ -20,7 +20,7 @@ struct _symtable_entry;
struct
symtable
{
int
st_pass
;
/* pass == 1 or 2 */
c
har
*
st_filename
;
/* name of file being compiled */
c
onst
char
*
st_filename
;
/* name of file being compiled */
struct
_symtable_entry
*
st_cur
;
/* current symbol table entry */
PyObject
*
st_symbols
;
/* dictionary of symbol table entries */
PyObject
*
st_stack
;
/* stack of namespace info */
...
...
@@ -57,7 +57,7 @@ PyAPI_DATA(PyTypeObject) PySymtableEntry_Type;
PyAPI_FUNC
(
PyObject
*
)
PySymtableEntry_New
(
struct
symtable
*
,
char
*
,
int
,
int
);
PyAPI_FUNC
(
struct
symtable
*
)
PyNode_CompileSymtable
(
struct
_node
*
,
char
*
);
PyAPI_FUNC
(
struct
symtable
*
)
PyNode_CompileSymtable
(
struct
_node
*
,
c
onst
c
har
*
);
PyAPI_FUNC
(
void
)
PySymtable_Free
(
struct
symtable
*
);
...
...
Parser/parsetok.c
View file @
7a46fc58
...
...
@@ -15,17 +15,17 @@ int Py_TabcheckFlag;
/* Forward */
static
node
*
parsetok
(
struct
tok_state
*
,
grammar
*
,
int
,
perrdetail
*
,
int
);
static
void
initerr
(
perrdetail
*
err_ret
,
char
*
filename
);
static
void
initerr
(
perrdetail
*
err_ret
,
c
onst
c
har
*
filename
);
/* Parse input coming from a string. Return error code, print some errors. */
node
*
PyParser_ParseString
(
char
*
s
,
grammar
*
g
,
int
start
,
perrdetail
*
err_ret
)
PyParser_ParseString
(
c
onst
c
har
*
s
,
grammar
*
g
,
int
start
,
perrdetail
*
err_ret
)
{
return
PyParser_ParseStringFlags
(
s
,
g
,
start
,
err_ret
,
0
);
}
node
*
PyParser_ParseStringFlags
(
char
*
s
,
grammar
*
g
,
int
start
,
PyParser_ParseStringFlags
(
c
onst
c
har
*
s
,
grammar
*
g
,
int
start
,
perrdetail
*
err_ret
,
int
flags
)
{
return
PyParser_ParseStringFlagsFilename
(
s
,
NULL
,
...
...
@@ -33,7 +33,7 @@ PyParser_ParseStringFlags(char *s, grammar *g, int start,
}
node
*
PyParser_ParseStringFlagsFilename
(
c
har
*
s
,
char
*
filename
,
PyParser_ParseStringFlagsFilename
(
c
onst
char
*
s
,
const
char
*
filename
,
grammar
*
g
,
int
start
,
perrdetail
*
err_ret
,
int
flags
)
{
...
...
@@ -60,7 +60,7 @@ PyParser_ParseStringFlagsFilename(char *s, char *filename,
/* Parse input coming from a file. Return error code, print some errors. */
node
*
PyParser_ParseFile
(
FILE
*
fp
,
char
*
filename
,
grammar
*
g
,
int
start
,
PyParser_ParseFile
(
FILE
*
fp
,
c
onst
c
har
*
filename
,
grammar
*
g
,
int
start
,
char
*
ps1
,
char
*
ps2
,
perrdetail
*
err_ret
)
{
return
PyParser_ParseFileFlags
(
fp
,
filename
,
g
,
start
,
ps1
,
ps2
,
...
...
@@ -68,7 +68,7 @@ PyParser_ParseFile(FILE *fp, char *filename, grammar *g, int start,
}
node
*
PyParser_ParseFileFlags
(
FILE
*
fp
,
char
*
filename
,
grammar
*
g
,
int
start
,
PyParser_ParseFileFlags
(
FILE
*
fp
,
c
onst
c
har
*
filename
,
grammar
*
g
,
int
start
,
char
*
ps1
,
char
*
ps2
,
perrdetail
*
err_ret
,
int
flags
)
{
struct
tok_state
*
tok
;
...
...
@@ -201,7 +201,7 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
}
static
void
initerr
(
perrdetail
*
err_ret
,
char
*
filename
)
initerr
(
perrdetail
*
err_ret
,
c
onst
c
har
*
filename
)
{
err_ret
->
error
=
E_OK
;
err_ret
->
filename
=
filename
;
...
...
Parser/tokenizer.c
View file @
7a46fc58
...
...
@@ -386,7 +386,8 @@ fp_setreadl(struct tok_state *tok, const char* enc)
{
PyObject
*
reader
,
*
stream
,
*
readline
;
stream
=
PyFile_FromFile
(
tok
->
fp
,
tok
->
filename
,
"rb"
,
NULL
);
/* XXX: constify filename argument. */
stream
=
PyFile_FromFile
(
tok
->
fp
,
(
char
*
)
tok
->
filename
,
"rb"
,
NULL
);
if
(
stream
==
NULL
)
return
0
;
...
...
@@ -591,7 +592,7 @@ decode_str(const char *str, struct tok_state *tok)
/* Set up tokenizer for string */
struct
tok_state
*
PyTokenizer_FromString
(
char
*
str
)
PyTokenizer_FromString
(
c
onst
c
har
*
str
)
{
struct
tok_state
*
tok
=
tok_new
();
if
(
tok
==
NULL
)
...
...
@@ -599,7 +600,8 @@ PyTokenizer_FromString(char *str)
str
=
(
char
*
)
decode_str
(
str
,
tok
);
if
(
str
==
NULL
)
return
NULL
;
tok
->
buf
=
tok
->
cur
=
tok
->
end
=
tok
->
inp
=
str
;
/* XXX: constify members. */
tok
->
buf
=
tok
->
cur
=
tok
->
end
=
tok
->
inp
=
(
char
*
)
str
;
return
tok
;
}
...
...
Parser/tokenizer.h
View file @
7a46fc58
...
...
@@ -34,7 +34,7 @@ struct tok_state {
int
level
;
/* () [] {} Parentheses nesting level */
/* Used to allow free continuations inside them */
/* Stuff for checking on different tab sizes */
char
*
filename
;
/* For error messages */
c
onst
c
har
*
filename
;
/* For error messages */
int
altwarning
;
/* Issue warning if alternate tabs don't match */
int
alterror
;
/* Issue error if alternate tabs don't match */
int
alttabsize
;
/* Alternate tab spacing */
...
...
@@ -54,7 +54,7 @@ struct tok_state {
const
char
*
str
;
};
extern
struct
tok_state
*
PyTokenizer_FromString
(
char
*
);
extern
struct
tok_state
*
PyTokenizer_FromString
(
c
onst
c
har
*
);
extern
struct
tok_state
*
PyTokenizer_FromFile
(
FILE
*
,
char
*
,
char
*
);
extern
void
PyTokenizer_Free
(
struct
tok_state
*
);
extern
int
PyTokenizer_Get
(
struct
tok_state
*
,
char
**
,
char
**
);
...
...
Python/compile.c
View file @
7a46fc58
...
...
@@ -472,7 +472,7 @@ struct compiling {
int
c_begin
;
/* begin of current loop, for 'continue' */
int
c_block
[
CO_MAXBLOCKS
];
/* stack of block types */
int
c_nblocks
;
/* current block stack level */
char
*
c_filename
;
/* filename of current node */
c
onst
c
har
*
c_filename
;
/* filename of current node */
char
*
c_name
;
/* name of object (e.g. function) */
int
c_lineno
;
/* Current line number */
int
c_stacklevel
;
/* Current stack level */
...
...
@@ -574,8 +574,8 @@ block_pop(struct compiling *c, int type)
/* Prototype forward declarations */
static
int
issue_warning
(
c
har
*
,
char
*
,
int
);
static
int
com_init
(
struct
compiling
*
,
char
*
);
static
int
issue_warning
(
c
onst
char
*
,
const
char
*
,
int
);
static
int
com_init
(
struct
compiling
*
,
c
onst
c
har
*
);
static
void
com_free
(
struct
compiling
*
);
static
void
com_push
(
struct
compiling
*
,
int
);
static
void
com_pop
(
struct
compiling
*
,
int
);
...
...
@@ -597,7 +597,7 @@ static int com_argdefs(struct compiling *, node *);
static
void
com_assign
(
struct
compiling
*
,
node
*
,
int
,
node
*
);
static
void
com_assign_name
(
struct
compiling
*
,
node
*
,
int
);
static
PyCodeObject
*
icompile
(
node
*
,
struct
compiling
*
);
static
PyCodeObject
*
jcompile
(
node
*
,
char
*
,
struct
compiling
*
,
static
PyCodeObject
*
jcompile
(
node
*
,
c
onst
c
har
*
,
struct
compiling
*
,
PyCompilerFlags
*
);
static
PyObject
*
parsestrplus
(
struct
compiling
*
,
node
*
);
static
PyObject
*
parsestr
(
struct
compiling
*
,
char
*
);
...
...
@@ -654,7 +654,7 @@ dump(node *n, int pad, int depth)
#define DUMP(N) dump(N, 0, -1)
static
int
com_init
(
struct
compiling
*
c
,
char
*
filename
)
com_init
(
struct
compiling
*
c
,
c
onst
c
har
*
filename
)
{
memset
((
void
*
)
c
,
'\0'
,
sizeof
(
struct
compiling
));
if
((
c
->
c_code
=
PyString_FromStringAndSize
((
char
*
)
NULL
,
...
...
@@ -1182,7 +1182,9 @@ parsenumber(struct compiling *c, char *s)
"hex/oct constants > sys.maxint "
"will return positive values "
"in Python 2.4 and up"
,
c
->
c_filename
,
/* XXX: Give WarnExplicit
a const char* argument. */
(
char
*
)
c
->
c_filename
,
c
->
c_lineno
,
NULL
,
NULL
)
<
0
)
...
...
@@ -4142,19 +4144,19 @@ dict_keys_inorder(PyObject *dict, int offset)
}
PyCodeObject
*
PyNode_Compile
(
node
*
n
,
char
*
filename
)
PyNode_Compile
(
node
*
n
,
c
onst
c
har
*
filename
)
{
return
PyNode_CompileFlags
(
n
,
filename
,
NULL
);
}
PyCodeObject
*
PyNode_CompileFlags
(
node
*
n
,
char
*
filename
,
PyCompilerFlags
*
flags
)
PyNode_CompileFlags
(
node
*
n
,
c
onst
c
har
*
filename
,
PyCompilerFlags
*
flags
)
{
return
jcompile
(
n
,
filename
,
NULL
,
flags
);
}
struct
symtable
*
PyNode_CompileSymtable
(
node
*
n
,
char
*
filename
)
PyNode_CompileSymtable
(
node
*
n
,
c
onst
c
har
*
filename
)
{
struct
symtable
*
st
;
PyFutureFeatures
*
ff
;
...
...
@@ -4191,7 +4193,7 @@ icompile(node *n, struct compiling *base)
}
static
PyCodeObject
*
jcompile
(
node
*
n
,
char
*
filename
,
struct
compiling
*
base
,
jcompile
(
node
*
n
,
c
onst
c
har
*
filename
,
struct
compiling
*
base
,
PyCompilerFlags
*
flags
)
{
struct
compiling
sc
;
...
...
@@ -4351,7 +4353,7 @@ get_ref_type(struct compiling *c, char *name)
/* Helper functions to issue warnings */
static
int
issue_warning
(
c
har
*
msg
,
char
*
filename
,
int
lineno
)
issue_warning
(
c
onst
char
*
msg
,
const
char
*
filename
,
int
lineno
)
{
if
(
PyErr_WarnExplicit
(
PyExc_SyntaxWarning
,
msg
,
filename
,
lineno
,
NULL
,
NULL
)
<
0
)
{
...
...
Python/errors.c
View file @
7a46fc58
...
...
@@ -637,9 +637,9 @@ PyErr_Warn(PyObject *category, char *message)
/* Warning with explicit origin */
int
PyErr_WarnExplicit
(
PyObject
*
category
,
char
*
message
,
char
*
filename
,
int
lineno
,
char
*
module
,
PyObject
*
registry
)
PyErr_WarnExplicit
(
PyObject
*
category
,
c
onst
c
har
*
message
,
c
onst
c
har
*
filename
,
int
lineno
,
c
onst
c
har
*
module
,
PyObject
*
registry
)
{
PyObject
*
mod
,
*
dict
,
*
func
=
NULL
;
...
...
@@ -679,7 +679,7 @@ PyErr_WarnExplicit(PyObject *category, char *message,
to make printing of exceptions believe it is a syntax error. */
void
PyErr_SyntaxLocation
(
char
*
filename
,
int
lineno
)
PyErr_SyntaxLocation
(
c
onst
c
har
*
filename
,
int
lineno
)
{
PyObject
*
exc
,
*
v
,
*
tb
,
*
tmp
;
...
...
@@ -743,7 +743,7 @@ PyErr_SyntaxLocation(char *filename, int lineno)
*/
PyObject
*
PyErr_ProgramText
(
char
*
filename
,
int
lineno
)
PyErr_ProgramText
(
c
onst
c
har
*
filename
,
int
lineno
)
{
FILE
*
fp
;
int
i
;
...
...
Python/future.c
View file @
7a46fc58
...
...
@@ -14,7 +14,7 @@
#define FUTURE_POSSIBLE(FF) ((FF)->ff_last_lineno == -1)
static
int
future_check_features
(
PyFutureFeatures
*
ff
,
node
*
n
,
char
*
filename
)
future_check_features
(
PyFutureFeatures
*
ff
,
node
*
n
,
c
onst
c
har
*
filename
)
{
int
i
;
char
*
feature
;
...
...
@@ -54,7 +54,7 @@ future_check_features(PyFutureFeatures *ff, node *n, char *filename)
}
static
void
future_error
(
node
*
n
,
char
*
filename
)
future_error
(
node
*
n
,
c
onst
c
har
*
filename
)
{
PyErr_SetString
(
PyExc_SyntaxError
,
"from __future__ imports must occur at the "
...
...
@@ -89,7 +89,7 @@ dotted_name: NAME ('.' NAME)*
*/
static
int
future_parse
(
PyFutureFeatures
*
ff
,
node
*
n
,
char
*
filename
)
future_parse
(
PyFutureFeatures
*
ff
,
node
*
n
,
c
onst
c
har
*
filename
)
{
int
i
,
r
;
loop:
...
...
@@ -240,7 +240,7 @@ future_parse(PyFutureFeatures *ff, node *n, char *filename)
}
PyFutureFeatures
*
PyNode_Future
(
node
*
n
,
char
*
filename
)
PyNode_Future
(
node
*
n
,
c
onst
c
har
*
filename
)
{
PyFutureFeatures
*
ff
;
...
...
Python/pythonrun.c
View file @
7a46fc58
...
...
@@ -32,11 +32,11 @@ extern grammar _PyParser_Grammar; /* From graminit.c */
/* Forward */
static
void
initmain
(
void
);
static
void
initsite
(
void
);
static
PyObject
*
run_err_node
(
node
*
,
char
*
,
PyObject
*
,
PyObject
*
,
static
PyObject
*
run_err_node
(
node
*
,
c
onst
c
har
*
,
PyObject
*
,
PyObject
*
,
PyCompilerFlags
*
);
static
PyObject
*
run_node
(
node
*
,
char
*
,
PyObject
*
,
PyObject
*
,
static
PyObject
*
run_node
(
node
*
,
c
onst
c
har
*
,
PyObject
*
,
PyObject
*
,
PyCompilerFlags
*
);
static
PyObject
*
run_pyc_file
(
FILE
*
,
char
*
,
PyObject
*
,
PyObject
*
,
static
PyObject
*
run_pyc_file
(
FILE
*
,
c
onst
c
har
*
,
PyObject
*
,
PyObject
*
,
PyCompilerFlags
*
);
static
void
err_input
(
perrdetail
*
);
static
void
initsigs
(
void
);
...
...
@@ -458,25 +458,25 @@ initsite(void)
/* Parse input from a file and execute it */
int
PyRun_AnyFile
(
FILE
*
fp
,
char
*
filename
)
PyRun_AnyFile
(
FILE
*
fp
,
c
onst
c
har
*
filename
)
{
return
PyRun_AnyFileExFlags
(
fp
,
filename
,
0
,
NULL
);
}
int
PyRun_AnyFileFlags
(
FILE
*
fp
,
char
*
filename
,
PyCompilerFlags
*
flags
)
PyRun_AnyFileFlags
(
FILE
*
fp
,
c
onst
c
har
*
filename
,
PyCompilerFlags
*
flags
)
{
return
PyRun_AnyFileExFlags
(
fp
,
filename
,
0
,
flags
);
}
int
PyRun_AnyFileEx
(
FILE
*
fp
,
char
*
filename
,
int
closeit
)
PyRun_AnyFileEx
(
FILE
*
fp
,
c
onst
c
har
*
filename
,
int
closeit
)
{
return
PyRun_AnyFileExFlags
(
fp
,
filename
,
closeit
,
NULL
);
}
int
PyRun_AnyFileExFlags
(
FILE
*
fp
,
char
*
filename
,
int
closeit
,
PyRun_AnyFileExFlags
(
FILE
*
fp
,
c
onst
c
har
*
filename
,
int
closeit
,
PyCompilerFlags
*
flags
)
{
if
(
filename
==
NULL
)
...
...
@@ -492,13 +492,13 @@ PyRun_AnyFileExFlags(FILE *fp, char *filename, int closeit,
}
int
PyRun_InteractiveLoop
(
FILE
*
fp
,
char
*
filename
)
PyRun_InteractiveLoop
(
FILE
*
fp
,
c
onst
c
har
*
filename
)
{
return
PyRun_InteractiveLoopFlags
(
fp
,
filename
,
NULL
);
}
int
PyRun_InteractiveLoopFlags
(
FILE
*
fp
,
char
*
filename
,
PyCompilerFlags
*
flags
)
PyRun_InteractiveLoopFlags
(
FILE
*
fp
,
c
onst
c
har
*
filename
,
PyCompilerFlags
*
flags
)
{
PyObject
*
v
;
int
ret
;
...
...
@@ -533,7 +533,7 @@ PyRun_InteractiveLoopFlags(FILE *fp, char *filename, PyCompilerFlags *flags)
}
int
PyRun_InteractiveOne
(
FILE
*
fp
,
char
*
filename
)
PyRun_InteractiveOne
(
FILE
*
fp
,
c
onst
c
har
*
filename
)
{
return
PyRun_InteractiveOneFlags
(
fp
,
filename
,
NULL
);
}
...
...
@@ -548,7 +548,7 @@ PyRun_InteractiveOne(FILE *fp, char *filename)
#endif
int
PyRun_InteractiveOneFlags
(
FILE
*
fp
,
char
*
filename
,
PyCompilerFlags
*
flags
)
PyRun_InteractiveOneFlags
(
FILE
*
fp
,
c
onst
c
har
*
filename
,
PyCompilerFlags
*
flags
)
{
PyObject
*
m
,
*
d
,
*
v
,
*
w
;
node
*
n
;
...
...
@@ -602,7 +602,7 @@ PyRun_InteractiveOneFlags(FILE *fp, char *filename, PyCompilerFlags *flags)
}
int
PyRun_SimpleFile
(
FILE
*
fp
,
char
*
filename
)
PyRun_SimpleFile
(
FILE
*
fp
,
c
onst
c
har
*
filename
)
{
return
PyRun_SimpleFileEx
(
fp
,
filename
,
0
);
}
...
...
@@ -611,7 +611,7 @@ PyRun_SimpleFile(FILE *fp, char *filename)
the file type, and, if we may close it, at the first few bytes. */
static
int
maybe_pyc_file
(
FILE
*
fp
,
c
har
*
filename
,
char
*
ext
,
int
closeit
)
maybe_pyc_file
(
FILE
*
fp
,
c
onst
char
*
filename
,
const
char
*
ext
,
int
closeit
)
{
if
(
strcmp
(
ext
,
".pyc"
)
==
0
||
strcmp
(
ext
,
".pyo"
)
==
0
)
return
1
;
...
...
@@ -655,17 +655,17 @@ maybe_pyc_file(FILE *fp, char* filename, char* ext, int closeit)
}
int
PyRun_SimpleFileEx
(
FILE
*
fp
,
char
*
filename
,
int
closeit
)
PyRun_SimpleFileEx
(
FILE
*
fp
,
c
onst
c
har
*
filename
,
int
closeit
)
{
return
PyRun_SimpleFileExFlags
(
fp
,
filename
,
closeit
,
NULL
);
}
int
PyRun_SimpleFileExFlags
(
FILE
*
fp
,
char
*
filename
,
int
closeit
,
PyRun_SimpleFileExFlags
(
FILE
*
fp
,
c
onst
c
har
*
filename
,
int
closeit
,
PyCompilerFlags
*
flags
)
{
PyObject
*
m
,
*
d
,
*
v
;
char
*
ext
;
c
onst
c
har
*
ext
;
m
=
PyImport_AddModule
(
"__main__"
);
if
(
m
==
NULL
)
...
...
@@ -709,13 +709,13 @@ PyRun_SimpleFileExFlags(FILE *fp, char *filename, int closeit,
}
int
PyRun_SimpleString
(
char
*
command
)
PyRun_SimpleString
(
c
onst
c
har
*
command
)
{
return
PyRun_SimpleStringFlags
(
command
,
NULL
);
}
int
PyRun_SimpleStringFlags
(
char
*
command
,
PyCompilerFlags
*
flags
)
PyRun_SimpleStringFlags
(
c
onst
c
har
*
command
,
PyCompilerFlags
*
flags
)
{
PyObject
*
m
,
*
d
,
*
v
;
m
=
PyImport_AddModule
(
"__main__"
);
...
...
@@ -734,8 +734,8 @@ PyRun_SimpleStringFlags(char *command, PyCompilerFlags *flags)
}
static
int
parse_syntax_error
(
PyObject
*
err
,
PyObject
**
message
,
char
**
filename
,
int
*
lineno
,
int
*
offset
,
char
**
text
)
parse_syntax_error
(
PyObject
*
err
,
PyObject
**
message
,
c
onst
c
har
**
filename
,
int
*
lineno
,
int
*
offset
,
c
onst
c
har
**
text
)
{
long
hold
;
PyObject
*
v
;
...
...
@@ -804,7 +804,7 @@ PyErr_Print(void)
}
static
void
print_error_text
(
PyObject
*
f
,
int
offset
,
char
*
text
)
print_error_text
(
PyObject
*
f
,
int
offset
,
c
onst
c
har
*
text
)
{
char
*
nl
;
if
(
offset
>=
0
)
{
...
...
@@ -936,7 +936,7 @@ void PyErr_Display(PyObject *exception, PyObject *value, PyObject *tb)
PyObject_HasAttrString
(
v
,
"print_file_and_line"
))
{
PyObject
*
message
;
char
*
filename
,
*
text
;
c
onst
c
har
*
filename
,
*
text
;
int
lineno
,
offset
;
if
(
!
parse_syntax_error
(
v
,
&
message
,
&
filename
,
&
lineno
,
&
offset
,
&
text
))
...
...
@@ -1016,21 +1016,21 @@ void PyErr_Display(PyObject *exception, PyObject *value, PyObject *tb)
}
PyObject
*
PyRun_String
(
char
*
str
,
int
start
,
PyObject
*
globals
,
PyObject
*
locals
)
PyRun_String
(
c
onst
c
har
*
str
,
int
start
,
PyObject
*
globals
,
PyObject
*
locals
)
{
return
run_err_node
(
PyParser_SimpleParseString
(
str
,
start
),
"<string>"
,
globals
,
locals
,
NULL
);
}
PyObject
*
PyRun_File
(
FILE
*
fp
,
char
*
filename
,
int
start
,
PyObject
*
globals
,
PyRun_File
(
FILE
*
fp
,
c
onst
c
har
*
filename
,
int
start
,
PyObject
*
globals
,
PyObject
*
locals
)
{
return
PyRun_FileEx
(
fp
,
filename
,
start
,
globals
,
locals
,
0
);
}
PyObject
*
PyRun_FileEx
(
FILE
*
fp
,
char
*
filename
,
int
start
,
PyObject
*
globals
,
PyRun_FileEx
(
FILE
*
fp
,
c
onst
c
har
*
filename
,
int
start
,
PyObject
*
globals
,
PyObject
*
locals
,
int
closeit
)
{
node
*
n
=
PyParser_SimpleParseFile
(
fp
,
filename
,
start
);
...
...
@@ -1040,7 +1040,7 @@ PyRun_FileEx(FILE *fp, char *filename, int start, PyObject *globals,
}
PyObject
*
PyRun_StringFlags
(
char
*
str
,
int
start
,
PyObject
*
globals
,
PyObject
*
locals
,
PyRun_StringFlags
(
c
onst
c
har
*
str
,
int
start
,
PyObject
*
globals
,
PyObject
*
locals
,
PyCompilerFlags
*
flags
)
{
return
run_err_node
(
PyParser_SimpleParseStringFlags
(
...
...
@@ -1049,7 +1049,7 @@ PyRun_StringFlags(char *str, int start, PyObject *globals, PyObject *locals,
}
PyObject
*
PyRun_FileFlags
(
FILE
*
fp
,
char
*
filename
,
int
start
,
PyObject
*
globals
,
PyRun_FileFlags
(
FILE
*
fp
,
c
onst
c
har
*
filename
,
int
start
,
PyObject
*
globals
,
PyObject
*
locals
,
PyCompilerFlags
*
flags
)
{
return
PyRun_FileExFlags
(
fp
,
filename
,
start
,
globals
,
locals
,
0
,
...
...
@@ -1057,7 +1057,7 @@ PyRun_FileFlags(FILE *fp, char *filename, int start, PyObject *globals,
}
PyObject
*
PyRun_FileExFlags
(
FILE
*
fp
,
char
*
filename
,
int
start
,
PyObject
*
globals
,
PyRun_FileExFlags
(
FILE
*
fp
,
c
onst
c
har
*
filename
,
int
start
,
PyObject
*
globals
,
PyObject
*
locals
,
int
closeit
,
PyCompilerFlags
*
flags
)
{
node
*
n
=
PyParser_SimpleParseFileFlags
(
fp
,
filename
,
start
,
...
...
@@ -1068,7 +1068,7 @@ PyRun_FileExFlags(FILE *fp, char *filename, int start, PyObject *globals,
}
static
PyObject
*
run_err_node
(
node
*
n
,
char
*
filename
,
PyObject
*
globals
,
PyObject
*
locals
,
run_err_node
(
node
*
n
,
c
onst
c
har
*
filename
,
PyObject
*
globals
,
PyObject
*
locals
,
PyCompilerFlags
*
flags
)
{
if
(
n
==
NULL
)
...
...
@@ -1077,7 +1077,7 @@ run_err_node(node *n, char *filename, PyObject *globals, PyObject *locals,
}
static
PyObject
*
run_node
(
node
*
n
,
char
*
filename
,
PyObject
*
globals
,
PyObject
*
locals
,
run_node
(
node
*
n
,
c
onst
c
har
*
filename
,
PyObject
*
globals
,
PyObject
*
locals
,
PyCompilerFlags
*
flags
)
{
PyCodeObject
*
co
;
...
...
@@ -1092,7 +1092,7 @@ run_node(node *n, char *filename, PyObject *globals, PyObject *locals,
}
static
PyObject
*
run_pyc_file
(
FILE
*
fp
,
char
*
filename
,
PyObject
*
globals
,
PyObject
*
locals
,
run_pyc_file
(
FILE
*
fp
,
c
onst
c
har
*
filename
,
PyObject
*
globals
,
PyObject
*
locals
,
PyCompilerFlags
*
flags
)
{
PyCodeObject
*
co
;
...
...
@@ -1124,13 +1124,13 @@ run_pyc_file(FILE *fp, char *filename, PyObject *globals, PyObject *locals,
}
PyObject
*
Py_CompileString
(
c
har
*
str
,
char
*
filename
,
int
start
)
Py_CompileString
(
c
onst
char
*
str
,
const
char
*
filename
,
int
start
)
{
return
Py_CompileStringFlags
(
str
,
filename
,
start
,
NULL
);
}
PyObject
*
Py_CompileStringFlags
(
c
har
*
str
,
char
*
filename
,
int
start
,
Py_CompileStringFlags
(
c
onst
char
*
str
,
const
char
*
filename
,
int
start
,
PyCompilerFlags
*
flags
)
{
node
*
n
;
...
...
@@ -1146,7 +1146,7 @@ Py_CompileStringFlags(char *str, char *filename, int start,
}
struct
symtable
*
Py_SymtableString
(
c
har
*
str
,
char
*
filename
,
int
start
)
Py_SymtableString
(
c
onst
char
*
str
,
const
char
*
filename
,
int
start
)
{
node
*
n
;
struct
symtable
*
st
;
...
...
@@ -1162,7 +1162,7 @@ Py_SymtableString(char *str, char *filename, int start)
/* Simplified interface to parsefile -- return node or set exception */
node
*
PyParser_SimpleParseFileFlags
(
FILE
*
fp
,
char
*
filename
,
int
start
,
int
flags
)
PyParser_SimpleParseFileFlags
(
FILE
*
fp
,
c
onst
c
har
*
filename
,
int
start
,
int
flags
)
{
node
*
n
;
perrdetail
err
;
...
...
@@ -1174,7 +1174,7 @@ PyParser_SimpleParseFileFlags(FILE *fp, char *filename, int start, int flags)
}
node
*
PyParser_SimpleParseFile
(
FILE
*
fp
,
char
*
filename
,
int
start
)
PyParser_SimpleParseFile
(
FILE
*
fp
,
c
onst
c
har
*
filename
,
int
start
)
{
return
PyParser_SimpleParseFileFlags
(
fp
,
filename
,
start
,
0
);
}
...
...
@@ -1182,7 +1182,7 @@ PyParser_SimpleParseFile(FILE *fp, char *filename, int start)
/* Simplified interface to parsestring -- return node or set exception */
node
*
PyParser_SimpleParseStringFlags
(
char
*
str
,
int
start
,
int
flags
)
PyParser_SimpleParseStringFlags
(
c
onst
c
har
*
str
,
int
start
,
int
flags
)
{
node
*
n
;
perrdetail
err
;
...
...
@@ -1194,13 +1194,13 @@ PyParser_SimpleParseStringFlags(char *str, int start, int flags)
}
node
*
PyParser_SimpleParseString
(
char
*
str
,
int
start
)
PyParser_SimpleParseString
(
c
onst
c
har
*
str
,
int
start
)
{
return
PyParser_SimpleParseStringFlags
(
str
,
start
,
0
);
}
node
*
PyParser_SimpleParseStringFlagsFilename
(
c
har
*
str
,
char
*
filename
,
PyParser_SimpleParseStringFlagsFilename
(
c
onst
char
*
str
,
const
char
*
filename
,
int
start
,
int
flags
)
{
node
*
n
;
...
...
@@ -1215,7 +1215,7 @@ PyParser_SimpleParseStringFlagsFilename(char *str, char *filename,
}
node
*
PyParser_SimpleParseStringFilename
(
c
har
*
str
,
char
*
filename
,
int
start
)
PyParser_SimpleParseStringFilename
(
c
onst
char
*
str
,
const
char
*
filename
,
int
start
)
{
return
PyParser_SimpleParseStringFlagsFilename
(
str
,
filename
,
start
,
0
);
...
...
@@ -1429,7 +1429,7 @@ isatty(int fd)
* the descriptor is NULL or "<stdin>" or "???".
*/
int
Py_FdIsInteractive
(
FILE
*
fp
,
char
*
filename
)
Py_FdIsInteractive
(
FILE
*
fp
,
c
onst
c
har
*
filename
)
{
if
(
isatty
((
int
)
fileno
(
fp
)))
return
1
;
...
...
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