Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 252e8e2

Browse files
committed
Merged revisions 82171 via svnmerge from
svn+ssh://[email protected]/python/branches/py3k ................ r82171 | antoine.pitrou | 2010-06-22 23:49:39 +0200 (mar., 22 juin 2010) | 10 lines Merged revisions 82169 via svnmerge from svn+ssh://[email protected]/python/trunk ........ r82169 | antoine.pitrou | 2010-06-22 23:42:05 +0200 (mar., 22 juin 2010) | 4 lines Fix misindents in compile.c (for Benjamin). Of course, whoever used the wrong indentation rules needs to be spanked. ........ ................
1 parent 479a38b commit 252e8e2

1 file changed

Lines changed: 38 additions & 38 deletions

File tree

Python/compile.c

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ compiler_addop_o(struct compiler *c, int opcode, PyObject *dict,
984984
{
985985
int arg = compiler_add_o(c, dict, o);
986986
if (arg < 0)
987-
return 0;
987+
return 0;
988988
return compiler_addop_i(c, opcode, arg);
989989
}
990990

@@ -995,11 +995,11 @@ compiler_addop_name(struct compiler *c, int opcode, PyObject *dict,
995995
int arg;
996996
PyObject *mangled = _Py_Mangle(c->u->u_private, o);
997997
if (!mangled)
998-
return 0;
998+
return 0;
999999
arg = compiler_add_o(c, dict, mangled);
10001000
Py_DECREF(mangled);
10011001
if (arg < 0)
1002-
return 0;
1002+
return 0;
10031003
return compiler_addop_i(c, opcode, arg);
10041004
}
10051005

@@ -1150,7 +1150,7 @@ static int
11501150
compiler_isdocstring(stmt_ty s)
11511151
{
11521152
if (s->kind != Expr_kind)
1153-
return 0;
1153+
return 0;
11541154
return s->v.Expr.value->kind == Str_kind;
11551155
}
11561156

@@ -1256,11 +1256,11 @@ compiler_lookup_arg(PyObject *dict, PyObject *name)
12561256
PyObject *k, *v;
12571257
k = PyTuple_Pack(2, name, name->ob_type);
12581258
if (k == NULL)
1259-
return -1;
1259+
return -1;
12601260
v = PyDict_GetItem(dict, k);
12611261
Py_DECREF(k);
12621262
if (v == NULL)
1263-
return -1;
1263+
return -1;
12641264
return PyLong_AS_LONG(v);
12651265
}
12661266

@@ -3082,35 +3082,35 @@ compiler_with(struct compiler *c, stmt_ty s)
30823082
assert(s->kind == With_kind);
30833083

30843084
if (!enter_attr) {
3085-
enter_attr = PyUnicode_InternFromString("__enter__");
3086-
if (!enter_attr)
3087-
return 0;
3085+
enter_attr = PyUnicode_InternFromString("__enter__");
3086+
if (!enter_attr)
3087+
return 0;
30883088
}
30893089
if (!exit_attr) {
3090-
exit_attr = PyUnicode_InternFromString("__exit__");
3091-
if (!exit_attr)
3092-
return 0;
3090+
exit_attr = PyUnicode_InternFromString("__exit__");
3091+
if (!exit_attr)
3092+
return 0;
30933093
}
30943094

30953095
block = compiler_new_block(c);
30963096
finally = compiler_new_block(c);
30973097
if (!block || !finally)
3098-
return 0;
3098+
return 0;
30993099

31003100
if (s->v.With.optional_vars) {
3101-
/* Create a temporary variable to hold context.__enter__().
3102-
We need to do this rather than preserving it on the stack
3103-
because SETUP_FINALLY remembers the stack level.
3104-
We need to do the assignment *inside* the try/finally
3105-
so that context.__exit__() is called when the assignment
3106-
fails. But we need to call context.__enter__() *before*
3107-
the try/finally so that if it fails we won't call
3108-
context.__exit__().
3109-
*/
3110-
tmpvalue = compiler_new_tmpname(c);
3111-
if (tmpvalue == NULL)
3112-
return 0;
3113-
PyArena_AddPyObject(c->c_arena, tmpvalue);
3101+
/* Create a temporary variable to hold context.__enter__().
3102+
We need to do this rather than preserving it on the stack
3103+
because SETUP_FINALLY remembers the stack level.
3104+
We need to do the assignment *inside* the try/finally
3105+
so that context.__exit__() is called when the assignment
3106+
fails. But we need to call context.__enter__() *before*
3107+
the try/finally so that if it fails we won't call
3108+
context.__exit__().
3109+
*/
3110+
tmpvalue = compiler_new_tmpname(c);
3111+
if (tmpvalue == NULL)
3112+
return 0;
3113+
PyArena_AddPyObject(c->c_arena, tmpvalue);
31143114
}
31153115
tmpexit = compiler_new_tmpname(c);
31163116
if (tmpexit == NULL)
@@ -3131,29 +3131,29 @@ compiler_with(struct compiler *c, stmt_ty s)
31313131
ADDOP_I(c, CALL_FUNCTION, 0);
31323132

31333133
if (s->v.With.optional_vars) {
3134-
/* Store it in tmpvalue */
3135-
if (!compiler_nameop(c, tmpvalue, Store))
3136-
return 0;
3134+
/* Store it in tmpvalue */
3135+
if (!compiler_nameop(c, tmpvalue, Store))
3136+
return 0;
31373137
}
31383138
else {
3139-
/* Discard result from context.__enter__() */
3140-
ADDOP(c, POP_TOP);
3139+
/* Discard result from context.__enter__() */
3140+
ADDOP(c, POP_TOP);
31413141
}
31423142

31433143
/* Start the try block */
31443144
ADDOP_JREL(c, SETUP_FINALLY, finally);
31453145

31463146
compiler_use_next_block(c, block);
31473147
if (!compiler_push_fblock(c, FINALLY_TRY, block)) {
3148-
return 0;
3148+
return 0;
31493149
}
31503150

31513151
if (s->v.With.optional_vars) {
3152-
/* Bind saved result of context.__enter__() to VAR */
3153-
if (!compiler_nameop(c, tmpvalue, Load) ||
3154-
!compiler_nameop(c, tmpvalue, Del))
3155-
return 0;
3156-
VISIT(c, expr, s->v.With.optional_vars);
3152+
/* Bind saved result of context.__enter__() to VAR */
3153+
if (!compiler_nameop(c, tmpvalue, Load) ||
3154+
!compiler_nameop(c, tmpvalue, Del))
3155+
return 0;
3156+
VISIT(c, expr, s->v.With.optional_vars);
31573157
}
31583158

31593159
/* BLOCK code */
@@ -3166,7 +3166,7 @@ compiler_with(struct compiler *c, stmt_ty s)
31663166
ADDOP_O(c, LOAD_CONST, Py_None, consts);
31673167
compiler_use_next_block(c, finally);
31683168
if (!compiler_push_fblock(c, FINALLY_END, finally))
3169-
return 0;
3169+
return 0;
31703170

31713171
/* Finally block starts; context.__exit__ is on the stack under
31723172
the exception or return information. Just issue our magic

0 commit comments

Comments
 (0)