[pypy-issue] Issue #2820: Py_ReprEnter and Py_ReprLeave not implemented (pypy/pypy)

Hrvoje Nikšić issues-reply at bitbucket.org
Thu May 3 11:13:23 EDT 2018

New issue 2820: Py_ReprEnter and Py_ReprLeave not implemented

Hrvoje Nikšić:

The Python/C emulation does not currently include an implementation of PyRepr_Enter and PyRepr_Leave.

Our in-house extensions use them, so for the purpose of our PyPy evaluation I defined the following stubs in a header:


extern "C" {
inline Py_ssize_t Py_ReprEnter(PyObject *x) {
  return 0;
inline void Py_ReprLeave(PyObject *x) {

The functions should be straightforward to implement properly, perhaps simply by copying the CPython implementation. They have been present in the API for a very long time, but have been documented only at some point in Python 3.

More information about the pypy-issue mailing list