Skip to content

Commit

Permalink
fix tostring_rgba_minimized in _backend_agg.cpp for py3 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
leejjoon committed Jan 5, 2012
1 parent 24d9101 commit 57113fb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/_backend_agg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2239,7 +2239,12 @@ RendererAgg::tostring_rgba_minimized(const Py::Tuple& args)

int newwidth = 0;
int newheight = 0;
#if PY3K
Py::Bytes data;
#else
Py::String data;
#endif

if (xmin < xmax && ymin < ymax)
{
// Expand the bounds by 1 pixel on all sides
Expand Down Expand Up @@ -2269,7 +2274,11 @@ RendererAgg::tostring_rgba_minimized(const Py::Tuple& args)
}

// The Py::String will take over the buffer
data = Py::String((const char *)buf, (int)newsize);
#if PY3K
data = Py::Bytes((const char *)buf, (int) newsize);
#else
data = Py::String((const char *)buf, (int) newsize);
#endif
}

Py::Tuple bounds(4);
Expand Down

0 comments on commit 57113fb

Please sign in to comment.