[Python-bugs-list] [ python-Bugs-786314 ] Wrong class name after
using import cStringIO as StringIO
SourceForge.net
noreply at sourceforge.net
Sun Aug 10 10:21:51 EDT 2003
Bugs item #786314, was opened at 2003-08-10 18:21
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=786314&group_id=5470
Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Stefan Schwarzer (sschwarzer)
Assigned to: Nobody/Anonymous (nobody)
Summary: Wrong class name after using import cStringIO as StringIO
Initial Comment:
Try this:
Python 2.3 (#1, Aug 6 2003, 21:21:10)
[GCC 3.2.2 [FreeBSD] 20030205 (release)] on freebsd5
Type "help", "copyright", "credits" or "license" for
more information.
>>> import cStringIO as StringIO
>>> obj = StringIO.StringIO()
>>> obj.spam
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: 'cStringIO.StringO' object has no
attribute 'spam'
>>>
Note that the module/class name in the error message
misses an "I". In a unit test of one of my programs I got
AttributeError: 'cStringIO.StringI' object has no
attribute 'mode'
Here, the trailing "O" is missing instead of the "I".
Compare this with
Python 2.3 (#1, Aug 6 2003, 21:21:10)
[GCC 3.2.2 [FreeBSD] 20030205 (release)] on freebsd5
Type "help", "copyright", "credits" or "license" for
more information.
>>> import StringIO as cStringIO
>>> obj = cStringIO.StringIO()
>>> obj.spam
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: StringIO instance has no attribute 'spam'
Surprisingly, the class name has all letters, but the
module name isn't there, and the single quotation marks
are missing.
The bug isn't a bad problem, but perhaps it manifests
in other places where it causes more harm.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=786314&group_id=5470
More information about the Python-bugs-list
mailing list