kmonsoor / pyglet

Automatically exported from code.google.com/p/pyglet
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

py3 compatibility for png s (bytes vs str) #724

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Fixes tracebacks in png's related tests:

tests\image
    NO_ENCODER_RGB_SAVE.py
    PNG_*.py

diff -r af64b8ab77ff pyglet/image/__init__.py
--- a/pyglet/image/__init__.py  Tue Apr 01 17:54:03 2014 +0100
+++ b/pyglet/image/__init__.py  Wed Apr 02 15:32:58 2014 -0300
@@ -1154,9 +1154,9 @@

         self._ensure_string_data()
         data = self._convert(self._current_format, abs(self._current_pitch))
-        rows = re.findall('.' * abs(self._current_pitch), data, re.DOTALL)
+        rows = re.findall(b'.' * abs(self._current_pitch), data, re.DOTALL)
         rows = [row[x1:x2] for row in rows[self.y:self.y+self.height]]
-        self._current_data = ''.join(rows)
+        self._current_data = b''.join(rows)
         self._current_pitch = self.width * len(self._current_format)
         self._current_texture = None
         self.x = 0

Original issue reported on code.google.com by ccanepacc@gmail.com on 2 Apr 2014 at 6:51

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by useboxnet on 3 Apr 2014 at 5:56

GoogleCodeExporter commented 9 years ago
This issue was closed by revision be90eae71f6e.

Original comment by useboxnet on 3 Apr 2014 at 6:14