Skip to content

Commit eddef86

Browse files
methanevstinner
authored andcommitted
bpo-37146: disable opcache when Py_DEBUG is defined (GH-13787)
--with-pydebug is commonly used to find memory leaks. But opcache makes it harder. So disable opcache when Py_DEBUG is defined.
1 parent 0f0a30f commit eddef86

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Python/ceval.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,14 @@ static long dxp[256];
103103
#endif
104104

105105
/* per opcode cache */
106+
#ifdef Py_DEBUG
107+
// --with-pydebug is used to find memory leak. opcache makes it harder.
108+
// So we disable opcache when Py_DEBUG is defined.
109+
// See bpo-37146
110+
#define OPCACHE_MIN_RUNS 0 /* disable opcache */
111+
#else
106112
#define OPCACHE_MIN_RUNS 1024 /* create opcache when code executed this time */
113+
#endif
107114
#define OPCACHE_STATS 0 /* Enable stats */
108115

109116
#if OPCACHE_STATS

0 commit comments

Comments
 (0)