[pypy-issue] Issue #3115: pyp2.7-v7.2.0 json loads error (pypy/pypy)

zhaoqinghui issues-reply at bitbucket.org
Wed Nov 13 22:06:50 EST 2019


New issue 3115: pyp2.7-v7.2.0 json loads error
https://bitbucket.org/pypy/pypy/issues/3115/pyp27-v720-json-loads-error

zhaoqinghui:

I build pypy2.7-v7.2.0 from source under docker centos7

When I used it to read a simple JSON file, an error occurred, if I use python or pypy2.7-v6.0.0 there is no problem.

I made a simple test case to reproduce this error

this is the output:

```
[root at 14208e811d5c ~]# pypy a.py 
<type 'dict'> 2
payment
Traceback (most recent call last):
  File "a.py", line 23, in <module>
    pp(d)
  File "a.py", line 16, in pp
    print v
TypeError: 'NoneType' object is not iterable
```

‌

this is my test a.py file:

‌

```python
# -*- coding=utf-8 -*-

import inspect, json
f = open('./a.json')
l = f.read()
f.close()

d = json.loads(l)
print type(d), len(d)


def pp(o):
    if isinstance(o, dict):
        for k, v in o.items():
            print k
            print v
            pp(v)
    if isinstance(o, list):
        for x in xrange(len(o)):
            print o[x]
   
    
pp(d)
```

The a.json used in the test is a little large, so I put it in the attachment

this is my os info in docker :

‌

```
[root at 14208e811d5c ~]# pypy --version
Python 2.7.13 (4a68d8d3d2fc1faec2e83bcb4d28559099092574, Nov 13 2019, 06:25:39)
[PyPy 7.2.0 with GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

[root at 14208e811d5c ~]# cat /etc/redhat-release 
CentOS Linux release 7.7.1908 (Core)

[root at 14208e811d5c ~]# uname -a
Linux 14208e811d5c 4.9.184-linuxkit #1 SMP Tue Jul 2 22:58:16 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

[root at 14208e811d5c ~]# c++ -v
Using built-in specs.
COLLECT_GCC=c++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) 
```

‌




More information about the pypy-issue mailing list