This is a bugfix release. Users of hiredis-py 3.4.x that receive RESP3 push notifications — pub/sub deliveries or client-side cache invalidations — are encouraged to upgrade.
🐛 Bug Fixes
- Release the list each push notification is sized from (#239)
PushNotificationType_New pre-sized every PushNotification with a list that PyList_SetSlice only borrows, and the reference was never dropped. Each RESP3 push notification therefore stranded one list object for the lifetime of the process. Because push notifications carry pub/sub deliveries and client-side caching invalidations, the leak grew with message volume rather than with the number of connections, making it unbounded for a long-lived subscriber — roughly 20 MB per 200,000 four-element notifications, and more for larger ones. Dropping the reference also removes an allocation from the parse path, which makes parsing a small notification about 10% faster.
The same change checks PyList_New for failure and guards tryParentize against a NULL reply, so an allocation failure is now reported as an error instead of writing elements past the end of a zero-length notification.
RESP2 array replies were never affected.
Contributors
Thanks to @mmick78 for finding and fixing this.