Submitter | Maciej Fijalkowski |
---|---|
Date | March 30, 2016, 7:54 p.m. |
Message ID | <84be092f005838068239.1459367683@brick.arcode.com> |
Download | mbox | patch |
Permalink | /patch/14194/ |
State | Accepted |
Delegated to: | Pierre-Yves David |
Headers | show |
Comments
On 03/30/2016 12:54 PM, Maciej Fijalkowski wrote: > # HG changeset patch > # User Maciej Fijalkowski <fijall@gmail.com> > # Date 1459367666 -7200 > # Wed Mar 30 21:54:26 2016 +0200 > # Node ID 84be092f00583806823976cd1334730d89936223 > # Parent ff0d3b6b287f89594bd8d0308fe2810d2a18ea01 > tests: fix builtin module test on pypy > > On pypy datetime and cProfile are modules written in Python, not in C. > For the purpose of this test, just list them explicitely as builtins, > which silences warnings about them being imported before stdlib modules. Where should I look to see a test fixed by that? I might be missing something but I cannot see a test turning green with pypy after applying this patch.
Maciej Fijalkowski wrote: >> For the purpose of this test, just list them explicitely as builtins, explicitly in English... Pierre-Yves David wrote: > Where should I look to see a test fixed by that? I might be missing > something but I cannot see a test turning green with pypy after applying > this patch. I just sent [PATCH 3 of 3] tests: add pypy output for module-imports which would change if this patch was accepted. I'd really prefer for someone to review: http://patchwork.serpentine.com/patch/14185/ instead, we can build on that to get rid of this magic and have a standard list of standard libraries instead of having each python try to calculate its own.
On Wed, 30 Mar 2016 21:54:43 +0200, Maciej Fijalkowski wrote: > # HG changeset patch > # User Maciej Fijalkowski <fijall@gmail.com> > # Date 1459367666 -7200 > # Wed Mar 30 21:54:26 2016 +0200 > # Node ID 84be092f00583806823976cd1334730d89936223 > # Parent ff0d3b6b287f89594bd8d0308fe2810d2a18ea01 > tests: fix builtin module test on pypy > > On pypy datetime and cProfile are modules written in Python, not in C. > For the purpose of this test, just list them explicitely as builtins, > which silences warnings about them being imported before stdlib modules. > > diff -r ff0d3b6b287f -r 84be092f0058 contrib/import-checker.py > --- a/contrib/import-checker.py Tue Mar 29 12:29:00 2016 -0500 > +++ b/contrib/import-checker.py Wed Mar 30 21:54:26 2016 +0200 > @@ -182,6 +182,8 @@ > yield 'builtins' # python3 only > for m in 'fcntl', 'grp', 'pwd', 'termios': # Unix only > yield m > + for m in 'cPickle', 'datetime': # in Python (not C) on PyPy > + yield m It shouldn't be matter whether the module is written in C or Python. I suspect that the lib_pypy directory isn't looked up.
On Thu, Mar 31, 2016 at 2:50 PM, Yuya Nishihara <yuya@tcha.org> wrote: > On Wed, 30 Mar 2016 21:54:43 +0200, Maciej Fijalkowski wrote: >> # HG changeset patch >> # User Maciej Fijalkowski <fijall@gmail.com> >> # Date 1459367666 -7200 >> # Wed Mar 30 21:54:26 2016 +0200 >> # Node ID 84be092f00583806823976cd1334730d89936223 >> # Parent ff0d3b6b287f89594bd8d0308fe2810d2a18ea01 >> tests: fix builtin module test on pypy >> >> On pypy datetime and cProfile are modules written in Python, not in C. >> For the purpose of this test, just list them explicitely as builtins, >> which silences warnings about them being imported before stdlib modules. >> >> diff -r ff0d3b6b287f -r 84be092f0058 contrib/import-checker.py >> --- a/contrib/import-checker.py Tue Mar 29 12:29:00 2016 -0500 >> +++ b/contrib/import-checker.py Wed Mar 30 21:54:26 2016 +0200 >> @@ -182,6 +182,8 @@ >> yield 'builtins' # python3 only >> for m in 'fcntl', 'grp', 'pwd', 'termios': # Unix only >> yield m >> + for m in 'cPickle', 'datetime': # in Python (not C) on PyPy >> + yield m > > It shouldn't be matter whether the module is written in C or Python. > I suspect that the lib_pypy directory isn't looked up. Yes, it is the lib_pypy (which contains modules that pypy implemented in python instead of C). It fixes test-check-modules-import on pypy under virtualenv
Patch
diff -r ff0d3b6b287f -r 84be092f0058 contrib/import-checker.py --- a/contrib/import-checker.py Tue Mar 29 12:29:00 2016 -0500 +++ b/contrib/import-checker.py Wed Mar 30 21:54:26 2016 +0200 @@ -182,6 +182,8 @@ yield 'builtins' # python3 only for m in 'fcntl', 'grp', 'pwd', 'termios': # Unix only yield m + for m in 'cPickle', 'datetime': # in Python (not C) on PyPy + yield m stdlib_prefixes = set([sys.prefix, sys.exec_prefix]) # We need to supplement the list of prefixes for the search to work # when run from within a virtualenv.