summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-09-08 09:48:28 (GMT)
committerGitHub <noreply@github.com>2023-09-08 09:48:28 (GMT)
commitb0edf3b98e4b3e68a13776e034b9dd86ad7e529d (patch)
tree98e1b3a6fe21a9cd32d2143e4a85c74f57b2b007 /Include
parent15d4c9fabce67b8a1b5bd9dec9612014ec18291a (diff)
downloadcpython-b0edf3b98e4b3e68a13776e034b9dd86ad7e529d.zip
cpython-b0edf3b98e4b3e68a13776e034b9dd86ad7e529d.tar.gz
cpython-b0edf3b98e4b3e68a13776e034b9dd86ad7e529d.tar.bz2
GH-91079: Rename C_RECURSION_LIMIT to Py_C_RECURSION_LIMIT (#108507)
Symbols of the C API should be prefixed by "Py_" to avoid conflict with existing names in 3rd party C extensions on "#include <Python.h>". test.pythoninfo now logs Py_C_RECURSION_LIMIT constant and other _testcapi and _testinternalcapi constants.
Diffstat (limited to 'Include')
-rw-r--r--Include/cpython/pystate.h19
1 files changed, 9 insertions, 10 deletions
diff --git a/Include/cpython/pystate.h b/Include/cpython/pystate.h
index fc5f58d..e1a15cd 100644
--- a/Include/cpython/pystate.h
+++ b/Include/cpython/pystate.h
@@ -194,18 +194,17 @@ struct _ts {
};
-/* WASI has limited call stack. Python's recursion limit depends on code
- layout, optimization, and WASI runtime. Wasmtime can handle about 700
- recursions, sometimes less. 500 is a more conservative limit. */
-#ifndef C_RECURSION_LIMIT
-# ifdef __wasi__
-# define C_RECURSION_LIMIT 500
-# else
- // This value is duplicated in Lib/test/support/__init__.py
-# define C_RECURSION_LIMIT 1500
-# endif
+#ifdef __wasi__
+ // WASI has limited call stack. Python's recursion limit depends on code
+ // layout, optimization, and WASI runtime. Wasmtime can handle about 700
+ // recursions, sometimes less. 500 is a more conservative limit.
+# define Py_C_RECURSION_LIMIT 500
+#else
+ // This value is duplicated in Lib/test/support/__init__.py
+# define Py_C_RECURSION_LIMIT 1500
#endif
+
/* other API */
/* Similar to PyThreadState_Get(), but don't issue a fatal error