Add critical sections to Packer buffer protocol methods

This commit is contained in:
copilot-swe-agent[bot] 2026-06-03 07:12:02 +00:00 committed by GitHub
parent e9e211f8e1
commit ce5088af74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -360,9 +360,11 @@ cdef class Packer:
"""
return memoryview(self)
@cython.critical_section
def __getbuffer__(self, Py_buffer *buffer, int flags):
PyBuffer_FillInfo(buffer, self, self.pk.buf, self.pk.length, 1, flags)
self.exports += 1
@cython.critical_section
def __releasebuffer__(self, Py_buffer *buffer):
self.exports -= 1