# Copyright (C) 2020 The Psycopg Team
+from cpython.object cimport PyObject_CallFunctionObjArgs
+
import logging
from typing import List
Return the list of results returned by the database (whether success
or error).
"""
- results: List[proto.PGresult] = []
+ cdef list results = []
cdef libpq.PGconn *pgconn_ptr = pgconn.pgconn_ptr
cdef int status
cdef libpq.PGnotify *notify
f"consuming input failed: {error_message(pgconn)}")
continue
+ cdef object notify_handler = pgconn.notify_handler
+
# Fetching the result
while 1:
with nogil:
continue
# Consume notifies
- if pgconn.notify_handler:
+ if notify_handler is not None:
while 1:
pynotify = pgconn.notifies()
if pynotify is None:
break
- pgconn.notify_handler(pynotify)
+ PyObject_CallFunctionObjArgs(
+ notify_handler, <PyObject *>pynotify, NULL
+ )
else:
while 1:
notify = libpq.PQnotifies(pgconn_ptr)
raise PQerror("couldn't create cancel object")
return PGcancel._from_ptr(ptr)
- def notifies(self) -> Optional[PGnotify]:
+ cpdef object notifies(self):
cdef libpq.PGnotify *ptr
with nogil:
ptr = libpq.PQnotifies(self.pgconn_ptr)