[Python-modules-commits] r24392 - in packages/python-docutils/trunk/debian (3 files)
jwilk at users.alioth.debian.org
jwilk at users.alioth.debian.org
Wed May 15 20:17:27 UTC 2013
Date: Wednesday, May 15, 2013 @ 20:17:24
Author: jwilk
Revision: 24392
Add patch not to pass byte strings to PIL.Image.open() when running under Python 3.
Added:
packages/python-docutils/trunk/debian/patches/python3-pil-no-bytestrings.diff
Modified:
packages/python-docutils/trunk/debian/changelog
packages/python-docutils/trunk/debian/patches/series
Modified: packages/python-docutils/trunk/debian/changelog
===================================================================
--- packages/python-docutils/trunk/debian/changelog 2013-05-15 17:42:48 UTC (rev 24391)
+++ packages/python-docutils/trunk/debian/changelog 2013-05-15 20:17:24 UTC (rev 24392)
@@ -6,8 +6,10 @@
[ Jakub Wilk ]
* Add patch (strict-csv-parser.diff) to make the CSV parser stricter
(closes: #692286).
+ * Add patch (python3-pil-no-bytestrings.diff) not to pass byte strings to
+ PIL.Image.open() when running under Python 3.X (closes: #708159).
- -- Jakub Wilk <jwilk at debian.org> Wed, 15 May 2013 19:32:03 +0200
+ -- Jakub Wilk <jwilk at debian.org> Wed, 15 May 2013 22:14:41 +0200
python-docutils (0.10-2) unstable; urgency=low
Added: packages/python-docutils/trunk/debian/patches/python3-pil-no-bytestrings.diff
===================================================================
--- packages/python-docutils/trunk/debian/patches/python3-pil-no-bytestrings.diff (rev 0)
+++ packages/python-docutils/trunk/debian/patches/python3-pil-no-bytestrings.diff 2013-05-15 20:17:24 UTC (rev 24392)
@@ -0,0 +1,41 @@
+Description: Python 3: don't pass byte strings to PIL.Image.open()
+ With Python 3.X, pass Unicode strings (rather than byte strings) to
+ PIL.Image.open().
+ .
+ This is to work around a PIL bug: http://bugs.debian.org/708449
+Author: Jakub Wilk <jwilk at debian.org>
+Forwarded: no
+Bug-Debian: http://bugs.debian.org/708159
+
+--- a/docutils/parsers/rst/directives/images.py
++++ b/docutils/parsers/rst/directives/images.py
+@@ -127,8 +127,11 @@
+ if PIL and self.state.document.settings.file_insertion_enabled:
+ imagepath = urllib.url2pathname(image_node['uri'])
+ try:
+- img = PIL.Image.open(
+- imagepath.encode(sys.getfilesystemencoding()))
++ if isinstance(imagepath, str):
++ imagepath_str = imagepath
++ else:
++ imagepath_str = imagepath.encode(sys.getfilesystemencoding())
++ img = PIL.Image.open(imagepath_str)
+ except (IOError, UnicodeEncodeError):
+ pass # TODO: warn?
+ else:
+--- a/docutils/writers/html4css1/__init__.py
++++ b/docutils/writers/html4css1/__init__.py
+@@ -1032,8 +1032,11 @@
+ and self.settings.file_insertion_enabled):
+ imagepath = urllib.url2pathname(uri)
+ try:
+- img = PIL.Image.open(
+- imagepath.encode(sys.getfilesystemencoding()))
++ if isinstance(imagepath, str):
++ imagepath_str = imagepath
++ else:
++ imagepath_str = imagepath.encode(sys.getfilesystemencoding())
++ img = PIL.Image.open(imagepath_str)
+ except (IOError, UnicodeEncodeError):
+ pass # TODO: warn?
+ else:
Modified: packages/python-docutils/trunk/debian/patches/series
===================================================================
--- packages/python-docutils/trunk/debian/patches/series 2013-05-15 17:42:48 UTC (rev 24391)
+++ packages/python-docutils/trunk/debian/patches/series 2013-05-15 20:17:24 UTC (rev 24392)
@@ -1,4 +1,5 @@
strict-csv-parser.diff
+python3-pil-no-bytestrings.diff
math-output-html.diff
fix-buildhtml-progress.diff
iepngfix-license.diff
More information about the Python-modules-commits
mailing list