From issues-reply at bitbucket.org Thu Feb 1 15:03:39 2018 From: issues-reply at bitbucket.org (Jason Madden) Date: Thu, 01 Feb 2018 20:03:39 +0000 (UTC) Subject: [pypy-issue] Issue #2745: cpyext: exceptions in greenlets running cython kill the process (pypy/pypy) Message-ID: <20180201200338.12313.25533@celery-worker-105.ash1.bb-inf.net> New issue 2745: cpyext: exceptions in greenlets running cython kill the process https://bitbucket.org/pypy/pypy/issues/2745/cpyext-exceptions-in-greenlets-running Jason Madden: This is on macOS 10.13.3 running pypy2-5.10.0 as downloaded from pypy.org and pypy2-5.9.0 as downloaded from pypy.org, gevent 1.2.2 and master, and Cython 0.25.2, 0.27.3 and 0.28a (master). There are a few variations on this. First, the python code: ```python import sys import gevent print(gevent.__version__) from gevent.resolver_ares import Resolver resolver = Resolver() greenlet = gevent.spawn(resolver.gethostbyname, 'foo not found 2') gevent.sleep(1) # if this line is omitted, no crash occurs greenlet.join() ``` We spawn a greenlet that will use the ares extension compiled with cython to look up a name, and we expect that name to raise `socket.gaierror`. gevent's error handling will catch this uncaught error and print it. Here's what happens with PyPy2 5.10 when compiled with either Cython 0.27.3 or 0.28a (current master) (gevent 1.3): ``` $ python --version Python 2.7.13 (0e7ea4fe15e8, Dec 22 2017, 08:44:21) [PyPy 5.10.0 with GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] $ python /tmp/crash.py 1.3.0.dev0 Traceback (most recent call last): File "//src/gevent/greenlet.py", line 537, in run result = self._run(*self.args, **self.kwargs) File "//src/gevent/resolver/ares.py", line 118, in gethostbyname return self.gethostbyname_ex(hostname, family)[-1][0] File "//src/gevent/resolver/ares.py", line 137, in gethostbyname_ex result = waiter.get() File "//src/gevent/hub.py", line 931, in get return self.hub.switch() File "//src/gevent/hub.py", line 648, in switch return RawGreenlet.switch(self) File "//bin/pypy/lib_pypy/greenlet.py", line 53, in switch return self.__switch('switch', (args, kwds)) File "//bin/pypy/lib_pypy/greenlet.py", line 92, in __switch args, kwds = unbound_method(current, *baseargs, to=target) gaierror: [Errno 4] ARES_ENOTFOUND: Domain name not found Thu Feb 1 13:41:48 2018 Error in cpyext, CPython compatibility layer: The function PyThreadState_Get was not supposed to fail Fatal error in cpyext, CPython compatibility layer, calling PyThreadState_Get Either report a bug or consider not using this particular extension RPython traceback: File "pypy_module_cpyext_1.c", line 14805, in wrapper_second_level__star_0_14 File "pypy_module_cpyext_1.c", line 35718, in not_supposed_to_fail Segmentation fault: 11 ``` If the code was compiled with Cython 0.25.2, like the released gevent 1.2.2, running `python /tmp/crash.py` *does not crash*. But running it interactively at the console does, and without the need to `gevent.sleep`: ``` $ python Python 2.7.13 (0e7ea4fe15e8, Dec 22 2017, 08:44:21) [PyPy 5.10.0 with GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>>> import gevent >>>> print(gevent.__version__) 1.2.2 None >>>> from gevent.resolver_ares import Resolver >>>> resolver = Resolver() >>>> greenlet = gevent.spawn(resolver.gethostbyname, 'foo not found 2') >>>> greenlet.join() Traceback (most recent call last): File "//VirtualEnvs/tmp-3646e066322dd8ec/site-packages/gevent/greenlet.py", line 536, in run result = self._run(*self.args, **self.kwargs) File "//VirtualEnvs/tmp-3646e066322dd8ec/site-packages/gevent/resolver_ares.py", line 98, in gethostbyname return self.gethostbyname_ex(hostname, family)[-1][0] File "//VirtualEnvs/tmp-3646e066322dd8ec/site-packages/gevent/resolver_ares.py", line 117, in gethostbyname_ex result = waiter.get() File "//VirtualEnvs/tmp-3646e066322dd8ec/site-packages/gevent/hub.py", line 898, in get return self.hub.switch() File "//VirtualEnvs/tmp-3646e066322dd8ec/site-packages/gevent/hub.py", line 630, in switch return RawGreenlet.switch(self) File "//bin/pypy/lib_pypy/greenlet.py", line 53, in switch return self.__switch('switch', (args, kwds)) File "/bin/pypy/lib_pypy/greenlet.py", line 92, in __switch args, kwds = unbound_method(current, *baseargs, to=target) gaierror: [Errno 4] ARES_ENOTFOUND: Domain name not found Thu Feb 1 13:49:58 2018 Fatal error in cpyext, CPython compatibility layer, calling PyString_FromString Either report a bug or consider not using this particular extension RPython traceback: File "pypy_module_cpyext.c", line 12855, in wrapper_second_level__star_1_10 File "pypy_module_cpyext_1.c", line 36771, in make_ref__StdObjSpaceConst_SomeInstance_NoneCons File "pypy_module_cpyext_2.c", line 4241, in create_ref File "pypy_module_cpyext_4.c", line 351, in bytes_attach File "pypy_objspace.c", line 2788, in hash File "pypy_interpreter.c", line 38981, in BuiltinCode1_fastcall_1 File "rpython_rlib.c", line 9723, in stack_check_slowpath Segmentation fault: 11 ``` pypy2-5.9 crashes with substantially the same stack trace. -X faulthandler doesn't add any additional information: ``` Stack (most recent call first, approximate line numbers): File "/VirtualEnvs/tmp-189eafb7c968f1f6/site-packages/gevent/libev/corecffi.py", line 774 in __repr__ File "//VirtualEnvs/tmp-189eafb7c968f1f6/site-packages/gevent/libev/corecffi.py", line 774 in __repr__ File "//VirtualEnvs/tmp-189eafb7c968f1f6/site-packages/gevent/libev/corecffi.py", line 774 in __repr__ File "//VirtualEnvs/tmp-189eafb7c968f1f6/site-packages/gevent/libev/corecffi.py", line 774 in __repr__ ... ``` I consider this minor since gevent doesn't encourage the use of the Cython ares extension, it just came up during some benchmarking (https://github.com/gevent/gevent/pull/1088). I just wanted to let you know of a reproducible test case for a crash (I'm sorry I don't have anything simpler!). Let me know if I can be of any help. From issues-reply at bitbucket.org Sun Feb 4 13:00:31 2018 From: issues-reply at bitbucket.org (Luigi Bardelli) Date: Sun, 04 Feb 2018 18:00:31 +0000 (UTC) Subject: [pypy-issue] Issue #2746: Flask not working on windows (pypy/pypy) Message-ID: <20180204180030.7233.67850@celery-worker-105.ash1.bb-inf.net> New issue 2746: Flask not working on windows https://bitbucket.org/pypy/pypy/issues/2746/flask-not-working-on-windows Luigi Bardelli: Hi, newbie here :| After developing some code on Linux I am trying moving it to windows, and I get an error with Flask. I am using windows10 64bit, pypy3-v5.10.1-win32 , with pip installed via get-pip.py , and a standard pip install flask. On the same machine, the same code works fine on python 3.6.4 32bit. I have reduced the file to the minimal sample in attachment. The error I get is: ``` #!text Traceback (most recent call last): File "test_flask2.py", line 1, in from flask import Flask \pypy3-v5.10.1-win32\site-packages\flask\__init__.py", line 19, in from jinja2 import Markup, escape \pypy3-v5.10.1-win32\site-packages\jinja2\__init__.py", line 33, in from jinja2.environment import Environment, Template \pypy3-v5.10.1-win32\site-packages\jinja2\environment.py", line 22, in from jinja2.lexer import get_lexer, TokenStream \pypy3-v5.10.1-win32\site-packages\jinja2\lexer.py", line 46, in name_re = re.compile(r'[\w{0}]+'.format(_identifier.pattern)) \pypy3-v5.10.1-win32\lib-python\3\re.py", line 224, in compile return _compile(pattern, flags) \pypy3-v5.10.1-win32\lib-python\3\re.py", line 293, in _compile p = sre_compile.compile(pattern, flags) \pypy3-v5.10.1-win32\lib-python\3\sre_compile.py", line 540, in compile p = sre_parse.parse(p, flags) \pypy3-v5.10.1-win32\lib-python\3\sre_parse.py", line 829, in parse p = _parse_sub(source, pattern, 0) \pypy3-v5.10.1-win32\lib-python\3\sre_parse.py", line 437, in _parse_sub itemsappend(_parse(source, state)) \pypy3-v5.10.1-win32\lib-python\3\sre_parse.py", line 575, in _parse raise source.error(msg, len(this) + 1 + len(that)) sre_constants.error: bad character range \udf76-\ud800 at position 459 ``` Do you have any idea? Thanks! From issues-reply at bitbucket.org Mon Feb 5 07:25:32 2018 From: issues-reply at bitbucket.org (Thomas) Date: Mon, 05 Feb 2018 12:25:32 +0000 (UTC) Subject: [pypy-issue] Issue #2747: h5py build fails due to unrecognized command line option "-R" (pypy/pypy) Message-ID: <20180205122531.32988.97620@celery-worker-109.ash1.bb-inf.net> New issue 2747: h5py build fails due to unrecognized command line option "-R" https://bitbucket.org/pypy/pypy/issues/2747/h5py-build-fails-due-to-unrecognized Thomas: Using pypy3.5 on Linux: ``` #!bash pip3 install h5py ``` fails with error ``` #!bash cc: error: unrecognized command line option "-R" ``` IMHO, -R is not a valid option in gcc. Instead -Wl,-rpath, should be used. From issues-reply at bitbucket.org Mon Feb 5 07:43:04 2018 From: issues-reply at bitbucket.org (Ruud van der Ham) Date: Mon, 05 Feb 2018 12:43:04 +0000 (UTC) Subject: [pypy-issue] Issue #2748: Installing Numpy under PyPy 3.5 (Windows 10) (pypy/pypy) Message-ID: <20180205124304.38036.22332@celery-worker-106.ash1.bb-inf.net> New issue 2748: Installing Numpy under PyPy 3.5 (Windows 10) https://bitbucket.org/pypy/pypy/issues/2748/installing-numpy-under-pypy-35-windows-10 Ruud van der Ham: I am trying to install numpy under PyPy 3.5 on Windows 10 with ``` pypy3 -m pip install numpy. ``` It will start installing but ends with an error message (see screenshot below). I can't work out what's wrong. Please help. From issues-reply at bitbucket.org Mon Feb 5 20:37:46 2018 From: issues-reply at bitbucket.org (Shrestha Goswami) Date: Tue, 06 Feb 2018 01:37:46 +0000 (UTC) Subject: [pypy-issue] Issue #2749: Trouble installing pandas and gcloud for pyrebase libraries to pypy on Windows, PyPy 2.7 (pypy/pypy) Message-ID: <20180206013746.29559.93898@celery-worker-109.ash1.bb-inf.net> New issue 2749: Trouble installing pandas and gcloud for pyrebase libraries to pypy on Windows, PyPy 2.7 https://bitbucket.org/pypy/pypy/issues/2749/trouble-installing-pandas-and-gcloud-for Shrestha Goswami: I need to use these two libraries to run my script. I sucessfully managed to install numpy and dateutil for pypy however, I always come across errors when try to get pandas and gcloud installed using either pypy -m pip install pandas or downloading the source code and doing a pypy setup.py install in command prompt. The exact version of pypy used is pypy2-v5.10.0-win32 which I checked is compatible with pandas. The error is: pandas/_libs/src/parser/io.c(97) : error C2065: 'ssize_t' : undeclared identifier pandas/_libs/src/parser/io.c(97) : error C2146: syntax error : missing ';' before identifier 'rv' pandas/_libs/src/parser/io.c(97) : error C2065: 'rv' : undeclared identifier pandas/_libs/src/parser/io.c(103) : error C2065: 'rv' : undeclared identifier pandas/_libs/src/parser/io.c(104) : error C2065: 'rv' : undeclared pandas/_libs/src/parser/io.c(115) : error C2065: 'rv' : undeclared identifier pandas/_libs/src/parser/io.c(116) : error C2065: 'rv' : undeclared identifier error: command 'C:\\Users\\Shrestha\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2 I am also thrown with warnings such as : warning C4244: '=' : conversion from 'int64_t' to 'size_t', possible loss of data My Anti virus gives the message, we have moved groupby.pypy-41.pyd to virus chest because it was infected with Win32:Evo-gen [Susp] I am having issues in installing gcloud as well. Error: Setup script exited with error: command 'C:\\Users\\Shrestha\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2 From issues-reply at bitbucket.org Wed Feb 7 09:17:32 2018 From: issues-reply at bitbucket.org (Christoph Reiter) Date: Wed, 07 Feb 2018 14:17:32 +0000 (UTC) Subject: [pypy-issue] Issue #2750: array resize through slice assignment slow (pypy/pypy) Message-ID: <20180207141732.26748.84708@celery-worker-106.ash1.bb-inf.net> New issue 2750: array resize through slice assignment slow https://bitbucket.org/pypy/pypy/issues/2750/array-resize-through-slice-assignment-slow Christoph Reiter: ``` #!python import array def x(n): data = array.array('B') for i in range(n): data[i:i+1] = array.array("B", [0]) x(20000) ``` With CPython the time per assignment with increasing "n" stays constant, while in PyPy it increases with "n". There is no real use case behind this, as I can easily preallocate the array which makes things work. I just noticed that one of my test cases got stuck under pypy because it resized an array 100000 times, and with CPython this was near instant. From issues-reply at bitbucket.org Wed Feb 7 09:33:03 2018 From: issues-reply at bitbucket.org (Christoph Reiter) Date: Wed, 07 Feb 2018 14:33:03 +0000 (UTC) Subject: [pypy-issue] Issue #2751: cpyext: PyObject_AsWriteBuffer() does not work with array.array() (pypy/pypy) Message-ID: <20180207143303.33622.6529@celery-worker-109.ash1.bb-inf.net> New issue 2751: cpyext: PyObject_AsWriteBuffer() does not work with array.array() https://bitbucket.org/pypy/pypy/issues/2751/cpyext-pyobject_aswritebuffer-does-not Christoph Reiter: In Python: ``` #!python data = array.array('B', [0]) ``` passing this to the following C code: ``` #!C ... unsigned char *buffer; Py_ssize_t buffer_len; PyObject *obj; if (!PyArg_ParseTuple (args, "O", &obj)) return NULL; res = PyObject_AsWriteBuffer (obj, (void **)&buffer, &buffer_len); if (res == -1) return NULL; ... ``` fails with "TypeError: expected a writeable buffer object" while it succeeds with CPython. From issues-reply at bitbucket.org Mon Feb 12 15:06:16 2018 From: issues-reply at bitbucket.org (=?utf-8?b?TWljaGHFgiBHw7Nybnk=?=) Date: Mon, 12 Feb 2018 20:06:16 +0000 (UTC) Subject: [pypy-issue] Issue #2752: Incorrect results of intensive read() results passing to cpyext (pypy/pypy) Message-ID: <20180212200606.21944.18109@celery-worker-106.ash1.bb-inf.net> New issue 2752: Incorrect results of intensive read() results passing to cpyext https://bitbucket.org/pypy/pypy/issues/2752/incorrect-results-of-intensive-read Micha? G?rny: I've noticed that my program that hashes intensively using [pyblake2](https://github.com/dchest/pyblake2) extension starts giving wrong results at some point. I haven't been able to establish what is the exact cause but I've been able to create a [test case](https://github.com/mgorny/pypy-blake2-testcase) that easily reproduces the problem. The exact code is: ``` #!python import io import pyblake2 bufsize = 4096 sum = 'ccefcd101b08863339602f7fdf2edd1d77ef05a970c36dbd7a560d33f957f81b15cfcac10114f8fca0d7c318b6aaa294220e3fcf4f88e6e3bd7840f121ff3b65' def sub(i): cs = pyblake2.blake2b() with io.open('test.txt', 'rb') as f: for block in iter(lambda: f.read(bufsize), b''): cs.update(block) assert cs.hexdigest() == sum, i for x in map(sub, range(10000)): pass ``` With this test case, PyPy reliably fails (generates incorrect checksum) at iteration 94. Few observations based on testing: 1. The issue affects PyPy2 only. PyPy3 and CPython work fine. 2. I can reproduce a similar problem with pyblake2, pysha3 but not e.g. pycryptodome (which is also C extension) or builtin hash functions. 3. Some random changes to code (e.g. replacing io.open() with open()) cause the failing iteration no to change. 4. If instead of the loop, I do a single `f.read()`, I wasn't able to get it to fail (even with increased iteration count). 5. If I do `f.read()` without argument in a loop, it fails at iteration 852. 6. Changing `bufsize` and iteration count also changes the result, with no clear correlation. E.g. with bufsize of 506000 and 10000 iterations, it doesn't fail. With 100000 iterations, it fails at iteration 1488... In other words, I really have no clue what might be happening here. I'm attaching the test script and file for completeness. From issues-reply at bitbucket.org Tue Feb 13 07:32:45 2018 From: issues-reply at bitbucket.org (leminaw@gmail.com) Date: Tue, 13 Feb 2018 12:32:45 +0000 (UTC) Subject: [pypy-issue] Issue #2753: UnicodeDecodeError when __pycache__ is present (pypy/pypy) Message-ID: <20180213123244.34174.61483@celery-worker-107.ash1.bb-inf.net> New issue 2753: UnicodeDecodeError when __pycache__ is present https://bitbucket.org/pypy/pypy/issues/2753/unicodedecodeerror-when-__pycache__-is leminaw at gmail.com: When the `__pycache__` folder is present, any module I try to import from the current folder raises an `UnicodeDecodeError`. ``` File ".\bifurcations.py", line 4, in from utils import replace_patterns, lin_interp UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 12: invalid continuation ``` In this exemple, if I remove `utils.pypy3-510.pyc` bytescode file from the `__pycache__`, everything runs smoothly. This problem does not occurs when using CPython. I currently run pypy on Windows 10, with the folder containing pypy3 in my `PATH` env var, so i do `pypy3 .\bifurcations.py` I'm not sure of what file or information join to this. Am I doing anything wrong? From issues-reply at bitbucket.org Wed Feb 14 06:06:26 2018 From: issues-reply at bitbucket.org (Stuart Axon) Date: Wed, 14 Feb 2018 11:06:26 +0000 (UTC) Subject: [pypy-issue] Issue #2754: "Tuples differ" for two tuples created by CPython API (pypy/pypy) Message-ID: <20180214110626.36552.72153@celery-worker-106.ash1.bb-inf.net> New issue 2754: "Tuples differ" for two tuples created by CPython API https://bitbucket.org/pypy/pypy/issues/2754/tuples-differ-for-two-tuples-created-by Stuart Axon: pygame has added pypy to travis Some tests are failing with "Tuples differ" with seemingly identical tuples Failing test https://travis-ci.org/pygame/pygame/jobs/340833048#L2344 Source https://github.com/pygame/pygame/blob/master/test/surflock_test.py#L125 This is two tuples with identical (zeros), seemingly created here https://github.com/pygame/pygame/blob/6838ad67bdd2bd87931daf7b84af6a4f4d24e7f9/src/surface.c#L850 From issues-reply at bitbucket.org Mon Feb 19 11:30:04 2018 From: issues-reply at bitbucket.org (Josh Friend) Date: Mon, 19 Feb 2018 16:30:04 +0000 (UTC) Subject: [pypy-issue] Issue #2755: dbm.open() expects a str for filename, throws TypeError if passed a unicode filename (pypy/pypy) Message-ID: <20180219163004.30757.81291@celery-worker-108.ash1.bb-inf.net> New issue 2755: dbm.open() expects a str for filename, throws TypeError if passed a unicode filename https://bitbucket.org/pypy/pypy/issues/2755/dbmopen-expects-a-str-for-filename-throws Josh Friend: https://bitbucket.org/pypy/pypy/src/3f6eaa010fce78cc7973bdc1dfdb95970f08fed2/lib_pypy/_dbm.py?at=release-pypy3.5-v5.10.1&fileviewer=file-view-default#_dbm.py-170 I ran into this when [using celery v4 with pypy2-5.8.0](https://github.com/celery/celery/issues/4533). Celery tries to access the `celerybeat-schedule` file using a unicode filename, which is rejected by pypy's implementation of `dbm` because `isinstance(u'something', str)` is false in python2. Unicode filenames are accepted by the `dbm` module in CPython. From issues-reply at bitbucket.org Wed Feb 21 21:00:01 2018 From: issues-reply at bitbucket.org (Andrew Brown) Date: Thu, 22 Feb 2018 02:00:01 +0000 (UTC) Subject: [pypy-issue] Issue #2756: hashlib functions segfault when passed a BytesIO buffer (pypy/pypy) Message-ID: <20180222020001.39471.96049@celery-worker-107.ash1.bb-inf.net> New issue 2756: hashlib functions segfault when passed a BytesIO buffer https://bitbucket.org/pypy/pypy/issues/2756/hashlib-functions-segfault-when-passed-a Andrew Brown: If you pass a BytesIO buffer to the hashlib.* functions, this causes PyPy to segfault. I'm running this on Linux using Python 3 on PyPy 5.10.1 ``` Python 3.5.3 (3f6eaa010fce, Jan 11 2018, 04:44:35) [PyPy 5.10.1 with GCC 6.2.0 20160901] on linux ``` Code to reproduce: ``` import io import hashlib a = io.BytesIO(b"Hello, world!") buf = a.getbuffer() h = hashlib.sha256(buf) ``` I've also reproduced this with `--jit off` but I haven't yet tried with a debug build or anything else; I'm not very experienced with debugging PyPy. From issues-reply at bitbucket.org Fri Feb 23 05:54:23 2018 From: issues-reply at bitbucket.org (Wonderless) Date: Fri, 23 Feb 2018 10:54:23 +0000 (UTC) Subject: [pypy-issue] Issue #2757: Can't import asyncio on Windows, ImportError: cannot import name '_overlapped' (pypy/pypy) Message-ID: <20180223105423.13055.78895@celery-worker-105.ash1.bb-inf.net> New issue 2757: Can't import asyncio on Windows, ImportError: cannot import name '_overlapped' https://bitbucket.org/pypy/pypy/issues/2757/cant-import-asyncio-on-windows-importerror Wonderless: Took [Windows binary](https://bitbucket.org/pypy/pypy/downloads/pypy3-v5.10.1-win32.zip) from the download page, didn't change anything, plain `import asyncio` fails. ``` Python 3.5.3 (3f6eaa010fce, Jan 11 2018, 04:46:12) [PyPy 5.10.1 with MSC v.1500 32 bit] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>> import asyncio Traceback (most recent call last): File "t:\pypy3-v5.10.1-win32\lib-python\3\asyncio\__init__.py", line 16, in from . import _overlapped ImportError: cannot import name '_overlapped' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 1, in File "t:\pypy3-v5.10.1-win32\lib-python\3\asyncio\__init__.py", line 18, in import _overlapped # Will also be exported. ImportError: No module named '_overlapped' ``` From issues-reply at bitbucket.org Sat Feb 24 02:38:33 2018 From: issues-reply at bitbucket.org (Joseph Joseph) Date: Sat, 24 Feb 2018 07:38:33 +0000 (UTC) Subject: [pypy-issue] Issue #2758: strange behavior in re.sub (pypy/pypy) Message-ID: <20180224073832.30962.120@celery-worker-105.ash1.bb-inf.net> New issue 2758: strange behavior in re.sub https://bitbucket.org/pypy/pypy/issues/2758/strange-behavior-in-resub Joseph Joseph: ### Environment ### ``` Python 2.7.13 (84a2f3e6a7f88f2fe698e473998755b3bd1a12e2, Oct 05 2017, 16:31:59) [PyPy 5.9.0 with GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin ``` Given the following code: ``` #!python import re class Proxy: def __init__(self): self.matches = [] def repl(self, match): self.matches.append(match) return "" def main(): pat = "\$\{(\w*)\}" value = "the name is ${joseph}, the name is ${alice}" proxy = Proxy() compiled_pat = re.compile(pat) compiled_pat.sub(proxy.repl, value) for match in proxy.matches: print(match.groups()) if __name__ == "__main__": main() ``` The result of execution is: ``` (None,) (None,) ``` The expected result is: ``` ('joseph',) ('alice',) ``` But if we changed a little bit in Proxy.repl as following, the result will be correct. ``` #!python class Proxy: def __init__(self): self.matches = [] def repl(self, match): self.matches.append(match) print match.groups() . # <----------- added this line return "" ``` this bug also exists in ``` Python 3.5.3 (d72f9800a42b46a8056951b1da2426d2c2d8d502, Oct 07 2017, 08:21:37) [PyPy 5.9.0-beta0 with GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin ``` From issues-reply at bitbucket.org Sat Feb 24 10:38:24 2018 From: issues-reply at bitbucket.org (AmgicServer) Date: Sat, 24 Feb 2018 15:38:24 +0000 (UTC) Subject: [pypy-issue] Issue #2759: os.makedirs behaviour differs from cPython (pypy/pypy) Message-ID: <20180224153823.8830.95778@celery-worker-110.ash1.bb-inf.net> New issue 2759: os.makedirs behaviour differs from cPython https://bitbucket.org/pypy/pypy/issues/2759/osmakedirs-behaviour-differs-from-cpython AmgicServer: ``` $ chmod 777 /tmp/mydir $ pypy3 -c "import os; os.makedirs('/tmp/mydir', exist_ok=True)" Traceback (most recent call last): File "", line 1, in File "/usr/lib64/pypy3-5.5.0/lib-python/3/os.py", line 269, in makedirs mkdir(name, mode) FileExistsError: [Errno 17] File exists (mode 777 != expected mode 755): '/tmp/mydir' $ pypy3 --version Python 3.3.5 (19b4b275ee9c, Aug 04 2017, 13:10:56) [PyPy 5.5.0-alpha0 with GCC 7.1.1 20170718 (Red Hat 7.1.1-6)] $ python3 -c "import os; os.makedirs('/tmp/mydir', exist_ok=True)" $ python3 --version Python 3.5.2 ``` On the cPython documentation there is a relevant note about this: https://docs.python.org/3/library/os.html#os.makedirs From issues-reply at bitbucket.org Sun Feb 25 10:37:50 2018 From: issues-reply at bitbucket.org (pv) Date: Sun, 25 Feb 2018 15:37:50 +0000 (UTC) Subject: [pypy-issue] Issue #2760: getattr lookup difference in numpy/cpyext (pypy/pypy) Message-ID: <20180225153750.16845.34659@celery-worker-109.ash1.bb-inf.net> New issue 2760: getattr lookup difference in numpy/cpyext https://bitbucket.org/pypy/pypy/issues/2760/getattr-lookup-difference-in-numpy-cpyext pv: Consider the following code: ``` import numpy as np class Passthrough(object): def __init__(self, data): self.data = data def __getattr__(self, name): print("GETATTR:", name) return getattr(self.data, name) x = Passthrough(np.array([1])) print("GOT:", np.array(x)) ``` On CPython this prints ``` GETATTR: __array_struct__ GOT: [1] ``` On pypy3-5.10.1 and pypy2-5.10.0 it prints ``` GOT: <__main__.Passthrough object at 0x0000000001776aa0> ``` The relevant Numpy code where it tries to look up the attribute is here: [PyArray_LookupSpecial_OnInstance](https://github.com/numpy/numpy/blob/1ee1a4ac7f79e8c707c416f81f049fd3ac94f1e6/numpy/core/src/private/get_attr_string.h#L119), [PyArray_FromStructInterface](https://github.com/numpy/numpy/blob/1ee1a4ac7f79e8c707c416f81f049fd3ac94f1e6/numpy/core/src/multiarray/ctors.c#L2082), [PyArray_GetArrayParamsFromObject](https://github.com/numpy/numpy/blob/1ee1a4ac7f79e8c707c416f81f049fd3ac94f1e6/numpy/core/src/multiarray/ctors.c#L1500) Looks mightily suspicious, but is it a cpyext or Numpy issue? (In other news, scipy test suite has 6 remaining failures (out of 12000+ tests) on pypy3, two of them due to the above.) From issues-reply at bitbucket.org Sun Feb 25 11:24:24 2018 From: issues-reply at bitbucket.org (pv) Date: Sun, 25 Feb 2018 16:24:24 +0000 (UTC) Subject: [pypy-issue] Issue #2761: Bad user site directory for Pypy3 (pypy/pypy) Message-ID: <20180225162424.34303.56777@celery-worker-106.ash1.bb-inf.net> New issue 2761: Bad user site directory for Pypy3 https://bitbucket.org/pypy/pypy/issues/2761/bad-user-site-directory-for-pypy3 pv: On pypy3-5.10.1: ``` >>> import site; print(site.USER_SITE) /home/pauli/.local/lib/python3.5/site-packages ``` which is the same directory as what CPython uses, which causes clashes with binary extensions etc. Whereas, pypy2-5.10.0 says ``` /home/pauli/.local/lib/pypy2.7/site-packages ``` Pypy3 probably should follow the behavior of pypy2 and not use the same user site-packages directory as CPython? The same issue was reported against pypy2 in #1846 and fixed in commit fbb5b4cefb37ea859eccd0f715101a6c8c57e32f From issues-reply at bitbucket.org Sun Feb 25 14:46:48 2018 From: issues-reply at bitbucket.org (Davide Depau) Date: Sun, 25 Feb 2018 19:46:48 +0000 (UTC) Subject: [pypy-issue] Issue #2762: [Question] Pillow builds but can't be imported on PyPy on ARM (pypy/pypy) Message-ID: <20180225194647.32904.75292@celery-worker-109.ash1.bb-inf.net> New issue 2762: [Question] Pillow builds but can't be imported on PyPy on ARM https://bitbucket.org/pypy/pypy/issues/2762/question-pillow-builds-but-cant-be Davide Depau: See issue for Pillow here: https://github.com/python-pillow/Pillow/issues/2850 I'm opening this issue here hoping someone with experience in PyPy's core may have a clue on what's happening under the hood. Pillow builds and works on CPython for both x86 and ARM, and on PyPy for x86. However, on PyPy on ARM it build but it can't be imported. Do you have any suggestions on how to fix this on Pillow? (unless it is a PyPy bug) From issues-reply at bitbucket.org Sun Feb 25 18:05:23 2018 From: issues-reply at bitbucket.org (pv) Date: Sun, 25 Feb 2018 23:05:23 +0000 (UTC) Subject: [pypy-issue] Issue #2763: cpyext-defined class instances always have __dict__? (pypy/pypy) Message-ID: <20180225230523.16682.27054@celery-worker-107.ash1.bb-inf.net> New issue 2763: cpyext-defined class instances always have __dict__? https://bitbucket.org/pypy/pypy/issues/2763/cpyext-defined-class-instances-always-have pv: On pypy3-5.10.1 (and pypy2-5.10.0) + numpy master: ``` >>>> import numpy as np >>>> np.float16(1.0).__dict__ {} >>>> np.add.__dict__ {} ``` On CPython: ``` >>> import numpy as np >>> np.float16(1.0).__dict__ Traceback (most recent call last): File "", line 1, in AttributeError: 'numpy.float16' object has no attribute '__dict__' >>> np.add.__dict__ Traceback (most recent call last): File "", line 1, in AttributeError: 'numpy.ufunc' object has no attribute '__dict__' ``` From issues-reply at bitbucket.org Sun Feb 25 22:10:38 2018 From: issues-reply at bitbucket.org (pv) Date: Mon, 26 Feb 2018 03:10:38 +0000 (UTC) Subject: [pypy-issue] Issue #2764: cpyext PyEval_SaveThread/PyGILState_Ensure/PyErr_SetString failure (pypy/pypy) Message-ID: <20180226031038.20360.6425@celery-worker-106.ash1.bb-inf.net> New issue 2764: cpyext PyEval_SaveThread/PyGILState_Ensure/PyErr_SetString failure https://bitbucket.org/pypy/pypy/issues/2764/cpyext-pyeval_savethread-pygilstate_ensure pv: The following construction doesn't seem to work as expected with cpyext: ``` save = PyEval_SaveThread(); ... gilsave = PyGILState_Ensure(); PyErr_SetString(PyExc_RuntimeError, "XXX"); PyGILState_Release(gilsave); ... PyEval_RestoreThread(save); assert(PyErr_Occurred()); ``` It appears that there are race conditions in this, so that another thread may end up with a spurious error status, or the assertion can fail. A test case: https://github.com/pv/cpyextcrash1/tree/020f114b5e6e1af69ab776a1265332d8d8c5ff0b It passes on CPython, but not on Pypy3-5.10.1 or pypy2-5.10.0 From issues-reply at bitbucket.org Mon Feb 26 07:25:46 2018 From: issues-reply at bitbucket.org (John Hagen) Date: Mon, 26 Feb 2018 12:25:46 +0000 (UTC) Subject: [pypy-issue] Issue #2765: Website mentions old version of PyPy3 (pypy/pypy) Message-ID: <20180226122546.35406.45667@celery-worker-109.ash1.bb-inf.net> New issue 2765: Website mentions old version of PyPy3 https://bitbucket.org/pypy/pypy/issues/2765/website-mentions-old-version-of-pypy3 John Hagen: If you browse here: https://pypy.org/features.html "PyPy implements Python 2.7.13 and 3.5.3." But then later in the same paragraph: "We also have a beta release of PyPy3 which implements Python 3.2.5." This looks like an oversight, or at least it is confusing to new users. From issues-reply at bitbucket.org Tue Feb 27 05:50:56 2018 From: issues-reply at bitbucket.org (strannik j) Date: Tue, 27 Feb 2018 10:50:56 +0000 (UTC) Subject: [pypy-issue] Issue #2766: pypy3 import psycopg2 error (pypy/pypy) Message-ID: <20180227105055.2299.72252@celery-worker-106.ash1.bb-inf.net> New issue 2766: pypy3 import psycopg2 error https://bitbucket.org/pypy/pypy/issues/2766/pypy3-import-psycopg2-error strannik j: Linux 4.13.16-2-MANJARO x86_64 (Arch based) PyPy 5.10.1 with GCC 7.3.0 (from repository) psycopg2 was installed in /opt/pypy3/site-packages/psycopg2-2.7.4-py3.5-linux-x86_64.egg with pip-pypy3: ``` #!bash sudo pip-pypy3 install psycopg2 ``` and from source ``` #!bash https://bitbucket.org/pypy/pypy/issues/new sudo pypy3 setup.py install ``` next, I'm trying to import a library: ``` #!python import psycopg2 Traceback (most recent call last): File "", line 1, in File "/opt/pypy3/site-packages/psycopg2-2.7.4-py3.5-linux-x86_64.egg/psycopg2/__init__.py", line 50, in from psycopg2._psycopg import ( # noqa ImportError: /opt/pypy3/site-packages/psycopg2-2.7.4-py3.5-linux-x86_64.egg/psycopg2/_psycopg.pypy3-510-x86_64-linux-gnu.so: undefined symbol: PyCodec_Encoder ``` From issues-reply at bitbucket.org Wed Feb 28 05:48:00 2018 From: issues-reply at bitbucket.org (Armin Rigo) Date: Wed, 28 Feb 2018 10:48:00 +0000 (UTC) Subject: [pypy-issue] Issue #2767: Docstring position in the AST (pypy/pypy) Message-ID: <20180228104800.27880.74457@celery-worker-108.ash1.bb-inf.net> New issue 2767: Docstring position in the AST https://bitbucket.org/pypy/pypy/issues/2767/docstring-position-in-the-ast Armin Rigo: Serhiy Storchaka mentioned a difference between CPython and PyPy in the AST module on python-dev, but it should be reported here as a PyPy bug: https://mail.python.org/pipermail/python-dev/2018-February/152312.html