Skip to content

FIX macos: Use the agg buffer_rgba rather than private attribute #28964

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/_macosx.m
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,7 @@ -(void)drawRect:(NSRect)rect
CGContextRef cr = [[NSGraphicsContext currentContext] CGContext];

if (!(renderer = PyObject_CallMethod(canvas, "get_renderer", ""))
|| !(renderer_buffer = PyObject_GetAttrString(renderer, "_renderer"))) {
|| !(renderer_buffer = PyObject_CallMethod(renderer, "buffer_rgba", ""))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the implementation of RendererAgg, it's:

    def buffer_rgba(self):
        return memoryview(self._renderer)

so this looks like a reasonable change. I'm a bit uncertain why PyObject_GetBuffer is not sufficient with pybind11's version of buffers, but we can investigate that for later.

PyErr_Print();
goto exit;
}
Expand Down
Loading