Skip to content
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

ImageData.get_data() throws an exception on valid list input #752

Open
GoogleCodeExporter opened this issue Apr 6, 2015 · 3 comments
Open

Comments

@GoogleCodeExporter
Copy link

The following code causes an exception:

import pyglet
data = [1,2,3,4] * 10 * 10
a = pyglet.image.ImageData(10, 10, 'RGBA', data)
a.get_data('RGBA', 4)

The exception trace is:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/pymodules/python2.7/pyglet/image/__init__.py", line 701, in get_data
    return self._convert(format, pitch)
  File "/usr/lib/pymodules/python2.7/pyglet/image/__init__.py", line 986, in _convert
    self._ensure_string_data()
  File "/usr/lib/pymodules/python2.7/pyglet/image/__init__.py", line 1053, in _ensure_string_data
    memmove(buf, self._current_data, len(self._current_data))
ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: wrong type

This behavior occurs using both the last stable version and tip, using Python 
2.7.7 on 64-bit Linux (other platforms not tested).  

Contrast this with:

import pyglet
data = 'abcd' * 10 * 10
a = pyglet.image.ImageData(10, 10, 'RGBA', data)
a.get_data('RGBA', 4)

Which does not result in an error.

Did not try to run it under Python 3 since the current tip of pyglet doesn't 
appear to install successfully in Python 3.

Output of `python -m pyglet.info` is attached.

Original issue reported on code.google.com by [email protected] on 23 Jun 2014 at 10:51

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant