Issue1704

classification
Title: isinstance(obj.__dict__, dict) returns False
Type: behaviour Severity: normal
Components: Core Versions: 2.5.2rc
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: fwierzbicki Nosy List: alex.gronholm, amak, fwierzbicki, pjenvey
Priority: high Keywords:

Created on 2011-02-07.08:37:01 by alex.gronholm, last changed 2012-04-07.02:09:23 by fwierzbicki.

Messages
msg6383 (view) Author: Alex Grönholm (alex.gronholm) Date: 2011-02-07.08:37:00
Jython 2.5.2rc3 (Release_2_5_2rc3:7184, Jan 10 2011, 22:54:57) 
[OpenJDK 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_20
Type "help", "copyright", "credits" or "license" for more information.
>>> class A(object): pass
... 
>>> type(A().__dict__)
<type 'dict'>
>>> isinstance(A().__dict__, dict)
False

Anybody care to explain? Ran into this while debugging a strange issue in my app that only occurred in Jython.
msg6385 (view) Author: Philip Jenvey (pjenvey) Date: 2011-02-07.23:58:31
Historically Jython has used a different dict implementation, PyStringMap, for namespace dicts like these. PyStringMap is optimized for string keys.

In the future I hope we can either remove PyStringMap or at least make it a subclass of dict. Unfortunately that won't happen until at least 2.6.
msg7028 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2012-04-06.16:08:08
This one is causing loads of test failures now that 2.7's unittest directly checks that obj.__dict__ is a dict.
msg7030 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2012-04-06.19:25:09
Fixed in http://hg.python.org/jython/rev/710fb0e26c72
msg7031 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2012-04-06.19:25:58
Drat - forgot this was broken in 2.5 as well, will backport
msg7036 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2012-04-07.02:09:22
This should be fixed for the next 2.5.3 and for the default hg branch (2.7)
History
Date User Action Args
2012-04-07 02:09:23fwierzbickisetstatus: open -> closed
resolution: accepted -> fixed
messages: + msg7036
2012-04-06 19:25:58fwierzbickisetmessages: + msg7031
2012-04-06 19:25:09fwierzbickisetmessages: + msg7030
2012-04-06 16:12:44fwierzbickisetresolution: accepted
2012-04-06 16:08:08fwierzbickisetpriority: low -> high
assignee: fwierzbicki
messages: + msg7028
nosy: + fwierzbicki
2012-03-19 20:58:41amaksetnosy: + amak
2011-02-07 23:58:31pjenveysetpriority: low
nosy: + pjenvey
messages: + msg6385
2011-02-07 08:37:01alex.gronholmcreate