Skip to content

Commit

Permalink
Merge pull request #2740 from uploadcare/less-unsafe_ptrs
Browse files Browse the repository at this point in the history
Export only required properties in unsafe_ptrs
  • Loading branch information
wiredfool committed Sep 19, 2017
2 parents 7541755 + a6ed03c commit 6f8d8bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
3 changes: 1 addition & 2 deletions PIL/PyAccess.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ def __init__(self, img, readonly=False):
self.image8 = ffi.cast('unsigned char **', vals['image8'])
self.image32 = ffi.cast('int **', vals['image32'])
self.image = ffi.cast('unsigned char **', vals['image'])
self.xsize = vals['xsize']
self.ysize = vals['ysize']
self.xsize, self.ysize = img.im.size

# Keep pointer to im object to prevent dereferencing.
self._im = img.im
Expand Down
15 changes: 2 additions & 13 deletions _imaging.c
Original file line number Diff line number Diff line change
Expand Up @@ -3142,21 +3142,10 @@ _getattr_ptr(ImagingObject* self, void* closure)
static PyObject*
_getattr_unsafe_ptrs(ImagingObject* self, void* closure)
{
return Py_BuildValue("(ss)(si)(si)(si)(si)(si)(sn)(sn)(sn)(sn)(sn)(si)(si)(sn)",
"mode", self->image->mode,
"type", self->image->type,
"depth", self->image->depth,
"bands", self->image->bands,
"xsize", self->image->xsize,
"ysize", self->image->ysize,
"palette", self->image->palette,
return Py_BuildValue("(sn)(sn)(sn)",
"image8", self->image->image8,
"image32", self->image->image32,
"image", self->image->image,
"block", self->image->block,
"pixelsize", self->image->pixelsize,
"linesize", self->image->linesize,
"destroy", self->image->destroy
"image", self->image->image
);
};

Expand Down

0 comments on commit 6f8d8bb

Please sign in to comment.