#1483 closed defect (fixed)
str(NoSuchChildError(nonascii)) raises an exception, causing the actual name to be lost in tracebacks
Reported by: | davidsarah | Owned by: | davidsarah |
---|---|---|---|
Priority: | minor | Milestone: | 1.9.2 |
Component: | code | Version: | 1.8.3 |
Keywords: | error reviewed | Cc: | zooko |
Launchpad Bug: |
Description
C:\tahoe\furry>bin\tahoe debug repl Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> from allmydata.interfaces import NoSuchChildError >>> str(NoSuchChildError(u'\u2621')) Traceback (most recent call last): File "<console>", line 1, in <module> UnicodeEncodeError: 'ascii' codec can't encode character u'\u2621' in position 0: ordinal not in range(128)
Despite this, Twisted trial usually manages to print tracebacks in unit test errors successfully. However it still causes ugliness and loss of information, for example:
[ERROR] Traceback (most recent call last): File "c:\tahoe\furry\src\allmydata\dirnode.py", line 444, in _get raise NoSuchChildError(name) allmydata.interfaces.NoSuchChildError: <NoSuchChildError instance at 0x226b558 with str error: Traceback (most recent call last): File "C:\Python27\lib\site-packages\twisted-10.2.0-py2.7-win32.egg\twisted\python\reflect.py", line 546, in _safeFormat return formatter(o) UnicodeEncodeError: 'ascii' codec can't encode character u'\xf8' in position 1: ordinal not in range (128) >
Attachments (1)
Change History (10)
Changed at 2011-08-15T00:06:42Z by davidsarah
comment:1 Changed at 2011-08-15T00:07:45Z by davidsarah
- Keywords review-needed added
comment:2 Changed at 2011-08-15T00:07:55Z by davidsarah
- Owner davidsarah deleted
comment:3 Changed at 2011-08-25T23:47:47Z by thedirtycalvinist
- Owner set to thedirtycalvinist
- Status changed from new to assigned
comment:4 Changed at 2011-08-26T00:05:10Z by thedirtycalvinist
- Keywords reviewed added; review-needed removed
- Owner changed from thedirtycalvinist to davidsarah
- Status changed from assigned to new
Seems simple enough to me and matches the suggested definition of that function in the Python documentation: http://docs.python.org/tutorial/errors.html#tut-userexceptions
comment:5 Changed at 2011-08-26T00:11:24Z by davidsarah
- Priority changed from major to minor
- Status changed from new to assigned
Will apply immediately after 1.9.
comment:6 Changed at 2012-02-24T06:03:36Z by zooko
- Cc zooko added
- Version changed from 1.8.2 to 1.8.3
comment:7 Changed at 2012-04-01T00:33:55Z by davidsarah
- Milestone changed from 1.11.0 to 1.9.2
comment:8 Changed at 2012-04-01T02:34:28Z by david-sarah@…
- Resolution set to fixed
- Status changed from assigned to closed
In 93e50f5e1616004a:
comment:9 Changed at 2012-04-01T05:17:02Z by david-sarah <david-sarah@…>
In 93e50f5e1616004a:
Note: See
TracTickets for help on using
tickets.
interfaces.py: ensure that NoSuchChildError? can be converted to str even when it is for a non-ASCII name. fixes #1483