Issue1193

classification
Title: builtin module's __dict__s unusable
Type: Severity: normal
Components: Core Versions: Jython 2.7
Milestone: Jython 2.7.2
process
Status: open Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: darjus, fwierzbicki, pjenvey, zyasoft
Priority: normal Keywords:

Created on 2008-12-06.08:02:52 by pjenvey, last changed 2016-02-26.19:23:12 by zyasoft.

Messages
msg3878 (view) Author: Philip Jenvey (pjenvey) Date: 2008-12-06.08:02:51
Our builtin module's __dict__s don't have what you'd expect to see in 
CPython, they contain the remnants of our Java Integration:

Jython 2.5b0+ (trunk:5704:5712M, Dec 5 2008, 22:53:44) 
[Java HotSpot(TM) 64-Bit Server VM (Apple Inc.)] on java1.6.0_07
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.version_info > (2, 4)
True
>>> sys.__dict__['version_info'] > (2, 4)
False
>>> sys.__dict__['version_info']
<reflected field public static org.python.core.PyTuple 
org.python.core.PySystemState.version_info 1>

Which makes these __dict__s fairly useless and error prone. Occasionally 
there is good reason to go directly into them -- e.g. when wanting to 
specify a module dict for the scope of an exec statement

On a somewhat related note, the fact that our builtin modules aren't 
actual modules (assert isinstance(sys, types.ModuleType)) can also be 
annoying. I only mention it here because I think that fact might want to 
be considered in any fix for __dict__. It's really a different issue, 
though
msg8556 (view) Author: Jim Baker (zyasoft) Date: 2014-05-22.02:24:52
Target beta 4, although this is not likely to be easy given that sys is not a normal module in Jython
msg9608 (view) Author: Jim Baker (zyasoft) Date: 2015-03-10.18:29:03
Revisit for 2.7.x, where x > 0
msg10790 (view) Author: Darjus Loktevic (darjus) Date: 2016-02-25.06:42:30
Found a case where this breaks pytest. Don't have a clear repro, but essentially happens around monkeypatching of sys.std[out|err].
History
Date User Action Args
2016-02-26 19:23:12zyasoftsetmilestone: Jython 2.7.2
2016-02-25 06:42:31darjussetnosy: + darjus
messages: + msg10790
2015-03-10 18:29:03zyasoftsetmessages: + msg9608
2014-05-22 02:24:52zyasoftsetresolution: accepted
messages: + msg8556
versions: + Jython 2.7, - Jython 2.5
2013-02-25 18:47:00fwierzbickisetnosy: + fwierzbicki
versions: + Jython 2.5, - 2.5.1
2009-03-14 14:32:17fwierzbickisetpriority: normal
2009-03-14 14:13:06fwierzbickisetversions: + 2.5.1
2008-12-30 00:08:40zyasoftsetnosy: + zyasoft
2008-12-06 08:02:52pjenveycreate