This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年08月24日 16:38 by dmalcolm, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| fix-str-of-bogus-ImportError.patch | dmalcolm, 2012年08月24日 16:46 | review | ||
| Messages (5) | |||
|---|---|---|---|
| msg169042 - (view) | Author: Dave Malcolm (dmalcolm) (Python committer) | Date: 2012年08月24日 16:38 | |
In Python 3.2 and earlier: >>> str(ImportError(b'foo')) "b'foo'" In Python 3.3: >>> str(ImportError(b'foo')) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: __str__ returned non-string (type bytes) This appears to be due to commit 76272. I'm attaching a patch which fixes it, though perhaps ImportError should type-check the arguments Motivation: This leads to a failure of the test suite for "docutils" when run under Python 3.3 betas, specifically: ====================================================================== ERROR: test_unicode (test_error_reporting.ErrorStringTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/david/coding/python3.3/docutils/trunk/docutils/test3/test_error_reporting.py", line 154, in test_unicode str(ErrorString(ImportError(self.bs)))) File "/home/david/coding/python3.3/docutils/trunk/docutils/build/lib/docutils/utils/error_reporting.py", line 124, in __str__ super(ErrorString, self).__str__()) File "/home/david/coding/python3.3/docutils/trunk/docutils/build/lib/docutils/utils/error_reporting.py", line 74, in __str__ return str(self.data) TypeError: __str__ returned non-string (type bytes) See http://docutils.svn.sourceforge.net/viewvc/docutils/trunk/docutils/test/test_error_reporting.py?revision=7464&view=markup for the test code. Arguably docutils could just pick a different exception subclass. |
|||
| msg169043 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2012年08月24日 16:41 | |
> This appears to be due to commit 76272. Could you give the changeset id? Revision numbers are not portable from one repository clone to another. |
|||
| msg169045 - (view) | Author: Dave Malcolm (dmalcolm) (Python committer) | Date: 2012年08月24日 16:46 | |
Sorry, it's 6825fd9b00ed |
|||
| msg169048 - (view) | Author: Dave Malcolm (dmalcolm) (Python committer) | Date: 2012年08月24日 16:52 | |
(patch added) |
|||
| msg169051 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年08月24日 17:08 | |
New changeset 91909962d7f5 by Brett Cannon in branch 'default': Issue #15778: Coerce ImportError.args to a string when it isn't http://hg.python.org/cpython/rev/91909962d7f5 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:35 | admin | set | github: 59982 |
| 2012年08月24日 17:08:51 | brett.cannon | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2012年08月24日 17:08:34 | python-dev | set | nosy:
+ python-dev messages: + msg169051 |
| 2012年08月24日 17:00:57 | brett.cannon | set | assignee: brett.cannon |
| 2012年08月24日 16:59:34 | brett.cannon | set | nosy:
+ brian.curtin |
| 2012年08月24日 16:52:01 | dmalcolm | set | messages:
+ msg169048 stage: patch review |
| 2012年08月24日 16:46:55 | dmalcolm | set | files:
+ fix-str-of-bogus-ImportError.patch keywords: + patch |
| 2012年08月24日 16:46:20 | dmalcolm | set | messages: + msg169045 |
| 2012年08月24日 16:41:53 | pitrou | set | nosy:
+ pitrou messages: + msg169043 |
| 2012年08月24日 16:38:44 | dmalcolm | create | |