From issues-reply at bitbucket.org Fri Nov 8 15:28:31 2019 From: issues-reply at bitbucket.org (Ronan Lamy) Date: Fri, 08 Nov 2019 20:28:31 +0000 (UTC) Subject: [pypy-issue] Issue #3110: Interaction between exec() and nonlocal (pypy/pypy) Message-ID: <20191108202831.38823.80484@app-137.ash1.bb-inf.net> New issue 3110: Interaction between exec() and nonlocal https://bitbucket.org/pypy/pypy/issues/3110/interaction-between-exec-and-nonlocal Ronan Lamy: The following test, which passes on CPython 3.6.9, fails on the last line in PyPy: ```python def test_exec_nonlocal(): x = 0 def set_x(value): nonlocal x x = value set_x(1) assert x == 1 exec('set_x(2)') assert x == 2 ``` The situation is a bit unclear according to the docs, but I think PyPy?s behaviour is incorrect. From issues-reply at bitbucket.org Fri Nov 8 20:42:54 2019 From: issues-reply at bitbucket.org (Aaron Wise) Date: Sat, 09 Nov 2019 01:42:54 +0000 (UTC) Subject: [pypy-issue] Issue #3111: Multiprocessing occasionally hangs (pypy/pypy) Message-ID: <20191109014254.32029.82466@celery-worker-110.ash1.bb-inf.net> New issue 3111: Multiprocessing occasionally hangs https://bitbucket.org/pypy/pypy/issues/3111/multiprocessing-occasionally-hangs Aaron Wise: I?ve had an issue with some multiprocessed code occasionally failing, and have managed to work it to a \(fairly\) minimal example \(below\). Running this code with pypy3.6-7.2 on linux \(ubuntu 18.04\) causes the loop to hang occasionally \(about 1 in 10 runs\). When I ctrl\+c, I get the following error message \(interrupted by the KeyboardInterrupt\): > Traceback \(most recent call last\): > File "/path/to/pypy3.6-7.2/lib-python/3/multiprocessing/pool.py", line 720, in next > item = self.\_items.popleft\(\) > IndexError: pop from an empty deque As far as I can tell, if I do not define maxtasksperchild=1 \(and thus reuse processes\) the error does not occur. \(But it may occur very rarely, I?ve only tested it about 1000 times.\) ? ```python import multiprocessing def process_chunk(chunk_index): return ([],[],[]) def main(): i = 0 with multiprocessing.Pool(5, maxtasksperchild=1) as p: for sub_headers, sub_results, sub_scores in p.imap_unordered(process_chunk, range(5000)): print(i) i += 1 if __name__ == '__main__': main() ``` ? From issues-reply at bitbucket.org Mon Nov 11 12:53:00 2019 From: issues-reply at bitbucket.org (Unknown) Date: Mon, 11 Nov 2019 17:53:00 +0000 (UTC) Subject: [pypy-issue] Issue #3112: PyPy2 doesn't handle Unicode entries with non-ASCII characters in `sys.path` (pypy/pypy) Message-ID: <20191111175300.36422.20116@celery-worker-112.ash1.bb-inf.net> New issue 3112: PyPy2 doesn't handle Unicode entries with non-ASCII characters in `sys.path` https://bitbucket.org/pypy/pypy/issues/3112/pypy2-doesnt-handle-unicode-entries-with Unknown: It seems PyPy2 requires programmatically added `sys.path` entries to either be ASCII or encoded using the system encoding. Other Python interpreters I?ve tested \(Python 2, IronPython, Jython, and naturally Python 3\) all accept also Unicode paths. ? ```python Python 2.7.12 (aff251e54385, Nov 09 2016, 18:02:49) [PyPy 5.6.0 with GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>> import sys >>>> sys.path.insert(0, u'\xe4'.encode('UTF-8')) >>>> import nonexisting Traceback (most recent call last): File "", line 1, in ImportError: No module named nonexisting >>>> sys.path.insert(0, u'\xe4') >>>> import nonexisting Traceback (most recent call last): File "", line 1, in UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 0: ordinal not in range(128) ``` This isn?t a huge problem but makes writing code that works in all Python interpreters a bit harder. That?s especially true when [Jython nowadays uses Unicode entries](https://bugs.jython.org/issue2820) in `sys.path` and only accepts bytes if they are encoded using UTF-8 regardless the encoding. All interpreters supporting Unicode entries would be nice. From issues-reply at bitbucket.org Tue Nov 12 06:31:23 2019 From: issues-reply at bitbucket.org (Alex) Date: Tue, 12 Nov 2019 11:31:23 +0000 (UTC) Subject: [pypy-issue] Issue #3113: Unable to install ikp3db on pypy 3.6 portable (pypy/pypy) Message-ID: <20191112113123.39109.5193@celery-worker-110.ash1.bb-inf.net> New issue 3113: Unable to install ikp3db on pypy 3.6 portable https://bitbucket.org/pypy/pypy/issues/3113/unable-to-install-ikp3db-on-pypy-36 Alex: Cannot install ikp3db on Pypy 3.6 portable on Debian Stretch: ``` ./pip3.6 install ikp3db Collecting ikp3db Using cached https://files.pythonhosted.org/packages/93/a4/23342fc912f7ae6559e9d99f66a764f0d7d56f5977202deb419a0494cd63/ikp3db-1.4.1.tar.gz Building wheels for collected packages: ikp3db Building wheel for ikp3db (setup.py) ... error ERROR: Command errored out with exit status 1: command: /usr/local/share/pypy3.6-7.2.0-linux_x86_64-portable/bin/pypy3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xxvhg4yu/ikp3db/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xxvhg4yu/ikp3db/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-kszhtsgq --python-tag pp372 cwd: /tmp/pip-install-xxvhg4yu/ikp3db/ Complete output (76 lines): running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-3.6 copying ikp3db.py -> build/lib.linux-x86_64-3.6 running egg_info writing ikp3db.egg-info/PKG-INFO writing dependency_links to ikp3db.egg-info/dependency_links.txt writing top-level names to ikp3db.egg-info/top_level.txt reading manifest file 'ikp3db.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'ikp3db.egg-info/SOURCES.txt' running build_ext building 'iksettrace3' extension creating build/temp.linux-x86_64-3.6 gcc -pthread -DNDEBUG -O2 -fPIC -I/usr/local/share/pypy3.6-7.2.0-linux_x86_64-portable/include -c iksettrace3.c -o build/temp.linux-x86_64-3.6/iksettrace3.o iksettrace3.c: In function 'call_trampoline': iksettrace3.c:50:9: warning: implicit declaration of function 'PyFrame_FastToLocalsWithError' [-Wimplicit-function-declaration] if (PyFrame_FastToLocalsWithError(frame) < 0) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ iksettrace3.c:58:14: warning: implicit declaration of function '_PyObject_FastCall' [-Wimplicit-function-declaration] result = _PyObject_FastCall(callback, stack, 3); ^~~~~~~~~~~~~~~~~~ iksettrace3.c:58:12: warning: assignment makes pointer from integer without a cast [-Wint-conversion] result = _PyObject_FastCall(callback, stack, 3); ^ iksettrace3.c:60:5: warning: implicit declaration of function 'PyFrame_LocalsToFast' [-Wimplicit-function-declaration] PyFrame_LocalsToFast(frame, 1); ^~~~~~~~~~~~~~~~~~~~ iksettrace3.c: In function 'trace_trampoline': iksettrace3.c:75:17: error: 'PyTrace_CALL' undeclared (first use in this function) if (what == PyTrace_CALL) ^~~~~~~~~~~~ iksettrace3.c:75:17: note: each undeclared identifier is reported only once for each function it appears in iksettrace3.c:78:25: error: 'PyFrameObject {aka struct _frame}' has no member named 'f_trace' callback = frame->f_trace; ^~ iksettrace3.c:83:9: warning: implicit declaration of function 'PyEval_SetTrace' [-Wimplicit-function-declaration] PyEval_SetTrace(NULL, NULL); ^~~~~~~~~~~~~~~ In file included from /usr/local/share/pypy3.6-7.2.0-linux_x86_64-portable/include/Python.h:79:0, from iksettrace3.c:1: iksettrace3.c:84:23: error: 'PyFrameObject {aka struct _frame}' has no member named 'f_trace' Py_CLEAR(frame->f_trace); ^ /usr/local/share/pypy3.6-7.2.0-linux_x86_64-portable/include/object.h:72:42: note: in definition of macro 'Py_CLEAR' PyObject *_py_tmp = (PyObject *)(op); \ ^~ iksettrace3.c:84:23: error: 'PyFrameObject {aka struct _frame}' has no member named 'f_trace' Py_CLEAR(frame->f_trace); ^ /usr/local/share/pypy3.6-7.2.0-linux_x86_64-portable/include/object.h:74:14: note: in definition of macro 'Py_CLEAR' (op) = NULL; \ ^~ iksettrace3.c:88:25: error: 'PyFrameObject {aka struct _frame}' has no member named 'f_trace' Py_XSETREF(frame->f_trace, result); ^ iksettrace3.c:88:9: note: in expansion of macro 'Py_XSETREF' Py_XSETREF(frame->f_trace, result); ^~~~~~~~~~ iksettrace3.c:88:25: error: 'PyFrameObject {aka struct _frame}' has no member named 'f_trace' Py_XSETREF(frame->f_trace, result); ^ /usr/local/share/pypy3.6-7.2.0-linux_x86_64-portable/include/object.h:89:10: note: in definition of macro 'Py_XSETREF' (op) = (op2); \ ^~ iksettrace3.c: At top level: iksettrace3.c:102:13: error: unknown type name 'Py_tracefunc' IK_SetTrace(Py_tracefunc func, PyObject *arg) ^~~~~~~~~~~~ iksettrace3.c: In function '_ik_set_trace_on': iksettrace3.c:149:5: warning: implicit declaration of function 'IK_SetTrace' [-Wimplicit-function-declaration] IK_SetTrace(trace_trampoline, traceObject); ^~~~~~~~~~~ error: command 'gcc' failed with exit status 1 ---------------------------------------- ERROR: Failed building wheel for ikp3db Running setup.py clean for ikp3db Failed to build ikp3db Installing collected packages: ikp3db Running setup.py install for ikp3db ... error ERROR: Command errored out with exit status 1: command: /usr/local/share/pypy3.6-7.2.0-linux_x86_64-portable/bin/pypy3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xxvhg4yu/ikp3db/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xxvhg4yu/ikp3db/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-o4hgobff/install-record.txt --single-version-externally-managed --compile cwd: /tmp/pip-install-xxvhg4yu/ikp3db/ Complete output (76 lines): running install running build running build_py creating build creating build/lib.linux-x86_64-3.6 copying ikp3db.py -> build/lib.linux-x86_64-3.6 running egg_info writing ikp3db.egg-info/PKG-INFO writing dependency_links to ikp3db.egg-info/dependency_links.txt writing top-level names to ikp3db.egg-info/top_level.txt reading manifest file 'ikp3db.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'ikp3db.egg-info/SOURCES.txt' running build_ext building 'iksettrace3' extension creating build/temp.linux-x86_64-3.6 gcc -pthread -DNDEBUG -O2 -fPIC -I/usr/local/share/pypy3.6-7.2.0-linux_x86_64-portable/include -c iksettrace3.c -o build/temp.linux-x86_64-3.6/iksettrace3.o iksettrace3.c: In function 'call_trampoline': iksettrace3.c:50:9: warning: implicit declaration of function 'PyFrame_FastToLocalsWithError' [-Wimplicit-function-declaration] if (PyFrame_FastToLocalsWithError(frame) < 0) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ iksettrace3.c:58:14: warning: implicit declaration of function '_PyObject_FastCall' [-Wimplicit-function-declaration] result = _PyObject_FastCall(callback, stack, 3); ^~~~~~~~~~~~~~~~~~ iksettrace3.c:58:12: warning: assignment makes pointer from integer without a cast [-Wint-conversion] result = _PyObject_FastCall(callback, stack, 3); ^ iksettrace3.c:60:5: warning: implicit declaration of function 'PyFrame_LocalsToFast' [-Wimplicit-function-declaration] PyFrame_LocalsToFast(frame, 1); ^~~~~~~~~~~~~~~~~~~~ iksettrace3.c: In function 'trace_trampoline': iksettrace3.c:75:17: error: 'PyTrace_CALL' undeclared (first use in this function) if (what == PyTrace_CALL) ^~~~~~~~~~~~ iksettrace3.c:75:17: note: each undeclared identifier is reported only once for each function it appears in iksettrace3.c:78:25: error: 'PyFrameObject {aka struct _frame}' has no member named 'f_trace' callback = frame->f_trace; ^~ iksettrace3.c:83:9: warning: implicit declaration of function 'PyEval_SetTrace' [-Wimplicit-function-declaration] PyEval_SetTrace(NULL, NULL); ^~~~~~~~~~~~~~~ In file included from /usr/local/share/pypy3.6-7.2.0-linux_x86_64-portable/include/Python.h:79:0, from iksettrace3.c:1: iksettrace3.c:84:23: error: 'PyFrameObject {aka struct _frame}' has no member named 'f_trace' Py_CLEAR(frame->f_trace); ^ /usr/local/share/pypy3.6-7.2.0-linux_x86_64-portable/include/object.h:72:42: note: in definition of macro 'Py_CLEAR' PyObject *_py_tmp = (PyObject *)(op); \ ^~ iksettrace3.c:84:23: error: 'PyFrameObject {aka struct _frame}' has no member named 'f_trace' Py_CLEAR(frame->f_trace); ^ /usr/local/share/pypy3.6-7.2.0-linux_x86_64-portable/include/object.h:74:14: note: in definition of macro 'Py_CLEAR' (op) = NULL; \ ^~ iksettrace3.c:88:25: error: 'PyFrameObject {aka struct _frame}' has no member named 'f_trace' Py_XSETREF(frame->f_trace, result); ^ iksettrace3.c:88:9: note: in expansion of macro 'Py_XSETREF' Py_XSETREF(frame->f_trace, result); ^~~~~~~~~~ iksettrace3.c:88:25: error: 'PyFrameObject {aka struct _frame}' has no member named 'f_trace' Py_XSETREF(frame->f_trace, result); ^ /usr/local/share/pypy3.6-7.2.0-linux_x86_64-portable/include/object.h:89:10: note: in definition of macro 'Py_XSETREF' (op) = (op2); \ ^~ iksettrace3.c: At top level: iksettrace3.c:102:13: error: unknown type name 'Py_tracefunc' IK_SetTrace(Py_tracefunc func, PyObject *arg) ^~~~~~~~~~~~ iksettrace3.c: In function '_ik_set_trace_on': iksettrace3.c:149:5: warning: implicit declaration of function 'IK_SetTrace' [-Wimplicit-function-declaration] IK_SetTrace(trace_trampoline, traceObject); ^~~~~~~~~~~ error: command 'gcc' failed with exit status 1 ---------------------------------------- ERROR: Command errored out with exit status 1 ``` ? From issues-reply at bitbucket.org Wed Nov 13 07:26:06 2019 From: issues-reply at bitbucket.org (gpotter2) Date: Wed, 13 Nov 2019 12:26:06 +0000 (UTC) Subject: [pypy-issue] Issue #3114: SO_ATTACH_FILTER (pypy/pypy) Message-ID: <20191113122606.4664.61141@celery-worker-108.ash1.bb-inf.net> New issue 3114: SO_ATTACH_FILTER https://bitbucket.org/pypy/pypy/issues/3114/so_attach_filter gpotter2: Hi, The following call is made on a raw socket: ```python sock.setsockopt(socket.SOL_SOCKET, SO_ATTACH_FILTER, bp) ``` Where bp is a `bpf_program` C structure \( generated using libpcap?s `compile_filter`\) that we recreated using ```python You import ctypes class bpf_insn(ctypes.Structure): """"The BPF instruction data structure""" _fields_ = [("code", ctypes.c_ushort), ("jt", ctypes.c_ubyte), ("jf", ctypes.c_ubyte), ("k", ctypes.c_int)] class bpf_program(ctypes.Structure): """"Structure for BIOCSETF""" _fields_ = [('bf_len', ctypes.c_int), ('bf_insns', ctypes.POINTER(bpf_insn))] ``` This approach \(following Linux' docs for : `SO_ATTACH_FILTER`[http://man7.org/linux/man-pages/man7/socket.7.html](http://man7.org/linux/man-pages/man7/socket.7.html)\) works in both 2.7 and 3 versions of CPython, and fails with > TypeError: expected bytes, got bpf\_program object On Pypy3 \(7.1.1 beta0\) \(note actually all pypy versions\). ? The full code is actually quite long, as it contains libpcap bindings, socket creation? To debug the issue, you can get this modified version of Scapy: [https://github.com/secdev/scapy/pull/2336](https://github.com/secdev/scapy/pull/2336) Make sure libpcap is installed and run `sudo pypy3 -m scapy` then type `sniff(filter=?tcp?)`. ? FTR on master, we have to carry around old compatibility functions to make this work for PyPy using bytes based filters \(`https://github.com/secdev/scapy/blob/43fda76e560e3c94ab64fc23f8ee29c582b459be/scapy/arch/common.py#L111`\) which we would like to be able to drop. ? Thanks for the support From issues-reply at bitbucket.org Wed Nov 13 22:06:50 2019 From: issues-reply at bitbucket.org (zhaoqinghui) Date: Thu, 14 Nov 2019 03:06:50 +0000 (UTC) Subject: [pypy-issue] Issue #3115: pyp2.7-v7.2.0 json loads error (pypy/pypy) Message-ID: <20191114030650.29265.8488@app-137.ash1.bb-inf.net> 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 2 payment Traceback (most recent call last): File "a.py", line 23, in 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) ``` ? From issues-reply at bitbucket.org Thu Nov 14 14:29:39 2019 From: issues-reply at bitbucket.org (Christoph Reiter) Date: Thu, 14 Nov 2019 19:29:39 +0000 (UTC) Subject: [pypy-issue] Issue #3116: utf-8 + surrogateescape produces invalid result (pypy/pypy) Message-ID: <20191114192939.33558.72604@celery-worker-111.ash1.bb-inf.net> New issue 3116: utf-8 + surrogateescape produces invalid result https://bitbucket.org/pypy/pypy/issues/3116/utf-8-surrogateescape-produces-invalid Christoph Reiter: `b'\xe0\xa0'.decode('utf-8', 'surrogateescape')`\` On PyPy3 7.2.0: `'\udce0'` On CPython 3: `'\udce0\udca0'` ? From issues-reply at bitbucket.org Fri Nov 15 03:44:41 2019 From: issues-reply at bitbucket.org (Jia Fuei) Date: Fri, 15 Nov 2019 08:44:41 +0000 (UTC) Subject: [pypy-issue] Issue #3117: Fatal RPython Error when importing opencv-contrib built with PyPy 3 (pypy/pypy) Message-ID: <20191115084441.739.8831@app-147.ash1.bb-inf.net> New issue 3117: Fatal RPython Error when importing opencv-contrib built with PyPy 3 https://bitbucket.org/pypy/pypy/issues/3117/fatal-rpython-error-when-importing-opencv Jia Fuei: After building opencv-python with contrib modules and attempting to `import cv2`, PyPy exits with this error. This only happens if contrib modules are used. ? ``` RPython traceback: File "pypy_module_cpyext_2.c", line 10615, in type_realize File "pypy_module_cpyext_2.c", line 18850, in _type_realize Fatal RPython error: AssertionError ``` ? From issues-reply at bitbucket.org Sat Nov 16 19:37:37 2019 From: issues-reply at bitbucket.org (mattip) Date: Sun, 17 Nov 2019 00:37:37 +0000 (UTC) Subject: [pypy-issue] Issue #3118: '..' becoming b'..' when using pip install (pypy/pypy) Message-ID: <20191117003737.14276.48813@celery-worker-108.ash1.bb-inf.net> New issue 3118: '..' becoming b'..' when using pip install https://bitbucket.org/pypy/pypy/issues/3118/becoming-b-when-using-pip-install mattip: Reported on IRC, via this gist [https://gist.github.com/squeaky-pl/2920bb5f472f70346c57e6a859ecda04](https://gist.github.com/squeaky-pl/2920bb5f472f70346c57e6a859ecda04) Running `HGPYTHON3=1 -m pip install mercurial==5.0.2` errors when calling `with open(os.path.join(os.path.join(os.path.dirname(__file__), '..'), 'bdiff.c')) as f:`, the error is that somehow `'..'` is becoming `b'..'` From issues-reply at bitbucket.org Mon Nov 18 16:14:40 2019 From: issues-reply at bitbucket.org (Jason Madden) Date: Mon, 18 Nov 2019 21:14:40 +0000 (UTC) Subject: [pypy-issue] Issue #3119: pypy3.6-7.2 sets `socket.sslerror` but that's a Python 2 attribute (pypy/pypy) Message-ID: <20191118211440.26260.72255@app-147.ash1.bb-inf.net> New issue 3119: pypy3.6-7.2 sets `socket.sslerror` but that's a Python 2 attribute https://bitbucket.org/pypy/pypy/issues/3119/pypy36-72-sets-socketsslerror-but-thats-a Jason Madden: When [_cffi_ssl._stdssl.error](https://bitbucket.org/pypy/pypy/src/dde73a3a316b7b5228248addd7676d017d82f233/lib_pypy/_cffi_ssl/_stdssl/error.py?at=py3.6#lines-31) is imported, it unconditionally assigns a value to `socket.sslerror`. Under Python 2, this is expected, but `socket.sslerror` was [removed in Python 3.0](https://github.com/python/cpython/commit/86bc33cb7c248ede88ff9bd82775aab818f6224f#diff-1f037cd6b68ccd47326d99aeb7ae2c6a). This attribute was not present in pypy3.6-7.1. Having this attribute present on Python 3.6 can slightly confuse code that's trying to detect what sort of errors to catch. From issues-reply at bitbucket.org Wed Nov 20 10:21:11 2019 From: issues-reply at bitbucket.org (Kirill Smelkov) Date: Wed, 20 Nov 2019 15:21:11 +0000 (UTC) Subject: [pypy-issue] Issue #3120: PyErr_Restore does not restore traceback (pypy/pypy) Message-ID: <20191120152111.27295.67400@app-137.ash1.bb-inf.net> New issue 3120: PyErr_Restore does not restore traceback https://bitbucket.org/pypy/pypy/issues/3120/pyerr_restore-does-not-restore-traceback Kirill Smelkov: Hello up there. I again hit PyPy vs CPython incomatibility while moving parts of Pygolang to Cython. Please consider the following minimal example: \(mymod.pyx\) ```python # cython: language_level=2 cdef extern from "Python.h": ctypedef struct PyObject PyObject *PyObject_CallFunction(PyObject *f, const char *fmt, ...) void PyErr_Fetch(PyObject **pexc_type, PyObject **pexc_value, PyObject **pexc_tb) void PyErr_Restore(PyObject *exc_type, PyObject *exc_value, PyObject *exc_tb) void Py_XINCREF(PyObject*) # PyExc wraps information about Python exception cdef class PyExc: # retrieved by PyErr_Fetch - keep 1 reference to each cdef PyObject *exc_type cdef PyObject *exc_value cdef PyObject *exc_tb # call_pyfunc calls f and return PyExc describing exception state after f call. # f must raise an exception. def call_pyfunc(f): cdef PyExc pyexc = PyExc() cdef PyObject *ret ret = PyObject_CallFunction(f, NULL) if ret != NULL: raise AssertionError('f must raise an exception') PyErr_Fetch(&pyexc.exc_type, &pyexc.exc_value, &pyexc.exc_tb) return pyexc # reraise_pyexc reraises pyexc including its original traceback. def reraise_pyexc(PyExc pyexc not None): _pyexc_reraise(pyexc) cdef void _pyexc_reraise(PyExc pyexc) except *: # PyErr_Restore takes 1 reference to restored objects. # We want to keep pyerr itself alive and valid. Py_XINCREF(pyexc.exc_type); Py_XINCREF(pyexc.exc_value); Py_XINCREF(pyexc.exc_tb); PyErr_Restore(pyexc.exc_type, pyexc.exc_value, pyexc.exc_tb) ``` \(mytest.py\) ```python #!/usr/bin/env python import mymod def f(): g() def g(): h() def h(): 1/0 def main(): e = mymod.call_pyfunc(f) #print(e) i(e) def i(e): j(e) def j(e): k(e) def k(e): mymod.reraise_pyexc(e) if __name__ == '__main__': main() ``` When running with CPython `mytest.py` prints traceback that includes _both_ i-j-k _and_ f-g-h: ``` (neo) (z-dev) (g.env) kirr at deco:~/src/tools/go/pygolang/x$ python mytest.py Traceback (most recent call last): File "mytest.py", line 19, in main() File "mytest.py", line 12, in main i(e) File "mytest.py", line 14, in i def i(e): j(e) File "mytest.py", line 15, in j def j(e): k(e) File "mytest.py", line 16, in k def k(e): mymod.reraise_pyexc(e) File "mymod.pyx", line 33, in mymod.reraise_pyexc _pyexc_reraise(pyexc) File "mytest.py", line 5, in f def f(): g() File "mytest.py", line 6, in g def g(): h() File "mytest.py", line 7, in h def h(): 1/0 ZeroDivisionError: integer division or modulo by zero ``` However when run under PyPy \(I verified up till today?s nightly\) the traceback _does_ _not_ include f-g-h: ``` (pypy.venv) test1 at deco:~/pypy/pygolang/x$ pypy mytest.py Traceback (most recent call last): File "mytest.py", line 19, in main() File "mytest.py", line 12, in main i(e) File "mytest.py", line 14, in i def i(e): j(e) File "mytest.py", line 15, in j def j(e): k(e) File "mytest.py", line 16, in k def k(e): mymod.reraise_pyexc(e) File "mymod.pyx", line 33, in mymod.reraise_pyexc _pyexc_reraise(pyexc) ZeroDivisionError: integer division by zero ``` This minimal example models what happens in C/Pyx version of `sync.WorkGroup` in Pygolang and preserving the inner traceback is important there. ``` $ python Python 2.7.15+ (default, Feb 3 2019, 13:13:16) [GCC 8.2.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. ``` ? ``` (pypy.venv) test1 at deco:~/pypy/pygolang/x$ pypy Python 2.7.13 (dcc4efe7355e, Nov 19 2019, 23:00:15) [PyPy 7.3.0-alpha0 with GCC 5.3.1 20160413] on linux2 Type "help", "copyright", "credits" or "license" for more information. And now for something completely different: ``pypy is like sausages'' ``` Thanks beforehand, Kirill /cc @{557058:7cb88866-fb18-487e-a2dc-b19de69f5f0b} From issues-reply at bitbucket.org Fri Nov 22 11:17:18 2019 From: issues-reply at bitbucket.org (Carmen Bianca Bakker) Date: Fri, 22 Nov 2019 16:17:18 +0000 (UTC) Subject: [pypy-issue] Issue #3121: pathlib.Path objects are not accepted by os.chdir (pypy/pypy) Message-ID: <20191122161718.33083.29058@app-147.ash1.bb-inf.net> New issue 3121: pathlib.Path objects are not accepted by os.chdir https://bitbucket.org/pypy/pypy/issues/3121/pathlibpath-objects-are-not-accepted-by Carmen Bianca Bakker: Piece of code for demonstration: ``` $ pypy3 Python 3.6.1 (6f7180acecf3, Jul 27 2019, 12:44:44) [PyPy 7.1.1-beta0 with GCC 9.1.1 20190605 (Red Hat 9.1.1-2)] on linux Type "help", "copyright", "credits" or "license" for more information. >>>> import os >>>> import pathlib >>>> os.chdir(pathlib.Path(".")) Traceback (most recent call last): File "", line 1, in TypeError: 'PosixPath' does not support the buffer interface ``` I?ve tried a couple other functions in `os` and `os.path`, but they all seem to work just fine with `pathlib.Path` objects. I?ve tried: * `os.path.join` * `os.fspath` * `os.path.commonpath` * `os.path.dirname` * `os.path.isdir` Running PyPy 3 provided by Fedora 31. From issues-reply at bitbucket.org Sat Nov 23 02:43:52 2019 From: issues-reply at bitbucket.org (mattip) Date: Sat, 23 Nov 2019 07:43:52 +0000 (UTC) Subject: [pypy-issue] Issue #3122: requests tests hang (pypy/pypy) Message-ID: <20191123074351.23341.95642@celery-worker-112.ash1.bb-inf.net> New issue 3122: requests tests hang https://bitbucket.org/pypy/pypy/issues/3122/requests-tests-hang mattip: [https://github.com/psf/requests/pull/5193](https://github.com/psf/requests/pull/5193) Steps to reproduce: * clone requests * `cd requests` * activate a pypy3 virtualenv or otherwise put the pypy3 bin path so pip and python are correct * `make init` to pip install dependencies * modify `tests/testserver/server.py` and put a print statement in `_close_server_sock_ignore_errors` to see when the server socket is closed * modify `readinto` in lib-python/3/socket.py around the call to `self._sock.recv_into` to see that it is called but never returns * run ` -mpytest tests/test_lowlevel.py -k test_use_proxy_from_environment -s` The test will call `readinto`, then close the server-side socket before writing. On CPython closing the socket makes `readinto` error out, on PyPy it hangs. ? From issues-reply at bitbucket.org Thu Nov 28 09:42:24 2019 From: issues-reply at bitbucket.org (Antonio Cuni) Date: Thu, 28 Nov 2019 14:42:24 +0000 (UTC) Subject: [pypy-issue] Issue #3123: pypy3 prompt freezes when typing non-ascii chars with `LANG=` (pypy/pypy) Message-ID: <20191128144224.5281.12280@celery-worker-112.ash1.bb-inf.net> New issue 3123: pypy3 prompt freezes when typing non-ascii chars with `LANG=` https://bitbucket.org/pypy/pypy/issues/3123/pypy3-prompt-freezes-when-typing-non-ascii Antonio Cuni: To reproduce: ``` $ LANG= pypy3 Python 3.6.9 (5da45ced70e5, Oct 09 2019, 19:12:54) [PyPy 7.2.0 with GCC 6.2.0 20160901] on linux Type "help", "copyright", "credits" or "license" for more information. >>>> ``` If I press `?`, the prompt freezes, and `CTRL-C` doesn?t work. The only way to exit is to `kill` it. Interestingly with `pypy` I get a different behavior, which might be related or not: ``` $ LANG= pypy -E Python 2.7.13 (4a68d8d3d2fc, Oct 10 2019, 06:43:13) [PyPy 7.2.0 with GCC 6.2.0 20160901] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128) UnicodeDecodeError: 'ascii' codec can't decode byte 0xa0 in position 0: ordinal not in range(128) ``` ? From issues-reply at bitbucket.org Thu Nov 28 10:00:34 2019 From: issues-reply at bitbucket.org (Antonio Cuni) Date: Thu, 28 Nov 2019 15:00:34 +0000 (UTC) Subject: [pypy-issue] Issue #3124: pypy3 fails to print non-ascii characters with `LANG=` (pypy/pypy) Message-ID: <20191128150034.15366.51337@celery-worker-109.ash1.bb-inf.net> New issue 3124: pypy3 fails to print non-ascii characters with `LANG=` https://bitbucket.org/pypy/pypy/issues/3124/pypy3-fails-to-print-non-ascii-characters Antonio Cuni: `bug.py` ```python #-*- encoding: utf-8 -*- import sys sys.stdout.write('hell?\n') ``` ``` $ LANG= python3 /tmp/bug.py hell? $ LANG= pypy3 -E /tmp/bug.py Traceback (most recent call last): File "/tmp/bug.py", line 4, in sys.stdout.write('hell\xf2\n') File "/home/antocuni/pypy/release/py3k/latest/lib-python/3/encodings/ascii.py", line 22, in encode return codecs.ascii_encode(input, self.errors)[0] UnicodeEncodeError: 'ascii' codec can't encode character '\xf2' in position 4: ordinal not in range(128) ``` \(PyPy3 7.2.0, CPython 3.7\)