Segfault/RecursionError with psycopg2
I was interested in giving pypy a run, and the first speedbump I hit was with psycopg2. Interestingly I was getting a RecursionError from the RealDictCursor class, but after stripping it down to this minimal example I started getting a segfault instead. You'll need to spin up a postgres in order to test.
import psycopg2 as psycopg2
import psycopg2.extras as psycopg2_extras
def main():
conn_args = {
"host": "127.0.0.1",
"password": "abc",
"port": 15432,
"user": "def",
}
with psycopg2.connect(**conn_args) as conn:
conn.cursor_factory = psycopg2_extras.RealDictCursor
cursor = conn.cursor()
cursor.execute("select 1 as foo")
print(list(cursor))
if "__main__" == __name__:
main()
On my machine this gives:
> /home/josephbylund/.pyenv/versions/pypy3.7-7.3.5/bin/python --jit off test.py
Fatal error in cpyext, CPython compatibility layer, calling PyObject_Call
Either report a bug or consider not using this particular extension
<StackOverflow object at 0x7f6f96a560c0>
RPython traceback:
File "pypy_module_cpyext_1.c", line 227, in wrapper_second_level__star_3_31
File "pypy_module_cpyext_1.c", line 37268, in from_ref
File "rpython_rlib.c", line 13832, in stack_check_slowpath
Segmentation fault