mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-17 01:20:32 +03:00
Payload default is the empty string.
This commit is contained in:
parent
9c58c01e0f
commit
56ae1fe4bf
|
@ -106,7 +106,7 @@ functionalities defined by the |DBAPI|_.
|
||||||
Close the object and remove it from the database.
|
Close the object and remove it from the database.
|
||||||
|
|
||||||
|
|
||||||
.. autoclass:: Notify(pid, channel, payload=None)
|
.. autoclass:: Notify(pid, channel, payload='')
|
||||||
:members: pid, channel, payload
|
:members: pid, channel, payload
|
||||||
|
|
||||||
.. versionadded:: 2.2.3
|
.. versionadded:: 2.2.3
|
||||||
|
|
|
@ -82,7 +82,7 @@ notify_init(NotifyObject *self, PyObject *args, PyObject *kwargs)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!payload) {
|
if (!payload) {
|
||||||
payload = Py_None;
|
payload = PyString_FromStringAndSize("", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_CLEAR(self->pid);
|
Py_CLEAR(self->pid);
|
||||||
|
|
|
@ -143,7 +143,7 @@ conn.close()
|
||||||
n = psycopg2.extensions.Notify(10, 'foo')
|
n = psycopg2.extensions.Notify(10, 'foo')
|
||||||
self.assertEqual(10, n.pid)
|
self.assertEqual(10, n.pid)
|
||||||
self.assertEqual('foo', n.channel)
|
self.assertEqual('foo', n.channel)
|
||||||
self.assertEqual(None, n.payload)
|
self.assertEqual('', n.payload)
|
||||||
(pid, channel) = n
|
(pid, channel) = n
|
||||||
self.assertEqual((pid, channel), (10, 'foo'))
|
self.assertEqual((pid, channel), (10, 'foo'))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user