1. python_mirrors
  2. stackless-fullhistory


Kristjan Valur Jonsson  committed 6aa5cc4

Fix a well hidden bug with Release builds from VisualStudio 2005. The global optimizer would aggressively collapse PyEval_EvalFrame_noval and PyEval_EvalFrame_iter into the same function, thus destroying the special control semantics that they convey onto f_execute. We need to both make them dissimilar and disable global optmization for them.

  • Participants
  • Parent commits 29ce8b5
  • Branches release25-maint

Comments (0)

Files changed (1)

File Python/ceval.c

View file
  • Ignore whitespace
 	return NULL;
+#if defined _MSC_VER && _MSC_VER >= 1400
+/* prevent VisualStudio from collapsing the following two functions */
+#pragma optimize("g", off)
 PyObject *
 PyEval_EvalFrame_noval(PyFrameObject *f, int throwflag, PyObject *retval)
 	 * it serves as a marker whether we are inside of a
 	 * for_iter operation. In this case we need to handle
 	 * null without error as valid result.
+	 * Note, it is not just a copy of the above function, but calls
+	 * the above.  This is to prevent clever compilers from
+	 * collapsing these two functions into one and thus ruining
+	 * our smart logic that tests f_execute for these functions.
-	return PyEval_EvalFrame_value(f, throwflag, retval);
+	return PyEval_EvalFrame_noval(f, throwflag, retval);
+#if defined _MSC_VER && _MSC_VER >= 1400
+#pragma optimize("", on)
 PyObject *
 PyEval_EvalFrame_value(PyFrameObject *f, int throwflag, PyObject *retval)