Skip to content

Commit 33080ce

Browse files
author
Anselm Kruis
committed
merge 3.3-slp (Stackless python#117, ceval.c cleanup)
2 parents efbee92 + d5696be commit 33080ce

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

Python/ceval.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,6 +1222,9 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
12221222
return NULL;
12231223
}
12241224

1225+
/* a global write only dummy variable */
1226+
char _dont_optimise_away_slp_eval_frame_functions;
1227+
12251228
PyObject *
12261229
slp_eval_frame_noval(PyFrameObject *f, int throwflag, PyObject *retval)
12271230
{
@@ -1231,9 +1234,8 @@ slp_eval_frame_noval(PyFrameObject *f, int throwflag, PyObject *retval)
12311234
* it serves as a marker whether we expect a value or
12321235
* not, and it makes debugging a little easier.
12331236
*/
1234-
Py_XINCREF(f); /* fool the link optimizer */
1237+
_dont_optimise_away_slp_eval_frame_functions = 1;
12351238
r = slp_eval_frame_value(f, throwflag, retval);
1236-
Py_XDECREF(f);
12371239
return r;
12381240
}
12391241

@@ -1247,9 +1249,8 @@ slp_eval_frame_iter(PyFrameObject *f, int throwflag, PyObject *retval)
12471249
* for_iter operation. In this case we need to handle
12481250
* null without error as valid result.
12491251
*/
1250-
Py_XINCREF(retval); /* fool the link optimizer */
1252+
_dont_optimise_away_slp_eval_frame_functions = 2;
12511253
r = slp_eval_frame_value(f, throwflag, retval);
1252-
Py_XDECREF(retval);
12531254
return r;
12541255
}
12551256

@@ -1263,11 +1264,8 @@ slp_eval_frame_setup_with(PyFrameObject *f, int throwflag, PyObject *retval)
12631264
* SETUP_WITH operation.
12641265
* NOTE / XXX: see above.
12651266
*/
1266-
Py_XINCREF(f); /* fool the link optimizer */
1267-
Py_XINCREF(retval); /* fool the link optimizer */
1267+
_dont_optimise_away_slp_eval_frame_functions = 3;
12681268
r = slp_eval_frame_value(f, throwflag, retval);
1269-
Py_XDECREF(retval);
1270-
Py_XDECREF(f);
12711269
return r;
12721270
}
12731271

@@ -1281,11 +1279,8 @@ slp_eval_frame_with_cleanup(PyFrameObject *f, int throwflag, PyObject *retval)
12811279
* WITH_CLEANUP operation.
12821280
* NOTE / XXX: see above.
12831281
*/
1284-
Py_XINCREF(f); /* fool the link optimizer */
1285-
Py_XINCREF(f); /* fool the link optimizer */
1282+
_dont_optimise_away_slp_eval_frame_functions = 4;
12861283
r = slp_eval_frame_value(f, throwflag, retval);
1287-
Py_XDECREF(f);
1288-
Py_XDECREF(f);
12891284
return r;
12901285
}
12911286

0 commit comments

Comments
 (0)