Skip to content

Commit cd05d0a

Browse files
authored
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.
1 parent 7ba7eae commit cd05d0a

File tree

3 files changed

+2
-16
lines changed

3 files changed

+2
-16
lines changed

Include/pyport.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -170,23 +170,12 @@ typedef Py_ssize_t Py_ssize_clean_t;
170170
* Py_LOCAL_INLINE does the same thing, and also explicitly requests inlining,
171171
* for platforms that support that.
172172
*
173-
* If PY_LOCAL_AGGRESSIVE is defined before python.h is included, more
174-
* "aggressive" inlining/optimization is enabled for the entire module. This
175-
* may lead to code bloat, and may slow things down for those reasons. It may
176-
* also lead to errors, if the code relies on pointer aliasing. Use with
177-
* care.
178-
*
179173
* NOTE: You can only use this for functions that are entirely local to a
180174
* module; functions that are exported via method tables, callbacks, etc,
181175
* should keep using static.
182176
*/
183177

184178
#if defined(_MSC_VER)
185-
# if defined(PY_LOCAL_AGGRESSIVE)
186-
/* enable more aggressive optimization for MSVC */
187-
/* active in both release and debug builds - see bpo-43271 */
188-
# pragma optimize("gt", on)
189-
#endif
190179
/* ignore warnings if the compiler decides not to inline a function */
191180
# pragma warning(disable: 4710)
192181
/* fastest possible local call under MSVC */

PCbuild/python.vcxproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@
9494
</ClCompile>
9595
<Link>
9696
<SubSystem>Console</SubSystem>
97-
<StackReserveSize>2000000</StackReserveSize>
97+
<StackReserveSize Condition="$(Configuration) != 'Debug'">2000000</StackReserveSize>
98+
<StackReserveSize Condition="$(Configuration) == 'Debug'">4000000</StackReserveSize>
9899
</Link>
99100
</ItemDefinitionGroup>
100101
<ItemGroup>

Python/ceval.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
XXX document it!
66
*/
77

8-
/* enable more aggressive intra-module optimizations, where available */
9-
/* affects both release and debug builds - see bpo-43271 */
10-
#define PY_LOCAL_AGGRESSIVE
11-
128
#include "Python.h"
139
#include "pycore_abstract.h" // _PyIndex_Check()
1410
#include "pycore_call.h" // _PyObject_FastCallDictTstate()

0 commit comments

Comments
 (0)