Issue1890

classification
Title: No __builtins__ while CPython 2.7 has it
Type: behaviour Severity: normal
Components: Core Versions: 2.7a1
Milestone:
process
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: fwierzbicki Nosy List: dahlia, fwierzbicki, zyasoft
Priority: Keywords:

Created on 2012-05-20.21:29:40 by dahlia, last changed 2014-12-13.02:09:43 by zyasoft.

Messages
msg7110 (view) Author: Hong Minhee (dahlia) Date: 2012-05-20.21:29:40
Jython 2.7a1 seems not having __builtins__ while CPython 2.7.3 has.


Jython 2.7a1 (default:4f5e3c12edc0, May 16 2012, 13:40:33) 
[OpenJDK 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_24
Type "help", "copyright", "credits" or "license" for more information.
>>> __builtins__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name '__builtins__' is not defined


Python 2.7.3 (default, Apr 20 2012, 22:39:59) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> __builtins__
<module '__builtin__' (built-in)>
msg7113 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2012-05-20.22:09:32
Use __builtin__ instead (note the lack of an 's') The __builtins__ global is an implementation detail of cpython -- see the note on the botto of http://docs.python.org/library/__builtin__.html
msg7114 (view) Author: Hong Minhee (dahlia) Date: 2012-05-20.22:14:53
PyPy also has __builtins__.  If Jython also does it, it would gain more compatibility to existing libraries that use __builtins__ global.
msg7117 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2012-05-20.22:26:31
We would need to make Jyhton's __builtins__.java into a true module and then we could look at exposing it that way. For now you can do almost all of what you might want with __builtin__ - and since it is a documented cpython implementation detail it is not a priority. PyPy aims to completely replace CPython and so has a higher need for compatibility (they have a GIL too - and Jython will never have that)
msg9228 (view) Author: Jim Baker (zyasoft) Date: 2014-12-13.02:09:43
Added as of https://hg.python.org/jython/rev/c33128fdf05f

It might be an implementation detail, but it certainly helps with compatibility.
History
Date User Action Args
2014-12-13 02:09:44zyasoftsetnosy: + zyasoft
messages: + msg9228
2012-05-20 22:26:31fwierzbickisetmessages: + msg7117
2012-05-20 22:14:53dahliasetmessages: + msg7114
2012-05-20 22:09:32fwierzbickisetstatus: open -> closed
assignee: fwierzbicki
resolution: invalid
messages: + msg7113
nosy: + fwierzbicki
2012-05-20 21:44:08dahliasetversions: + 2.7a1, - Deferred
2012-05-20 21:29:40dahliacreate