classification
Title: io.StringIO doesn't provide a __dict__ field
Type: behavior Stage: resolved
Components: IO Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, benjamin.peterson, ericp, pitrou, python-dev
Priority: normal Keywords:

Created on 2011-09-01 18:47 by ericp, last changed 2011-09-03 13:32 by python-dev. This issue is now closed.

Messages (4)
msg143344 - (view) Author: Eric Promislow (ericp) Date: 2011-09-01 18:47
I see that going from Python 3.1.1 to 3.1.2 
instances of io.StringIO no longer have a __dict__ field.

Why?  Is this to make them unpicklable?
msg143348 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-09-01 19:54
I'm not sure why that is. Note that you can still set and get arbitrary attributes, so there must be a dict somewhere, but it isn't exposed. Also, there wasn't any significant change in StringIO in the 3.1 line.
Benjamin, do you have any idea?

>>> s = io.StringIO()
>>> s.x = 5
>>> s.x
5
>>> s.__dict__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: '_io.StringIO' object has no attribute '__dict__'
msg143387 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2011-09-02 08:03
Actually it already fails with 3.1 (I tried "hg up v3.1")
Then I played with "hg bisect", and unsurprisingly it answered:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: '_io.StringIO' object has no attribute '__dict__'
Changeset 51991:3049ac17e256: bad
The first bad revision is:
changeset:   51991:3049ac17e256
user:        Benjamin Peterson <benjamin@python.org>
date:        Wed Mar 04 00:14:51 2009 +0000
summary:     merge the io-c branch: C implementation of the io module
msg143460 - (view) Author: Roundup Robot (python-dev) Date: 2011-09-03 13:32
New changeset 8ec8a4579788 by Benjamin Peterson in branch '3.2':
add a __dict__ descr for IOBase (closes #12878)
http://hg.python.org/cpython/rev/8ec8a4579788

New changeset fe0497bd7354 by Benjamin Peterson in branch 'default':
merge 3.2 (#12878)
http://hg.python.org/cpython/rev/fe0497bd7354
History
Date User Action Args
2011-09-03 13:32:31python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg143460

resolution: fixed
stage: resolved
2011-09-02 08:03:58amaury.forgeotdarcsetmessages: + msg143387
2011-09-01 19:54:03pitrousetnosy: + amaury.forgeotdarc, pitrou, benjamin.peterson

messages: + msg143348
versions: + Python 3.2, Python 3.3, - Python 3.1
2011-09-01 18:47:08ericpcreate