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
b70772a4
Commit
b70772a4
authored
Feb 26, 2007
by
Neal Norwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Whoops, fix build breakage. There were still a few uses of the bool type.
Remove the last few uses of bool/true/false.
parent
dfbb3586
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
19 deletions
+11
-19
Include/asdl.h
Include/asdl.h
+0
-4
Python/Python-ast.c
Python/Python-ast.c
+2
-6
Python/ast.c
Python/ast.c
+2
-2
Python/compile.c
Python/compile.c
+7
-7
No files found.
Include/asdl.h
View file @
b70772a4
...
@@ -5,10 +5,6 @@ typedef PyObject * identifier;
...
@@ -5,10 +5,6 @@ typedef PyObject * identifier;
typedef
PyObject
*
string
;
typedef
PyObject
*
string
;
typedef
PyObject
*
object
;
typedef
PyObject
*
object
;
#ifndef __cplusplus
typedef
enum
{
false
,
true
}
bool
;
#endif
/* It would be nice if the code generated by asdl_c.py was completely
/* It would be nice if the code generated by asdl_c.py was completely
independent of Python, but it is a goal the requires too much work
independent of Python, but it is a goal the requires too much work
at this stage. So, for example, I'll represent identifiers as
at this stage. So, for example, I'll represent identifiers as
...
...
Python/Python-ast.c
View file @
b70772a4
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
/*
/*
__version__ 53
873
.
__version__ 53
956
.
This module must be committed separately after each AST grammar change;
This module must be committed separately after each AST grammar change;
The __version__ number is set to the revision number of the commit
The __version__ number is set to the revision number of the commit
...
@@ -443,10 +443,6 @@ static PyObject* ast2obj_object(void *o)
...
@@ -443,10 +443,6 @@ static PyObject* ast2obj_object(void *o)
}
}
#define ast2obj_identifier ast2obj_object
#define ast2obj_identifier ast2obj_object
#define ast2obj_string ast2obj_object
#define ast2obj_string ast2obj_object
static
PyObject
*
ast2obj_bool
(
bool
b
)
{
return
PyBool_FromLong
(
b
);
}
static
PyObject
*
ast2obj_int
(
long
b
)
static
PyObject
*
ast2obj_int
(
long
b
)
{
{
...
@@ -3013,7 +3009,7 @@ init_ast(void)
...
@@ -3013,7 +3009,7 @@ init_ast(void)
if
(
PyDict_SetItemString
(
d
,
"AST"
,
(
PyObject
*
)
AST_type
)
<
0
)
return
;
if
(
PyDict_SetItemString
(
d
,
"AST"
,
(
PyObject
*
)
AST_type
)
<
0
)
return
;
if
(
PyModule_AddIntConstant
(
m
,
"PyCF_ONLY_AST"
,
PyCF_ONLY_AST
)
<
0
)
if
(
PyModule_AddIntConstant
(
m
,
"PyCF_ONLY_AST"
,
PyCF_ONLY_AST
)
<
0
)
return
;
return
;
if
(
PyModule_AddStringConstant
(
m
,
"__version__"
,
"53
873
"
)
<
0
)
if
(
PyModule_AddStringConstant
(
m
,
"__version__"
,
"53
956
"
)
<
0
)
return
;
return
;
if
(
PyDict_SetItemString
(
d
,
"mod"
,
(
PyObject
*
)
mod_type
)
<
0
)
return
;
if
(
PyDict_SetItemString
(
d
,
"mod"
,
(
PyObject
*
)
mod_type
)
<
0
)
return
;
if
(
PyDict_SetItemString
(
d
,
"Module"
,
(
PyObject
*
)
Module_type
)
<
0
)
if
(
PyDict_SetItemString
(
d
,
"Module"
,
(
PyObject
*
)
Module_type
)
<
0
)
...
...
Python/ast.c
View file @
b70772a4
...
@@ -1660,7 +1660,7 @@ ast_for_trailer(struct compiling *c, const node *n, expr_ty left_expr)
...
@@ -1660,7 +1660,7 @@ ast_for_trailer(struct compiling *c, const node *n, expr_ty left_expr)
int
j
;
int
j
;
slice_ty
slc
;
slice_ty
slc
;
expr_ty
e
;
expr_ty
e
;
bool
simple
=
true
;
int
simple
=
1
;
asdl_seq
*
slices
,
*
elts
;
asdl_seq
*
slices
,
*
elts
;
slices
=
asdl_seq_new
((
NCH
(
n
)
+
1
)
/
2
,
c
->
c_arena
);
slices
=
asdl_seq_new
((
NCH
(
n
)
+
1
)
/
2
,
c
->
c_arena
);
if
(
!
slices
)
if
(
!
slices
)
...
@@ -1670,7 +1670,7 @@ ast_for_trailer(struct compiling *c, const node *n, expr_ty left_expr)
...
@@ -1670,7 +1670,7 @@ ast_for_trailer(struct compiling *c, const node *n, expr_ty left_expr)
if
(
!
slc
)
if
(
!
slc
)
return
NULL
;
return
NULL
;
if
(
slc
->
kind
!=
Index_kind
)
if
(
slc
->
kind
!=
Index_kind
)
simple
=
false
;
simple
=
0
;
asdl_seq_SET
(
slices
,
j
/
2
,
slc
);
asdl_seq_SET
(
slices
,
j
/
2
,
slc
);
}
}
if
(
!
simple
)
{
if
(
!
simple
)
{
...
...
Python/compile.c
View file @
b70772a4
...
@@ -119,7 +119,7 @@ struct compiler_unit {
...
@@ -119,7 +119,7 @@ struct compiler_unit {
int
u_firstlineno
;
/* the first lineno of the block */
int
u_firstlineno
;
/* the first lineno of the block */
int
u_lineno
;
/* the lineno for the current stmt */
int
u_lineno
;
/* the lineno for the current stmt */
bool
u_lineno_set
;
/* boolean to indicate whether instr
int
u_lineno_set
;
/* boolean to indicate whether instr
has been generated with current lineno */
has been generated with current lineno */
};
};
...
@@ -464,7 +464,7 @@ compiler_enter_scope(struct compiler *c, identifier name, void *key,
...
@@ -464,7 +464,7 @@ compiler_enter_scope(struct compiler *c, identifier name, void *key,
u
->
u_nfblocks
=
0
;
u
->
u_nfblocks
=
0
;
u
->
u_firstlineno
=
lineno
;
u
->
u_firstlineno
=
lineno
;
u
->
u_lineno
=
0
;
u
->
u_lineno
=
0
;
u
->
u_lineno_set
=
false
;
u
->
u_lineno_set
=
0
;
u
->
u_consts
=
PyDict_New
();
u
->
u_consts
=
PyDict_New
();
if
(
!
u
->
u_consts
)
{
if
(
!
u
->
u_consts
)
{
compiler_unit_free
(
u
);
compiler_unit_free
(
u
);
...
@@ -643,7 +643,7 @@ compiler_set_lineno(struct compiler *c, int off)
...
@@ -643,7 +643,7 @@ compiler_set_lineno(struct compiler *c, int off)
basicblock
*
b
;
basicblock
*
b
;
if
(
c
->
u
->
u_lineno_set
)
if
(
c
->
u
->
u_lineno_set
)
return
;
return
;
c
->
u
->
u_lineno_set
=
true
;
c
->
u
->
u_lineno_set
=
1
;
b
=
c
->
u
->
u_curblock
;
b
=
c
->
u
->
u_curblock
;
b
->
b_instr
[
off
].
i_lineno
=
c
->
u
->
u_lineno
;
b
->
b_instr
[
off
].
i_lineno
=
c
->
u
->
u_lineno
;
}
}
...
@@ -1675,7 +1675,7 @@ compiler_for(struct compiler *c, stmt_ty s)
...
@@ -1675,7 +1675,7 @@ compiler_for(struct compiler *c, stmt_ty s)
/* XXX(nnorwitz): is there a better way to handle this?
/* XXX(nnorwitz): is there a better way to handle this?
for loops are special, we want to be able to trace them
for loops are special, we want to be able to trace them
each time around, so we need to set an extra line number. */
each time around, so we need to set an extra line number. */
c
->
u
->
u_lineno_set
=
false
;
c
->
u
->
u_lineno_set
=
0
;
ADDOP_JREL
(
c
,
FOR_ITER
,
cleanup
);
ADDOP_JREL
(
c
,
FOR_ITER
,
cleanup
);
VISIT
(
c
,
expr
,
s
->
v
.
For
.
target
);
VISIT
(
c
,
expr
,
s
->
v
.
For
.
target
);
VISIT_SEQ
(
c
,
stmt
,
s
->
v
.
For
.
body
);
VISIT_SEQ
(
c
,
stmt
,
s
->
v
.
For
.
body
);
...
@@ -1898,7 +1898,7 @@ compiler_try_except(struct compiler *c, stmt_ty s)
...
@@ -1898,7 +1898,7 @@ compiler_try_except(struct compiler *c, stmt_ty s)
s
->
v
.
TryExcept
.
handlers
,
i
);
s
->
v
.
TryExcept
.
handlers
,
i
);
if
(
!
handler
->
type
&&
i
<
n
-
1
)
if
(
!
handler
->
type
&&
i
<
n
-
1
)
return
compiler_error
(
c
,
"default 'except:' must be last"
);
return
compiler_error
(
c
,
"default 'except:' must be last"
);
c
->
u
->
u_lineno_set
=
false
;
c
->
u
->
u_lineno_set
=
0
;
c
->
u
->
u_lineno
=
handler
->
lineno
;
c
->
u
->
u_lineno
=
handler
->
lineno
;
except
=
compiler_new_block
(
c
);
except
=
compiler_new_block
(
c
);
if
(
except
==
NULL
)
if
(
except
==
NULL
)
...
@@ -2161,7 +2161,7 @@ compiler_visit_stmt(struct compiler *c, stmt_ty s)
...
@@ -2161,7 +2161,7 @@ compiler_visit_stmt(struct compiler *c, stmt_ty s)
/* Always assign a lineno to the next instruction for a stmt. */
/* Always assign a lineno to the next instruction for a stmt. */
c
->
u
->
u_lineno
=
s
->
lineno
;
c
->
u
->
u_lineno
=
s
->
lineno
;
c
->
u
->
u_lineno_set
=
false
;
c
->
u
->
u_lineno_set
=
0
;
switch
(
s
->
kind
)
{
switch
(
s
->
kind
)
{
case
FunctionDef_kind
:
case
FunctionDef_kind
:
...
@@ -3015,7 +3015,7 @@ compiler_visit_expr(struct compiler *c, expr_ty e)
...
@@ -3015,7 +3015,7 @@ compiler_visit_expr(struct compiler *c, expr_ty e)
*/
*/
if
(
e
->
lineno
>
c
->
u
->
u_lineno
)
{
if
(
e
->
lineno
>
c
->
u
->
u_lineno
)
{
c
->
u
->
u_lineno
=
e
->
lineno
;
c
->
u
->
u_lineno
=
e
->
lineno
;
c
->
u
->
u_lineno_set
=
false
;
c
->
u
->
u_lineno_set
=
0
;
}
}
switch
(
e
->
kind
)
{
switch
(
e
->
kind
)
{
case
BoolOp_kind
:
case
BoolOp_kind
:
...
...
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