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
0b03f10a
Commit
0b03f10a
authored
May 05, 2010
by
Brett Cannon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove three unneeded variable assignments.
Found using Clang's static analyzer.
parent
8a478ced
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
89 deletions
+79
-89
Python/ast.c
Python/ast.c
+68
-73
Python/ceval.c
Python/ceval.c
+0
-1
Python/dtoa.c
Python/dtoa.c
+1
-4
Python/getcwd.c
Python/getcwd.c
+2
-3
Python/import.c
Python/import.c
+8
-8
No files found.
Python/ast.c
View file @
0b03f10a
...
@@ -454,8 +454,8 @@ set_context(struct compiling *c, expr_ty e, expr_context_ty ctx, const node *n)
...
@@ -454,8 +454,8 @@ set_context(struct compiling *c, expr_ty e, expr_context_ty ctx, const node *n)
expr_name
=
"conditional expression"
;
expr_name
=
"conditional expression"
;
break
;
break
;
default:
default:
PyErr_Format
(
PyExc_SystemError
,
PyErr_Format
(
PyExc_SystemError
,
"unexpected expression in assignment %d (line %d)"
,
"unexpected expression in assignment %d (line %d)"
,
e
->
kind
,
e
->
lineno
);
e
->
kind
,
e
->
lineno
);
return
0
;
return
0
;
}
}
...
@@ -470,7 +470,7 @@ set_context(struct compiling *c, expr_ty e, expr_context_ty ctx, const node *n)
...
@@ -470,7 +470,7 @@ set_context(struct compiling *c, expr_ty e, expr_context_ty ctx, const node *n)
}
}
/* If the LHS is a list or tuple, we need to set the assignment
/* If the LHS is a list or tuple, we need to set the assignment
context for all the contained elements.
context for all the contained elements.
*/
*/
if
(
s
)
{
if
(
s
)
{
int
i
;
int
i
;
...
@@ -723,7 +723,7 @@ ast_for_arguments(struct compiling *c, const node *n)
...
@@ -723,7 +723,7 @@ ast_for_arguments(struct compiling *c, const node *n)
ast_error
(
n
,
"parenthesized arg with default"
);
ast_error
(
n
,
"parenthesized arg with default"
);
goto
error
;
goto
error
;
}
}
ast_error
(
n
,
ast_error
(
n
,
"non-default argument follows default argument"
);
"non-default argument follows default argument"
);
goto
error
;
goto
error
;
}
}
...
@@ -762,7 +762,7 @@ ast_for_arguments(struct compiling *c, const node *n)
...
@@ -762,7 +762,7 @@ ast_for_arguments(struct compiling *c, const node *n)
if
(
!
name
)
if
(
!
name
)
goto
error
;
goto
error
;
asdl_seq_SET
(
args
,
k
++
,
name
);
asdl_seq_SET
(
args
,
k
++
,
name
);
}
}
i
+=
2
;
/* the name and the comma */
i
+=
2
;
/* the name and the comma */
if
(
parenthesized
&&
Py_Py3kWarningFlag
&&
if
(
parenthesized
&&
Py_Py3kWarningFlag
&&
...
@@ -842,15 +842,15 @@ ast_for_decorator(struct compiling *c, const node *n)
...
@@ -842,15 +842,15 @@ ast_for_decorator(struct compiling *c, const node *n)
/* decorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE */
/* decorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE */
expr_ty
d
=
NULL
;
expr_ty
d
=
NULL
;
expr_ty
name_expr
;
expr_ty
name_expr
;
REQ
(
n
,
decorator
);
REQ
(
n
,
decorator
);
REQ
(
CHILD
(
n
,
0
),
AT
);
REQ
(
CHILD
(
n
,
0
),
AT
);
REQ
(
RCHILD
(
n
,
-
1
),
NEWLINE
);
REQ
(
RCHILD
(
n
,
-
1
),
NEWLINE
);
name_expr
=
ast_for_dotted_name
(
c
,
CHILD
(
n
,
1
));
name_expr
=
ast_for_dotted_name
(
c
,
CHILD
(
n
,
1
));
if
(
!
name_expr
)
if
(
!
name_expr
)
return
NULL
;
return
NULL
;
if
(
NCH
(
n
)
==
3
)
{
/* No arguments */
if
(
NCH
(
n
)
==
3
)
{
/* No arguments */
d
=
name_expr
;
d
=
name_expr
;
name_expr
=
NULL
;
name_expr
=
NULL
;
...
@@ -878,12 +878,12 @@ ast_for_decorators(struct compiling *c, const node *n)
...
@@ -878,12 +878,12 @@ ast_for_decorators(struct compiling *c, const node *n)
asdl_seq
*
decorator_seq
;
asdl_seq
*
decorator_seq
;
expr_ty
d
;
expr_ty
d
;
int
i
;
int
i
;
REQ
(
n
,
decorators
);
REQ
(
n
,
decorators
);
decorator_seq
=
asdl_seq_new
(
NCH
(
n
),
c
->
c_arena
);
decorator_seq
=
asdl_seq_new
(
NCH
(
n
),
c
->
c_arena
);
if
(
!
decorator_seq
)
if
(
!
decorator_seq
)
return
NULL
;
return
NULL
;
for
(
i
=
0
;
i
<
NCH
(
n
);
i
++
)
{
for
(
i
=
0
;
i
<
NCH
(
n
);
i
++
)
{
d
=
ast_for_decorator
(
c
,
CHILD
(
n
,
i
));
d
=
ast_for_decorator
(
c
,
CHILD
(
n
,
i
));
if
(
!
d
)
if
(
!
d
)
...
@@ -980,7 +980,7 @@ ast_for_lambdef(struct compiling *c, const node *n)
...
@@ -980,7 +980,7 @@ ast_for_lambdef(struct compiling *c, const node *n)
static
expr_ty
static
expr_ty
ast_for_ifexpr
(
struct
compiling
*
c
,
const
node
*
n
)
ast_for_ifexpr
(
struct
compiling
*
c
,
const
node
*
n
)
{
{
/* test: or_test 'if' or_test 'else' test */
/* test: or_test 'if' or_test 'else' test */
expr_ty
expression
,
body
,
orelse
;
expr_ty
expression
,
body
,
orelse
;
assert
(
NCH
(
n
)
==
5
);
assert
(
NCH
(
n
)
==
5
);
...
@@ -1097,9 +1097,9 @@ ast_for_listcomp(struct compiling *c, const node *n)
...
@@ -1097,9 +1097,9 @@ ast_for_listcomp(struct compiling *c, const node *n)
asdl_seq
*
t
;
asdl_seq
*
t
;
expr_ty
expression
;
expr_ty
expression
;
node
*
for_ch
;
node
*
for_ch
;
REQ
(
ch
,
list_for
);
REQ
(
ch
,
list_for
);
for_ch
=
CHILD
(
ch
,
1
);
for_ch
=
CHILD
(
ch
,
1
);
t
=
ast_for_exprlist
(
c
,
for_ch
,
Store
);
t
=
ast_for_exprlist
(
c
,
for_ch
,
Store
);
if
(
!
t
)
if
(
!
t
)
...
@@ -1107,7 +1107,7 @@ ast_for_listcomp(struct compiling *c, const node *n)
...
@@ -1107,7 +1107,7 @@ ast_for_listcomp(struct compiling *c, const node *n)
expression
=
ast_for_testlist
(
c
,
CHILD
(
ch
,
3
));
expression
=
ast_for_testlist
(
c
,
CHILD
(
ch
,
3
));
if
(
!
expression
)
if
(
!
expression
)
return
NULL
;
return
NULL
;
/* Check the # of children rather than the length of t, since
/* Check the # of children rather than the length of t, since
[x for x, in ... ] has 1 element in t, but still requires a Tuple.
[x for x, in ... ] has 1 element in t, but still requires a Tuple.
*/
*/
...
@@ -1139,11 +1139,11 @@ ast_for_listcomp(struct compiling *c, const node *n)
...
@@ -1139,11 +1139,11 @@ ast_for_listcomp(struct compiling *c, const node *n)
REQ
(
ch
,
list_iter
);
REQ
(
ch
,
list_iter
);
ch
=
CHILD
(
ch
,
0
);
ch
=
CHILD
(
ch
,
0
);
REQ
(
ch
,
list_if
);
REQ
(
ch
,
list_if
);
list_for_expr
=
ast_for_expr
(
c
,
CHILD
(
ch
,
1
));
list_for_expr
=
ast_for_expr
(
c
,
CHILD
(
ch
,
1
));
if
(
!
list_for_expr
)
if
(
!
list_for_expr
)
return
NULL
;
return
NULL
;
asdl_seq_SET
(
ifs
,
j
,
list_for_expr
);
asdl_seq_SET
(
ifs
,
j
,
list_for_expr
);
if
(
NCH
(
ch
)
==
3
)
if
(
NCH
(
ch
)
==
3
)
ch
=
CHILD
(
ch
,
2
);
ch
=
CHILD
(
ch
,
2
);
...
@@ -1239,9 +1239,9 @@ ast_for_comprehension(struct compiling *c, const node *n)
...
@@ -1239,9 +1239,9 @@ ast_for_comprehension(struct compiling *c, const node *n)
asdl_seq
*
t
;
asdl_seq
*
t
;
expr_ty
expression
,
first
;
expr_ty
expression
,
first
;
node
*
for_ch
;
node
*
for_ch
;
REQ
(
n
,
comp_for
);
REQ
(
n
,
comp_for
);
for_ch
=
CHILD
(
n
,
1
);
for_ch
=
CHILD
(
n
,
1
);
t
=
ast_for_exprlist
(
c
,
for_ch
,
Store
);
t
=
ast_for_exprlist
(
c
,
for_ch
,
Store
);
if
(
!
t
)
if
(
!
t
)
...
@@ -1265,7 +1265,7 @@ ast_for_comprehension(struct compiling *c, const node *n)
...
@@ -1265,7 +1265,7 @@ ast_for_comprehension(struct compiling *c, const node *n)
if
(
NCH
(
n
)
==
5
)
{
if
(
NCH
(
n
)
==
5
)
{
int
j
,
n_ifs
;
int
j
,
n_ifs
;
asdl_seq
*
ifs
;
asdl_seq
*
ifs
;
n
=
CHILD
(
n
,
4
);
n
=
CHILD
(
n
,
4
);
n_ifs
=
count_comp_ifs
(
c
,
n
);
n_ifs
=
count_comp_ifs
(
c
,
n
);
if
(
n_ifs
==
-
1
)
if
(
n_ifs
==
-
1
)
...
@@ -1279,7 +1279,7 @@ ast_for_comprehension(struct compiling *c, const node *n)
...
@@ -1279,7 +1279,7 @@ ast_for_comprehension(struct compiling *c, const node *n)
REQ
(
n
,
comp_iter
);
REQ
(
n
,
comp_iter
);
n
=
CHILD
(
n
,
0
);
n
=
CHILD
(
n
,
0
);
REQ
(
n
,
comp_if
);
REQ
(
n
,
comp_if
);
expression
=
ast_for_expr
(
c
,
CHILD
(
n
,
1
));
expression
=
ast_for_expr
(
c
,
CHILD
(
n
,
1
));
if
(
!
expression
)
if
(
!
expression
)
return
NULL
;
return
NULL
;
...
@@ -1302,13 +1302,13 @@ ast_for_itercomp(struct compiling *c, const node *n, int type)
...
@@ -1302,13 +1302,13 @@ ast_for_itercomp(struct compiling *c, const node *n, int type)
{
{
expr_ty
elt
;
expr_ty
elt
;
asdl_seq
*
comps
;
asdl_seq
*
comps
;
assert
(
NCH
(
n
)
>
1
);
assert
(
NCH
(
n
)
>
1
);
elt
=
ast_for_expr
(
c
,
CHILD
(
n
,
0
));
elt
=
ast_for_expr
(
c
,
CHILD
(
n
,
0
));
if
(
!
elt
)
if
(
!
elt
)
return
NULL
;
return
NULL
;
comps
=
ast_for_comprehension
(
c
,
CHILD
(
n
,
1
));
comps
=
ast_for_comprehension
(
c
,
CHILD
(
n
,
1
));
if
(
!
comps
)
if
(
!
comps
)
return
NULL
;
return
NULL
;
...
@@ -1327,10 +1327,10 @@ ast_for_dictcomp(struct compiling *c, const node *n)
...
@@ -1327,10 +1327,10 @@ ast_for_dictcomp(struct compiling *c, const node *n)
{
{
expr_ty
key
,
value
;
expr_ty
key
,
value
;
asdl_seq
*
comps
;
asdl_seq
*
comps
;
assert
(
NCH
(
n
)
>
3
);
assert
(
NCH
(
n
)
>
3
);
REQ
(
CHILD
(
n
,
1
),
COLON
);
REQ
(
CHILD
(
n
,
1
),
COLON
);
key
=
ast_for_expr
(
c
,
CHILD
(
n
,
0
));
key
=
ast_for_expr
(
c
,
CHILD
(
n
,
0
));
if
(
!
key
)
if
(
!
key
)
return
NULL
;
return
NULL
;
...
@@ -1338,11 +1338,11 @@ ast_for_dictcomp(struct compiling *c, const node *n)
...
@@ -1338,11 +1338,11 @@ ast_for_dictcomp(struct compiling *c, const node *n)
value
=
ast_for_expr
(
c
,
CHILD
(
n
,
2
));
value
=
ast_for_expr
(
c
,
CHILD
(
n
,
2
));
if
(
!
value
)
if
(
!
value
)
return
NULL
;
return
NULL
;
comps
=
ast_for_comprehension
(
c
,
CHILD
(
n
,
3
));
comps
=
ast_for_comprehension
(
c
,
CHILD
(
n
,
3
));
if
(
!
comps
)
if
(
!
comps
)
return
NULL
;
return
NULL
;
return
DictComp
(
key
,
value
,
comps
,
LINENO
(
n
),
n
->
n_col_offset
,
c
->
c_arena
);
return
DictComp
(
key
,
value
,
comps
,
LINENO
(
n
),
n
->
n_col_offset
,
c
->
c_arena
);
}
}
...
@@ -1367,7 +1367,7 @@ ast_for_atom(struct compiling *c, const node *n)
...
@@ -1367,7 +1367,7 @@ ast_for_atom(struct compiling *c, const node *n)
| '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING+
| '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING+
*/
*/
node
*
ch
=
CHILD
(
n
,
0
);
node
*
ch
=
CHILD
(
n
,
0
);
switch
(
TYPE
(
ch
))
{
switch
(
TYPE
(
ch
))
{
case
NAME
:
{
case
NAME
:
{
/* All names start in Load context, but may later be
/* All names start in Load context, but may later be
...
@@ -1415,20 +1415,20 @@ ast_for_atom(struct compiling *c, const node *n)
...
@@ -1415,20 +1415,20 @@ ast_for_atom(struct compiling *c, const node *n)
}
}
case
LPAR
:
/* some parenthesized expressions */
case
LPAR
:
/* some parenthesized expressions */
ch
=
CHILD
(
n
,
1
);
ch
=
CHILD
(
n
,
1
);
if
(
TYPE
(
ch
)
==
RPAR
)
if
(
TYPE
(
ch
)
==
RPAR
)
return
Tuple
(
NULL
,
Load
,
LINENO
(
n
),
n
->
n_col_offset
,
c
->
c_arena
);
return
Tuple
(
NULL
,
Load
,
LINENO
(
n
),
n
->
n_col_offset
,
c
->
c_arena
);
if
(
TYPE
(
ch
)
==
yield_expr
)
if
(
TYPE
(
ch
)
==
yield_expr
)
return
ast_for_expr
(
c
,
ch
);
return
ast_for_expr
(
c
,
ch
);
return
ast_for_testlist_comp
(
c
,
ch
);
return
ast_for_testlist_comp
(
c
,
ch
);
case
LSQB
:
/* list (or list comprehension) */
case
LSQB
:
/* list (or list comprehension) */
ch
=
CHILD
(
n
,
1
);
ch
=
CHILD
(
n
,
1
);
if
(
TYPE
(
ch
)
==
RSQB
)
if
(
TYPE
(
ch
)
==
RSQB
)
return
List
(
NULL
,
Load
,
LINENO
(
n
),
n
->
n_col_offset
,
c
->
c_arena
);
return
List
(
NULL
,
Load
,
LINENO
(
n
),
n
->
n_col_offset
,
c
->
c_arena
);
REQ
(
ch
,
listmaker
);
REQ
(
ch
,
listmaker
);
if
(
NCH
(
ch
)
==
1
||
TYPE
(
CHILD
(
ch
,
1
))
==
COMMA
)
{
if
(
NCH
(
ch
)
==
1
||
TYPE
(
CHILD
(
ch
,
1
))
==
COMMA
)
{
asdl_seq
*
elts
=
seq_for_testlist
(
c
,
ch
);
asdl_seq
*
elts
=
seq_for_testlist
(
c
,
ch
);
...
@@ -1477,14 +1477,14 @@ ast_for_atom(struct compiling *c, const node *n)
...
@@ -1477,14 +1477,14 @@ ast_for_atom(struct compiling *c, const node *n)
keys
=
asdl_seq_new
(
size
,
c
->
c_arena
);
keys
=
asdl_seq_new
(
size
,
c
->
c_arena
);
if
(
!
keys
)
if
(
!
keys
)
return
NULL
;
return
NULL
;
values
=
asdl_seq_new
(
size
,
c
->
c_arena
);
values
=
asdl_seq_new
(
size
,
c
->
c_arena
);
if
(
!
values
)
if
(
!
values
)
return
NULL
;
return
NULL
;
for
(
i
=
0
;
i
<
NCH
(
ch
);
i
+=
4
)
{
for
(
i
=
0
;
i
<
NCH
(
ch
);
i
+=
4
)
{
expr_ty
expression
;
expr_ty
expression
;
expression
=
ast_for_expr
(
c
,
CHILD
(
ch
,
i
));
expression
=
ast_for_expr
(
c
,
CHILD
(
ch
,
i
));
if
(
!
expression
)
if
(
!
expression
)
return
NULL
;
return
NULL
;
...
@@ -1536,10 +1536,10 @@ ast_for_slice(struct compiling *c, const node *n)
...
@@ -1536,10 +1536,10 @@ ast_for_slice(struct compiling *c, const node *n)
if
(
NCH
(
n
)
==
1
&&
TYPE
(
ch
)
==
test
)
{
if
(
NCH
(
n
)
==
1
&&
TYPE
(
ch
)
==
test
)
{
/* 'step' variable hold no significance in terms of being used over
/* 'step' variable hold no significance in terms of being used over
other vars */
other vars */
step
=
ast_for_expr
(
c
,
ch
);
step
=
ast_for_expr
(
c
,
ch
);
if
(
!
step
)
if
(
!
step
)
return
NULL
;
return
NULL
;
return
Index
(
step
,
c
->
c_arena
);
return
Index
(
step
,
c
->
c_arena
);
}
}
...
@@ -1573,7 +1573,7 @@ ast_for_slice(struct compiling *c, const node *n)
...
@@ -1573,7 +1573,7 @@ ast_for_slice(struct compiling *c, const node *n)
ch
=
CHILD
(
n
,
NCH
(
n
)
-
1
);
ch
=
CHILD
(
n
,
NCH
(
n
)
-
1
);
if
(
TYPE
(
ch
)
==
sliceop
)
{
if
(
TYPE
(
ch
)
==
sliceop
)
{
if
(
NCH
(
ch
)
==
1
)
{
if
(
NCH
(
ch
)
==
1
)
{
/*
/*
This is an extended slice (ie "x[::]") with no expression in the
This is an extended slice (ie "x[::]") with no expression in the
step field. We set this literally to "None" in order to
step field. We set this literally to "None" in order to
disambiguate it from x[:]. (The interpreter might have to call
disambiguate it from x[:]. (The interpreter might have to call
...
@@ -1603,7 +1603,7 @@ static expr_ty
...
@@ -1603,7 +1603,7 @@ static expr_ty
ast_for_binop
(
struct
compiling
*
c
,
const
node
*
n
)
ast_for_binop
(
struct
compiling
*
c
,
const
node
*
n
)
{
{
/* Must account for a sequence of expressions.
/* Must account for a sequence of expressions.
How should A op B op C by represented?
How should A op B op C by represented?
BinOp(BinOp(A, op, B), op, C).
BinOp(BinOp(A, op, B), op, C).
*/
*/
...
@@ -1641,10 +1641,10 @@ ast_for_binop(struct compiling *c, const node *n)
...
@@ -1641,10 +1641,10 @@ ast_for_binop(struct compiling *c, const node *n)
if
(
!
tmp
)
if
(
!
tmp
)
return
NULL
;
return
NULL
;
tmp_result
=
BinOp
(
result
,
newoperator
,
tmp
,
tmp_result
=
BinOp
(
result
,
newoperator
,
tmp
,
LINENO
(
next_oper
),
next_oper
->
n_col_offset
,
LINENO
(
next_oper
),
next_oper
->
n_col_offset
,
c
->
c_arena
);
c
->
c_arena
);
if
(
!
tmp_result
)
if
(
!
tmp_result
)
return
NULL
;
return
NULL
;
result
=
tmp_result
;
result
=
tmp_result
;
}
}
...
@@ -1654,7 +1654,7 @@ ast_for_binop(struct compiling *c, const node *n)
...
@@ -1654,7 +1654,7 @@ ast_for_binop(struct compiling *c, const node *n)
static
expr_ty
static
expr_ty
ast_for_trailer
(
struct
compiling
*
c
,
const
node
*
n
,
expr_ty
left_expr
)
ast_for_trailer
(
struct
compiling
*
c
,
const
node
*
n
,
expr_ty
left_expr
)
{
{
/* trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME
/* trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME
subscriptlist: subscript (',' subscript)* [',']
subscriptlist: subscript (',' subscript)* [',']
subscript: '.' '.' '.' | test | [test] ':' [test] [sliceop]
subscript: '.' '.' '.' | test | [test] ':' [test] [sliceop]
*/
*/
...
@@ -1685,7 +1685,7 @@ ast_for_trailer(struct compiling *c, const node *n, expr_ty left_expr)
...
@@ -1685,7 +1685,7 @@ ast_for_trailer(struct compiling *c, const node *n, expr_ty left_expr)
c
->
c_arena
);
c
->
c_arena
);
}
}
else
{
else
{
/* The grammar is ambiguous here. The ambiguity is resolved
/* The grammar is ambiguous here. The ambiguity is resolved
by treating the sequence as a tuple literal if there are
by treating the sequence as a tuple literal if there are
no slice features.
no slice features.
*/
*/
...
@@ -1822,7 +1822,7 @@ ast_for_expr(struct compiling *c, const node *n)
...
@@ -1822,7 +1822,7 @@ ast_for_expr(struct compiling *c, const node *n)
{
{
/* handle the full range of simple expressions
/* handle the full range of simple expressions
test: or_test ['if' or_test 'else' test] | lambdef
test: or_test ['if' or_test 'else' test] | lambdef
or_test: and_test ('or' and_test)*
or_test: and_test ('or' and_test)*
and_test: not_test ('and' not_test)*
and_test: not_test ('and' not_test)*
not_test: 'not' not_test | comparison
not_test: 'not' not_test | comparison
comparison: expr (comp_op expr)*
comparison: expr (comp_op expr)*
...
@@ -1839,7 +1839,7 @@ ast_for_expr(struct compiling *c, const node *n)
...
@@ -1839,7 +1839,7 @@ ast_for_expr(struct compiling *c, const node *n)
to explicitly allow:
to explicitly allow:
[ x for x in lambda: 0, lambda: 1 ]
[ x for x in lambda: 0, lambda: 1 ]
(which would be ambiguous without these extra rules)
(which would be ambiguous without these extra rules)
old_test: or_test | old_lambdef
old_test: or_test | old_lambdef
old_lambdef: 'lambda' [vararglist] ':' old_test
old_lambdef: 'lambda' [vararglist] ':' old_test
...
@@ -1919,7 +1919,7 @@ ast_for_expr(struct compiling *c, const node *n)
...
@@ -1919,7 +1919,7 @@ ast_for_expr(struct compiling *c, const node *n)
if
(
!
expression
)
{
if
(
!
expression
)
{
return
NULL
;
return
NULL
;
}
}
asdl_seq_SET
(
ops
,
i
/
2
,
newoperator
);
asdl_seq_SET
(
ops
,
i
/
2
,
newoperator
);
asdl_seq_SET
(
cmps
,
i
/
2
,
expression
);
asdl_seq_SET
(
cmps
,
i
/
2
,
expression
);
}
}
...
@@ -1927,7 +1927,7 @@ ast_for_expr(struct compiling *c, const node *n)
...
@@ -1927,7 +1927,7 @@ ast_for_expr(struct compiling *c, const node *n)
if
(
!
expression
)
{
if
(
!
expression
)
{
return
NULL
;
return
NULL
;
}
}
return
Compare
(
expression
,
ops
,
cmps
,
LINENO
(
n
),
return
Compare
(
expression
,
ops
,
cmps
,
LINENO
(
n
),
n
->
n_col_offset
,
c
->
c_arena
);
n
->
n_col_offset
,
c
->
c_arena
);
}
}
...
@@ -2041,7 +2041,7 @@ ast_for_call(struct compiling *c, const node *n, expr_ty func)
...
@@ -2041,7 +2041,7 @@ ast_for_call(struct compiling *c, const node *n, expr_ty func)
if
(
!
e
)
if
(
!
e
)
return
NULL
;
return
NULL
;
asdl_seq_SET
(
args
,
nargs
++
,
e
);
asdl_seq_SET
(
args
,
nargs
++
,
e
);
}
}
else
if
(
TYPE
(
CHILD
(
ch
,
1
))
==
comp_for
)
{
else
if
(
TYPE
(
CHILD
(
ch
,
1
))
==
comp_for
)
{
e
=
ast_for_genexp
(
c
,
ch
);
e
=
ast_for_genexp
(
c
,
ch
);
if
(
!
e
)
if
(
!
e
)
...
@@ -2054,7 +2054,7 @@ ast_for_call(struct compiling *c, const node *n, expr_ty func)
...
@@ -2054,7 +2054,7 @@ ast_for_call(struct compiling *c, const node *n, expr_ty func)
int
k
;
int
k
;
char
*
tmp
;
char
*
tmp
;
/* CHILD(ch, 0) is test, but must be an identifier? */
/* CHILD(ch, 0) is test, but must be an identifier? */
e
=
ast_for_expr
(
c
,
CHILD
(
ch
,
0
));
e
=
ast_for_expr
(
c
,
CHILD
(
ch
,
0
));
if
(
!
e
)
if
(
!
e
)
return
NULL
;
return
NULL
;
...
@@ -2173,7 +2173,7 @@ static stmt_ty
...
@@ -2173,7 +2173,7 @@ static stmt_ty
ast_for_expr_stmt
(
struct
compiling
*
c
,
const
node
*
n
)
ast_for_expr_stmt
(
struct
compiling
*
c
,
const
node
*
n
)
{
{
REQ
(
n
,
expr_stmt
);
REQ
(
n
,
expr_stmt
);
/* expr_stmt: testlist (augassign (yield_expr|testlist)
/* expr_stmt: testlist (augassign (yield_expr|testlist)
| ('=' (yield_expr|testlist))*)
| ('=' (yield_expr|testlist))*)
testlist: test (',' test)* [',']
testlist: test (',' test)* [',']
augassign: '+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^='
augassign: '+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^='
...
@@ -2248,7 +2248,7 @@ ast_for_expr_stmt(struct compiling *c, const node *n)
...
@@ -2248,7 +2248,7 @@ ast_for_expr_stmt(struct compiling *c, const node *n)
e
=
ast_for_testlist
(
c
,
ch
);
e
=
ast_for_testlist
(
c
,
ch
);
/* set context to assign */
/* set context to assign */
if
(
!
e
)
if
(
!
e
)
return
NULL
;
return
NULL
;
if
(
!
set_context
(
c
,
e
,
Store
,
CHILD
(
n
,
i
)))
if
(
!
set_context
(
c
,
e
,
Store
,
CHILD
(
n
,
i
)))
...
@@ -2329,7 +2329,7 @@ static stmt_ty
...
@@ -2329,7 +2329,7 @@ static stmt_ty
ast_for_del_stmt
(
struct
compiling
*
c
,
const
node
*
n
)
ast_for_del_stmt
(
struct
compiling
*
c
,
const
node
*
n
)
{
{
asdl_seq
*
expr_list
;
asdl_seq
*
expr_list
;
/* del_stmt: 'del' exprlist */
/* del_stmt: 'del' exprlist */
REQ
(
n
,
del_stmt
);
REQ
(
n
,
del_stmt
);
...
@@ -2413,7 +2413,7 @@ ast_for_flow_stmt(struct compiling *c, const node *n)
...
@@ -2413,7 +2413,7 @@ ast_for_flow_stmt(struct compiling *c, const node *n)
expr3
=
ast_for_expr
(
c
,
CHILD
(
ch
,
5
));
expr3
=
ast_for_expr
(
c
,
CHILD
(
ch
,
5
));
if
(
!
expr3
)
if
(
!
expr3
)
return
NULL
;
return
NULL
;
return
Raise
(
expr1
,
expr2
,
expr3
,
LINENO
(
n
),
n
->
n_col_offset
,
return
Raise
(
expr1
,
expr2
,
expr3
,
LINENO
(
n
),
n
->
n_col_offset
,
c
->
c_arena
);
c
->
c_arena
);
}
}
...
@@ -2569,7 +2569,7 @@ ast_for_import_stmt(struct compiling *c, const node *n)
...
@@ -2569,7 +2569,7 @@ ast_for_import_stmt(struct compiling *c, const node *n)
int
idx
,
ndots
=
0
;
int
idx
,
ndots
=
0
;
alias_ty
mod
=
NULL
;
alias_ty
mod
=
NULL
;
identifier
modname
=
NULL
;
identifier
modname
=
NULL
;
/* Count the number of dots (for relative imports) and check for the
/* Count the number of dots (for relative imports) and check for the
optional module name */
optional module name */
for
(
idx
=
1
;
idx
<
NCH
(
n
);
idx
++
)
{
for
(
idx
=
1
;
idx
<
NCH
(
n
);
idx
++
)
{
...
@@ -2715,7 +2715,7 @@ ast_for_assert_stmt(struct compiling *c, const node *n)
...
@@ -2715,7 +2715,7 @@ ast_for_assert_stmt(struct compiling *c, const node *n)
expr2
=
ast_for_expr
(
c
,
CHILD
(
n
,
3
));
expr2
=
ast_for_expr
(
c
,
CHILD
(
n
,
3
));
if
(
!
expr2
)
if
(
!
expr2
)
return
NULL
;
return
NULL
;
return
Assert
(
expr1
,
expr2
,
LINENO
(
n
),
n
->
n_col_offset
,
c
->
c_arena
);
return
Assert
(
expr1
,
expr2
,
LINENO
(
n
),
n
->
n_col_offset
,
c
->
c_arena
);
}
}
PyErr_Format
(
PyExc_SystemError
,
PyErr_Format
(
PyExc_SystemError
,
...
@@ -2742,7 +2742,7 @@ ast_for_suite(struct compiling *c, const node *n)
...
@@ -2742,7 +2742,7 @@ ast_for_suite(struct compiling *c, const node *n)
if
(
TYPE
(
CHILD
(
n
,
0
))
==
simple_stmt
)
{
if
(
TYPE
(
CHILD
(
n
,
0
))
==
simple_stmt
)
{
n
=
CHILD
(
n
,
0
);
n
=
CHILD
(
n
,
0
);
/* simple_stmt always ends with a NEWLINE,
/* simple_stmt always ends with a NEWLINE,
and may have a trailing SEMI
and may have a trailing SEMI
*/
*/
end
=
NCH
(
n
)
-
1
;
end
=
NCH
(
n
)
-
1
;
if
(
TYPE
(
CHILD
(
n
,
end
-
1
))
==
SEMI
)
if
(
TYPE
(
CHILD
(
n
,
end
-
1
))
==
SEMI
)
...
@@ -2807,10 +2807,10 @@ ast_for_if_stmt(struct compiling *c, const node *n)
...
@@ -2807,10 +2807,10 @@ ast_for_if_stmt(struct compiling *c, const node *n)
expression
=
ast_for_expr
(
c
,
CHILD
(
n
,
1
));
expression
=
ast_for_expr
(
c
,
CHILD
(
n
,
1
));
if
(
!
expression
)
if
(
!
expression
)
return
NULL
;
return
NULL
;
suite_seq
=
ast_for_suite
(
c
,
CHILD
(
n
,
3
));
suite_seq
=
ast_for_suite
(
c
,
CHILD
(
n
,
3
));
if
(
!
suite_seq
)
if
(
!
suite_seq
)
return
NULL
;
return
NULL
;
return
If
(
expression
,
suite_seq
,
NULL
,
LINENO
(
n
),
n
->
n_col_offset
,
return
If
(
expression
,
suite_seq
,
NULL
,
LINENO
(
n
),
n
->
n_col_offset
,
c
->
c_arena
);
c
->
c_arena
);
}
}
...
@@ -2868,8 +2868,8 @@ ast_for_if_stmt(struct compiling *c, const node *n)
...
@@ -2868,8 +2868,8 @@ ast_for_if_stmt(struct compiling *c, const node *n)
if
(
!
suite_seq2
)
if
(
!
suite_seq2
)
return
NULL
;
return
NULL
;
asdl_seq_SET
(
orelse
,
0
,
asdl_seq_SET
(
orelse
,
0
,
If
(
expression
,
suite_seq
,
suite_seq2
,
If
(
expression
,
suite_seq
,
suite_seq2
,
LINENO
(
CHILD
(
n
,
NCH
(
n
)
-
6
)),
LINENO
(
CHILD
(
n
,
NCH
(
n
)
-
6
)),
CHILD
(
n
,
NCH
(
n
)
-
6
)
->
n_col_offset
,
CHILD
(
n
,
NCH
(
n
)
-
6
)
->
n_col_offset
,
c
->
c_arena
));
c
->
c_arena
));
...
@@ -2890,7 +2890,7 @@ ast_for_if_stmt(struct compiling *c, const node *n)
...
@@ -2890,7 +2890,7 @@ ast_for_if_stmt(struct compiling *c, const node *n)
return
NULL
;
return
NULL
;
asdl_seq_SET
(
newobj
,
0
,
asdl_seq_SET
(
newobj
,
0
,
If
(
expression
,
suite_seq
,
orelse
,
If
(
expression
,
suite_seq
,
orelse
,
LINENO
(
CHILD
(
n
,
off
)),
LINENO
(
CHILD
(
n
,
off
)),
CHILD
(
n
,
off
)
->
n_col_offset
,
c
->
c_arena
));
CHILD
(
n
,
off
)
->
n_col_offset
,
c
->
c_arena
));
orelse
=
newobj
;
orelse
=
newobj
;
...
@@ -3089,7 +3089,7 @@ ast_for_try_stmt(struct compiling *c, const node *n)
...
@@ -3089,7 +3089,7 @@ ast_for_try_stmt(struct compiling *c, const node *n)
ast_error
(
n
,
"malformed 'try' statement"
);
ast_error
(
n
,
"malformed 'try' statement"
);
return
NULL
;
return
NULL
;
}
}
if
(
n_except
>
0
)
{
if
(
n_except
>
0
)
{
int
i
;
int
i
;
stmt_ty
except_st
;
stmt_ty
except_st
;
...
@@ -3190,7 +3190,7 @@ ast_for_classdef(struct compiling *c, const node *n, asdl_seq *decorator_seq)
...
@@ -3190,7 +3190,7 @@ ast_for_classdef(struct compiling *c, const node *n, asdl_seq *decorator_seq)
/* classdef: 'class' NAME ['(' testlist ')'] ':' suite */
/* classdef: 'class' NAME ['(' testlist ')'] ':' suite */
PyObject
*
classname
;
PyObject
*
classname
;
asdl_seq
*
bases
,
*
s
;
asdl_seq
*
bases
,
*
s
;
REQ
(
n
,
classdef
);
REQ
(
n
,
classdef
);
if
(
!
forbidden_check
(
c
,
n
,
STR
(
CHILD
(
n
,
1
))))
if
(
!
forbidden_check
(
c
,
n
,
STR
(
CHILD
(
n
,
1
))))
...
@@ -3378,17 +3378,12 @@ decode_utf8(struct compiling *c, const char **sPtr, const char *end, char* encod
...
@@ -3378,17 +3378,12 @@ decode_utf8(struct compiling *c, const char **sPtr, const char *end, char* encod
static
PyObject
*
static
PyObject
*
decode_unicode
(
struct
compiling
*
c
,
const
char
*
s
,
size_t
len
,
int
rawmode
,
const
char
*
encoding
)
decode_unicode
(
struct
compiling
*
c
,
const
char
*
s
,
size_t
len
,
int
rawmode
,
const
char
*
encoding
)
{
{
PyObject
*
v
,
*
u
;
PyObject
*
v
;
PyObject
*
u
=
NULL
;
char
*
buf
;
char
*
buf
;
char
*
p
;
char
*
p
;
const
char
*
end
;
const
char
*
end
;
if
(
encoding
==
NULL
)
{
if
(
encoding
!=
NULL
&&
strcmp
(
encoding
,
"iso-8859-1"
))
{
buf
=
(
char
*
)
s
;
u
=
NULL
;
}
else
if
(
strcmp
(
encoding
,
"iso-8859-1"
)
==
0
)
{
buf
=
(
char
*
)
s
;
u
=
NULL
;
}
else
{
/* check for integer overflow */
/* check for integer overflow */
if
(
len
>
PY_SIZE_MAX
/
6
)
if
(
len
>
PY_SIZE_MAX
/
6
)
return
NULL
;
return
NULL
;
...
@@ -3478,7 +3473,7 @@ parsestr(struct compiling *c, const char *s)
...
@@ -3478,7 +3473,7 @@ parsestr(struct compiling *c, const char *s)
s
++
;
s
++
;
len
=
strlen
(
s
);
len
=
strlen
(
s
);
if
(
len
>
INT_MAX
)
{
if
(
len
>
INT_MAX
)
{
PyErr_SetString
(
PyExc_OverflowError
,
PyErr_SetString
(
PyExc_OverflowError
,
"string to parse is too long"
);
"string to parse is too long"
);
return
NULL
;
return
NULL
;
}
}
...
...
Python/ceval.c
View file @
0b03f10a
...
@@ -2697,7 +2697,6 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
...
@@ -2697,7 +2697,6 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
Py_DECREF
(
*
pfunc
);
Py_DECREF
(
*
pfunc
);
*
pfunc
=
self
;
*
pfunc
=
self
;
na
++
;
na
++
;
n
++
;
}
else
}
else
Py_INCREF
(
func
);
Py_INCREF
(
func
);
sp
=
stack_pointer
;
sp
=
stack_pointer
;
...
...
Python/dtoa.c
View file @
0b03f10a
...
@@ -1382,7 +1382,6 @@ bigcomp(U *rv, const char *s0, BCinfo *bc)
...
@@ -1382,7 +1382,6 @@ bigcomp(U *rv, const char *s0, BCinfo *bc)
Bigint
*
b
,
*
d
;
Bigint
*
b
,
*
d
;
int
b2
,
d2
,
dd
,
i
,
nd
,
nd0
,
odd
,
p2
,
p5
;
int
b2
,
d2
,
dd
,
i
,
nd
,
nd0
,
odd
,
p2
,
p5
;
dd
=
0
;
/* silence compiler warning about possibly unused variable */
nd
=
bc
->
nd
;
nd
=
bc
->
nd
;
nd0
=
bc
->
nd0
;
nd0
=
bc
->
nd0
;
p5
=
nd
+
bc
->
e0
;
p5
=
nd
+
bc
->
e0
;
...
@@ -2362,7 +2361,7 @@ _Py_dg_dtoa(double dd, int mode, int ndigits,
...
@@ -2362,7 +2361,7 @@ _Py_dg_dtoa(double dd, int mode, int ndigits,
/* set pointers to NULL, to silence gcc compiler warnings and make
/* set pointers to NULL, to silence gcc compiler warnings and make
cleanup easier on error */
cleanup easier on error */
mlo
=
mhi
=
b
=
S
=
0
;
mlo
=
mhi
=
S
=
0
;
s0
=
0
;
s0
=
0
;
u
.
d
=
dd
;
u
.
d
=
dd
;
...
@@ -2713,8 +2712,6 @@ _Py_dg_dtoa(double dd, int mode, int ndigits,
...
@@ -2713,8 +2712,6 @@ _Py_dg_dtoa(double dd, int mode, int ndigits,
* and for all and pass them and a shift to quorem, so it
* and for all and pass them and a shift to quorem, so it
* can do shifts and ors to compute the numerator for q.
* can do shifts and ors to compute the numerator for q.
*/
*/
if
((
i
=
((
s5
?
32
-
hi0bits
(
S
->
x
[
S
->
wds
-
1
])
:
1
)
+
s2
)
&
0x1f
))
i
=
32
-
i
;
#define iInc 28
#define iInc 28
i
=
dshift
(
S
,
s2
);
i
=
dshift
(
S
,
s2
);
b2
+=
i
;
b2
+=
i
;
...
...
Python/getcwd.c
View file @
0b03f10a
...
@@ -28,7 +28,7 @@ getcwd(char *buf, int size)
...
@@ -28,7 +28,7 @@ getcwd(char *buf, int size)
{
{
char
localbuf
[
MAXPATHLEN
+
1
];
char
localbuf
[
MAXPATHLEN
+
1
];
char
*
ret
;
char
*
ret
;
if
(
size
<=
0
)
{
if
(
size
<=
0
)
{
errno
=
EINVAL
;
errno
=
EINVAL
;
return
NULL
;
return
NULL
;
...
@@ -59,14 +59,13 @@ getcwd(char *buf, int size)
...
@@ -59,14 +59,13 @@ getcwd(char *buf, int size)
{
{
FILE
*
fp
;
FILE
*
fp
;
char
*
p
;
char
*
p
;
int
sts
;
if
(
size
<=
0
)
{
if
(
size
<=
0
)
{
errno
=
EINVAL
;
errno
=
EINVAL
;
return
NULL
;
return
NULL
;
}
}
if
((
fp
=
popen
(
PWD_CMD
,
"r"
))
==
NULL
)
if
((
fp
=
popen
(
PWD_CMD
,
"r"
))
==
NULL
)
return
NULL
;
return
NULL
;
if
(
fgets
(
buf
,
size
,
fp
)
==
NULL
||
(
sts
=
pclose
(
fp
)
)
!=
0
)
{
if
(
fgets
(
buf
,
size
,
fp
)
==
NULL
||
pclose
(
fp
)
!=
0
)
{
errno
=
EACCES
;
/* Most likely error */
errno
=
EACCES
;
/* Most likely error */
return
NULL
;
return
NULL
;
}
}
...
...
Python/import.c
View file @
0b03f10a
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
#include <fcntl.h>
#include <fcntl.h>
#endif
#endif
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
#endif
#endif
#ifdef MS_WINDOWS
#ifdef MS_WINDOWS
...
@@ -826,7 +826,7 @@ parse_source_module(const char *pathname, FILE *fp)
...
@@ -826,7 +826,7 @@ parse_source_module(const char *pathname, FILE *fp)
flags
.
cf_flags
=
0
;
flags
.
cf_flags
=
0
;
mod
=
PyParser_ASTFromFile
(
fp
,
pathname
,
Py_file_input
,
0
,
0
,
&
flags
,
mod
=
PyParser_ASTFromFile
(
fp
,
pathname
,
Py_file_input
,
0
,
0
,
&
flags
,
NULL
,
arena
);
NULL
,
arena
);
if
(
mod
)
{
if
(
mod
)
{
co
=
PyAST_Compile
(
mod
,
pathname
,
NULL
,
arena
);
co
=
PyAST_Compile
(
mod
,
pathname
,
NULL
,
arena
);
...
@@ -884,7 +884,7 @@ write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat)
...
@@ -884,7 +884,7 @@ write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat)
mode_t
mode
=
srcstat
->
st_mode
&
~
S_IEXEC
;
mode_t
mode
=
srcstat
->
st_mode
&
~
S_IEXEC
;
#else
#else
mode_t
mode
=
srcstat
->
st_mode
&
~
S_IXUSR
&
~
S_IXGRP
&
~
S_IXOTH
;
mode_t
mode
=
srcstat
->
st_mode
&
~
S_IXUSR
&
~
S_IXGRP
&
~
S_IXOTH
;
#endif
#endif
fp
=
open_exclusive
(
cpathname
,
mode
);
fp
=
open_exclusive
(
cpathname
,
mode
);
if
(
fp
==
NULL
)
{
if
(
fp
==
NULL
)
{
...
@@ -972,7 +972,7 @@ load_source_module(char *name, char *pathname, FILE *fp)
...
@@ -972,7 +972,7 @@ load_source_module(char *name, char *pathname, FILE *fp)
char
*
cpathname
;
char
*
cpathname
;
PyCodeObject
*
co
;
PyCodeObject
*
co
;
PyObject
*
m
;
PyObject
*
m
;
if
(
fstat
(
fileno
(
fp
),
&
st
)
!=
0
)
{
if
(
fstat
(
fileno
(
fp
),
&
st
)
!=
0
)
{
PyErr_Format
(
PyExc_RuntimeError
,
PyErr_Format
(
PyExc_RuntimeError
,
"unable to get file status from '%s'"
,
"unable to get file status from '%s'"
,
...
@@ -1406,7 +1406,7 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
...
@@ -1406,7 +1406,7 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
else
{
else
{
char
warnstr
[
MAXPATHLEN
+
80
];
char
warnstr
[
MAXPATHLEN
+
80
];
sprintf
(
warnstr
,
"Not importing directory "
sprintf
(
warnstr
,
"Not importing directory "
"'%.*s': missing __init__.py"
,
"'%.*s': missing __init__.py"
,
MAXPATHLEN
,
buf
);
MAXPATHLEN
,
buf
);
if
(
PyErr_Warn
(
PyExc_ImportWarning
,
if
(
PyErr_Warn
(
PyExc_ImportWarning
,
warnstr
))
{
warnstr
))
{
...
@@ -1427,7 +1427,7 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
...
@@ -1427,7 +1427,7 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
else
{
else
{
char
warnstr
[
MAXPATHLEN
+
80
];
char
warnstr
[
MAXPATHLEN
+
80
];
sprintf
(
warnstr
,
"Not importing directory "
sprintf
(
warnstr
,
"Not importing directory "
"'%.*s': missing __init__.py"
,
"'%.*s': missing __init__.py"
,
MAXPATHLEN
,
buf
);
MAXPATHLEN
,
buf
);
if
(
PyErr_Warn
(
PyExc_ImportWarning
,
if
(
PyErr_Warn
(
PyExc_ImportWarning
,
warnstr
))
{
warnstr
))
{
...
@@ -2266,7 +2266,7 @@ get_parent(PyObject *globals, char *buf, Py_ssize_t *p_buflen, int level)
...
@@ -2266,7 +2266,7 @@ get_parent(PyObject *globals, char *buf, Py_ssize_t *p_buflen, int level)
modname
=
PyDict_GetItem
(
globals
,
namestr
);
modname
=
PyDict_GetItem
(
globals
,
namestr
);
if
(
modname
==
NULL
||
!
PyString_Check
(
modname
))
if
(
modname
==
NULL
||
!
PyString_Check
(
modname
))
return
Py_None
;
return
Py_None
;
modpath
=
PyDict_GetItem
(
globals
,
pathstr
);
modpath
=
PyDict_GetItem
(
globals
,
pathstr
);
if
(
modpath
!=
NULL
)
{
if
(
modpath
!=
NULL
)
{
/* __path__ is set, so modname is already the package name */
/* __path__ is set, so modname is already the package name */
...
@@ -2621,7 +2621,7 @@ PyImport_ReloadModule(PyObject *m)
...
@@ -2621,7 +2621,7 @@ PyImport_ReloadModule(PyObject *m)
struct
filedescr
*
fdp
;
struct
filedescr
*
fdp
;
FILE
*
fp
=
NULL
;
FILE
*
fp
=
NULL
;
PyObject
*
newm
;
PyObject
*
newm
;
if
(
modules_reloading
==
NULL
)
{
if
(
modules_reloading
==
NULL
)
{
Py_FatalError
(
"PyImport_ReloadModule: "
Py_FatalError
(
"PyImport_ReloadModule: "
"no modules_reloading dictionary!"
);
"no modules_reloading dictionary!"
);
...
...
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