Skip to content

Commit 57113fb

Browse files
committed
fix tostring_rgba_minimized in _backend_agg.cpp for py3 compatibility
1 parent 24d9101 commit 57113fb

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/_backend_agg.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2239,7 +2239,12 @@ RendererAgg::tostring_rgba_minimized(const Py::Tuple& args)
22392239

22402240
int newwidth = 0;
22412241
int newheight = 0;
2242+
#if PY3K
2243+
Py::Bytes data;
2244+
#else
22422245
Py::String data;
2246+
#endif
2247+
22432248
if (xmin < xmax && ymin < ymax)
22442249
{
22452250
// Expand the bounds by 1 pixel on all sides
@@ -2269,7 +2274,11 @@ RendererAgg::tostring_rgba_minimized(const Py::Tuple& args)
22692274
}
22702275

22712276
// The Py::String will take over the buffer
2272-
data = Py::String((const char *)buf, (int)newsize);
2277+
#if PY3K
2278+
data = Py::Bytes((const char *)buf, (int) newsize);
2279+
#else
2280+
data = Py::String((const char *)buf, (int) newsize);
2281+
#endif
22732282
}
22742283

22752284
Py::Tuple bounds(4);

0 commit comments

Comments
 (0)