[Python-checkins] bpo-43166: Disable ceval.c optimizations for Windows debug builds (GH-32023)

zooba webhook-mailer at python.org
Tue Mar 22 20:35:33 EDT 2022


https://github.com/python/cpython/commit/cd05d0a423d97be69f9de4650f68f89e99ad68d1
commit: cd05d0a423d97be69f9de4650f68f89e99ad68d1
branch: main
author: neonene <53406459+neonene at users.noreply.github.com>
committer: zooba <steve.dower at microsoft.com>
date: 2022-03-23T00:35:25Z
summary:

bpo-43166: Disable ceval.c optimizations for Windows debug builds (GH-32023)

Also increases the stack allocation when run with `python_d.exe` to account for the extra stack checks that are added.

files:
M Include/pyport.h
M PCbuild/python.vcxproj
M Python/ceval.c

diff --git a/Include/pyport.h b/Include/pyport.h
index 62ac0989d3f15..855c382a61ee5 100644
--- a/Include/pyport.h
+++ b/Include/pyport.h
@@ -170,23 +170,12 @@ typedef Py_ssize_t Py_ssize_clean_t;
  * Py_LOCAL_INLINE does the same thing, and also explicitly requests inlining,
  * for platforms that support that.
  *
- * If PY_LOCAL_AGGRESSIVE is defined before python.h is included, more
- * "aggressive" inlining/optimization is enabled for the entire module.  This
- * may lead to code bloat, and may slow things down for those reasons.  It may
- * also lead to errors, if the code relies on pointer aliasing.  Use with
- * care.
- *
  * NOTE: You can only use this for functions that are entirely local to a
  * module; functions that are exported via method tables, callbacks, etc,
  * should keep using static.
  */
 
 #if defined(_MSC_VER)
-#  if defined(PY_LOCAL_AGGRESSIVE)
-   /* enable more aggressive optimization for MSVC */
-   /* active in both release and debug builds - see bpo-43271 */
-#  pragma optimize("gt", on)
-#endif
    /* ignore warnings if the compiler decides not to inline a function */
 #  pragma warning(disable: 4710)
    /* fastest possible local call under MSVC */
diff --git a/PCbuild/python.vcxproj b/PCbuild/python.vcxproj
index 77bccde69e3ba..11f835aecea7d 100644
--- a/PCbuild/python.vcxproj
+++ b/PCbuild/python.vcxproj
@@ -94,7 +94,8 @@
     </ClCompile>
     <Link>
       <SubSystem>Console</SubSystem>
-      <StackReserveSize>2000000</StackReserveSize>
+      <StackReserveSize Condition="$(Configuration) != 'Debug'">2000000</StackReserveSize>
+      <StackReserveSize Condition="$(Configuration) == 'Debug'">4000000</StackReserveSize>
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
diff --git a/Python/ceval.c b/Python/ceval.c
index 73179c810b7e5..42925b5b63048 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -5,10 +5,6 @@
    XXX document it!
    */
 
-/* enable more aggressive intra-module optimizations, where available */
-/* affects both release and debug builds - see bpo-43271 */
-#define PY_LOCAL_AGGRESSIVE
-
 #include "Python.h"
 #include "pycore_abstract.h"      // _PyIndex_Check()
 #include "pycore_call.h"          // _PyObject_FastCallDictTstate()



More information about the Python-checkins mailing list