| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
The default callback can export the internal buffer with getbuffer(). The packer then continues and can reallocate that buffer. The export points at freed memory after the reallocation. Call _check_exports() after the callback returns. The packer now raises BufferError. The pure Python packer already raises BufferError in this case.
There was a problem hiding this comment.
Other supported user-code hooks can still export the buffer before a reallocating write.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overviewPrevents buffer invalidation after default exports the packer’s internal buffer.
Changes:
| File | Description |
|---|---|
| msgpack/_packer.pyx | Adds post-callback export validation. |
| test/test_buffer.py | Tests exported-buffer safety during callbacks. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Sorry, something went wrong.
| # The callback may have exported the internal buffer. | ||
| # Packing on would reallocate it and invalidate the export. | ||
| self._check_exports() |
| Back | FazBrowse Home | New Git URL |
#733