]> granicus.if.org Git - python/commitdiff
bpo-37146: disable opcache when Py_DEBUG is defined (GH-13787)
authorInada Naoki <songofacandy@gmail.com>
Mon, 3 Jun 2019 22:38:10 +0000 (07:38 +0900)
committerVictor Stinner <vstinner@redhat.com>
Mon, 3 Jun 2019 22:38:09 +0000 (00:38 +0200)
--with-pydebug is commonly used to find memory leaks.
But opcache makes it harder.
So disable opcache when Py_DEBUG is defined.

Python/ceval.c

index 0a4af915d6ffe0b3df4ecdc605900e61fc84a350..2590ce6575a1dc0019a407c11cbcad9899d16eb6 100644 (file)
@@ -103,7 +103,14 @@ static long dxp[256];
 #endif
 
 /* per opcode cache */
+#ifdef Py_DEBUG
+// --with-pydebug is used to find memory leak.  opcache makes it harder.
+// So we disable opcache when Py_DEBUG is defined.
+// See bpo-37146
+#define OPCACHE_MIN_RUNS 0  /* disable opcache */
+#else
 #define OPCACHE_MIN_RUNS 1024  /* create opcache when code executed this time */
+#endif
 #define OPCACHE_STATS 0  /* Enable stats */
 
 #if OPCACHE_STATS