Issue1691096

classification
Title: simplejson refuses to import in 2.2b1, works in 2.3 branch
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: cgroves, pjenvey, sgala
Priority: normal Keywords:

Created on 2007-03-30.08:22:02 by sgala, last changed 2008-06-13.01:35:43 by pjenvey.

Messages
msg1543 (view) Author: Santiago Gala (sgala) Date: 2007-03-30.08:22:02
Ditto (simplejson 1.7)


$ jython
Jython 2.2b1 on java1.6.0 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> from __future__ import generators
>>> import sys
>>> sys.path.append("/usr/lib64/python2.4/site-packages")
>>> sys.path=sys.path[1:]
>>> import simplejson.scanner
Traceback (innermost last):
  File "<console>", line 1, in ?
  File "/usr/lib64/python2.4/site-packages/simplejson/__init__.py", line 95, in ?
  File "/usr/lib64/python2.4/site-packages/simplejson/decoder.py", line 6, in ?
  File "/usr/lib64/python2.4/site-packages/simplejson/scanner.py", line 55
                        yield rval, matchend
                              ^
SyntaxError: invalid syntax

$ java -Djava.library.path=/usr/lib64/libreadline-java -classpath /usr/share/libreadline-java/lib/libreadline-java.jar:dist/jython.jar org.python.util.jython 
Jython 2.3a0 on java1.6.0
Type "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.append("/usr/lib64/python2.4/site-packages")
>>> sys.path=sys.path[1:]
>>> import simplejson.scanner
>>> 

I have no idea about where the difference lies, but looks like the generator feature is "forgotten" in the process of importing.
msg1544 (view) Author: Charlie Groves (cgroves) Date: 2007-04-20.04:23:54
Fixed Jython's forgetfulness in r3173.
msg3277 (view) Author: Philip Jenvey (pjenvey) Date: 2008-06-13.01:35:42
This bug is actually invalid -- basically it lets futures 'leak' into 
other imported modules, which although is a solution to this problem, 
causes other problems (see #1886758 for an example).

So we can't support this -- CPython 2.2 doesn't support this leaking of 
futures either. Basically simplejson needs to import generators from 
future itself, or it's just not 2.2 compatible:

Python 2.2.3 (#1, Sep 19 2007, 11:27:07) 
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from __future__ import generators
>>> import simplejson.scanner
simplejson/scanner.py:56: Warning: 'yield' will become a reserved 
keyword in the future
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "simplejson/__init__.py", line 112, in ?
    from decoder import JSONDecoder
  File "simplejson/decoder.py", line 7, in ?
    from simplejson.scanner import Scanner, pattern
  File "simplejson/scanner.py", line 56
    yield rval, matchend
             ^
SyntaxError: invalid syntax
>>> 

i've reverted this part of the patch in trunk
History
Date User Action Args
2008-06-13 01:35:43pjenveysetnosy: + pjenvey
resolution: fixed -> invalid
messages: + msg3277
2007-03-30 08:22:02sgalacreate