Date: Mon, 10 Mar 2014 02:12:13 +0900 From: poyopoyo@puripuri.plala.or.jp To: FreeBSD-gnats-submit@freebsd.org Subject: ports/187397: [PATCH] textproc/py-feedparser: backport fix with chardet issue Message-ID: <86zjkzuwia.wl%poyopoyo@puripuri.plala.or.jp> Resent-Message-ID: <201403091720.s29HK0dh087778@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 187397 >Category: ports >Synopsis: [PATCH] textproc/py-feedparser: backport fix with chardet issue >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Mar 09 17:20:00 UTC 2014 >Closed-Date: >Last-Modified: >Originator: SATO Kuro >Release: FreeBSD 10.0-CURRENT amd64 >Organization: personal >Environment: >Description: Backport a fix for chardet issue which prevents mail/rss2email3 from working correctly on certain environment. As this fix is from feedparser development tree, it will be incorporated in the next release. http://code.google.com/p/feedparser/source/detail?r=20a32910f4a5 | Commit Date: Dec 17, 2012 | Log message | Fix chardet support in Python 3 | Fixes issue 384 . | Thanks to Google user Arfrever.TFA for reporting this! >How-To-Repeat: $ r2e run error while running time limited function: decoding str is not supported cause: decoding str is not supported error while running time limited function: decoding str is not supported cause: decoding str is not supported ... error while running time limited function: decoding str is not supported cause: decoding str is not supported $ >Fix: Index: Makefile =================================================================== --- Makefile (revision 347660) +++ Makefile (working copy) @@ -3,7 +3,7 @@ PORTNAME= feedparser PORTVERSION= 5.1.3 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= textproc python MASTER_SITES= CHEESESHOP PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} Index: files/patch-feedparser_feedparser.py =================================================================== --- files/patch-feedparser_feedparser.py (revision 0) +++ files/patch-feedparser_feedparser.py (working copy) @@ -0,0 +1,15 @@ +--- feedparser/feedparser.py.orig 2014-03-10 01:45:12.000000000 +0900 ++++ feedparser/feedparser.py 2014-03-10 01:45:53.000000000 +0900 +@@ -3766,7 +3766,11 @@ + chardet_encoding = None + tried_encodings = [] + if chardet: +- chardet_encoding = unicode(chardet.detect(data)['encoding'] or '', 'ascii', 'ignore') ++ chardet_encoding = chardet.detect(data)['encoding'] ++ if not chardet_encoding: ++ chardet_encoding = '' ++ if not isinstance(chardet_encoding, str): ++ chardet_encoding = str(chardet_encoding, 'ascii', 'ignore') + # try: HTTP encoding, declared XML encoding, encoding sniffed from BOM + for proposed_encoding in (rfc3023_encoding, xml_encoding, bom_encoding, + chardet_encoding, u'utf-8', u'windows-1252', u'iso-8859-2'): >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86zjkzuwia.wl%poyopoyo>