Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions Include/internal/pycore_ceval.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ extern "C" {
#include "pycore_stats.h" // EVAL_CALL_STAT_INC()
#include "pycore_typedefs.h" // _PyInterpreterFrame

/* HP PA-RISC has a stack that goes up */
#ifdef __hppa__
# define _Py_STACK_GROWS_DOWN 0
#else
# define _Py_STACK_GROWS_DOWN 1
#endif

/* Forward declarations */
struct _ceval_runtime_state;

Expand Down
6 changes: 6 additions & 0 deletions Include/pyport.h
Original file line number Diff line number Diff line change
Expand Up @@ -682,4 +682,10 @@ extern "C" {
#endif


// Assume the stack grows down if not specified by autoconf
#ifndef _Py_STACK_GROWS_DOWN
# define _Py_STACK_GROWS_DOWN 1
#endif


#endif /* Py_PYPORT_H */
4 changes: 4 additions & 0 deletions Modules/_testcapimodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3324,6 +3324,10 @@ _testcapi_exec(PyObject *m)
PyModule_AddObject(m, "INT64_MAX", PyLong_FromInt64(INT64_MAX));
PyModule_AddObject(m, "UINT64_MAX", PyLong_FromUInt64(UINT64_MAX));

if (PyModule_AddIntMacro(m, _Py_STACK_GROWS_DOWN)) {
return -1;
}

if (PyModule_AddIntMacro(m, Py_single_input)) {
return -1;
}
Expand Down
13 changes: 13 additions & 0 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,14 @@ if test x$MULTIARCH != x; then
fi
AC_SUBST([MULTIARCH_CPPFLAGS])

# Guess C stack direction
AS_CASE([$host],
[hppa-*], [_Py_STACK_GROWS_DOWN=0],
[_Py_STACK_GROWS_DOWN=1])
AC_DEFINE_UNQUOTED([_Py_STACK_GROWS_DOWN], [$_Py_STACK_GROWS_DOWN],
[Define to 1 if the machine stack grows down (default); 0 if it grows up.])
AC_SUBST([_Py_STACK_GROWS_DOWN])

dnl Support tiers according to https://peps.python.org/pep-0011/
dnl
dnl NOTE: Windows support tiers are defined in PC/pyconfig.h.
Expand Down
3 changes: 3 additions & 0 deletions pyconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -2026,6 +2026,9 @@
/* HACL* library can compile SIMD256 implementations */
#undef _Py_HACL_CAN_COMPILE_VEC256

/* Define to 1 if the machine stack grows down (default); 0 if it grows up. */
#undef _Py_STACK_GROWS_DOWN

/* Define if you want to use tail-calling interpreters in CPython. */
#undef _Py_TAIL_CALL_INTERP

Expand Down