Re: [Python-Dev] Why does STORE_MAP not take a parameter?
In a function call with named arguments the code generated doesn't follow
that pattern:
dis.dis(lambda : f(a=1,b=2,c=3))
displays:
1 0 LOAD_GLOBAL 0 (foo)
3 LOAD_CONST 1 ('a')
6 LOAD_CONST 2 (1)
9 LOAD_CONST 3 ('b')
12 LOAD_CONST 4 (2)
15 LOAD_CONST 5 ('c')
18 LOAD_CONST 6 (3)
21 CALL_FUNCTION 768
24 RETURN_VALUE
so the problem is only about inlined dicts (somewhat common but not
ubiquitous as they are in Javascript).
Andrea
On Thu, Jan 22, 2015 at 12:57 AM, Greg Ewing
wrote:
> On 01/21/2015 11:16 PM, Neil Girdhar wrote:
>
>> Why not have BUILD_MAP work like BUILD_LIST? I.e., STORE_MAP takes a
>> parameter n and adds the last n pairs of stack elements into the n-1 stack
>> element (the dictionary).
>>
>
> It probably wouldn't make much difference. Building a list is
> substantially cheaper if you have all the items on hand and can
> copy them in en masse. But adding an item to a dict entails
> quite a lot of overhead, since you need to hash the key, look
> for a free slot, etc. and this would likely swamp any gain
> from executing less bytecodes. And on the other side of the
> equation, evaluating the items one at a time requires less
> stack space, so the stack frame can be smaller.
>
> But as always, you can't be sure without measuring it, and
> this would be a good thing for someone interested to try out.
>
> --
> Greg
>
> ___
> Python-Dev mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> agriff%40tin.it
>
___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Undefined dlopen When Building Module On Android
A mobile SIG is being formed, but it doesn't have a mailing list yet, else
that would be a good place to ask this question.
On Wed Jan 21 2015 at 5:54:39 PM Guido van Rossum wrote:
> Maybe try a list focused on Android development? Few people in the Python
> core development community have any Android experience. But the issues and
> context you offer seem to be related to the Android world, not to Python.
> (dlopen is used by a lot of systems, not just Python.)
>
> On Wed, Jan 21, 2015 at 2:43 PM, Cyd Haselton wrote:
>
>> On Mon, Jan 19, 2015 at 5:23 PM, Cyd Haselton
>> wrote:
>> > On Mon, Jan 19, 2015 at 8:51 AM, Cyd Haselton
>> wrote:
>> >> Hello,
>> >> I'm struggling with a build issue on Android; I've posted to the
>> >> general python list with no result, so I'm re-posting here in hopes
>> >> that someone can help. If this is the wrong place feel free to let me
>> >> know.
>> >>
>> >> I'm attempting to build Python 2.7.8 on my Android device; I'm using
>> >> an environment that simulates a Linux filesystem within the Android
>> >> terminal using a port of fakechroot. Within that environment I've
>> >> ported and/or bootstrapped a number of Linux utilities (curl, git,
>> >> openssl, gcc)
>> >>
>> >> I run ./configure, then make, and the executable and library are
>> >> built. The problem occurs when build_ext is run; the newly built
>> >> python executable builds, then links _struct, and immediately
>> >> afterwards I get an 'undefined reference to dlopen' error.
>> >>
>> >> If I run ./python setup.py --verbose -library-dirs /path/to/lib
>> >> --libraries='c dl m' -f, the 'undefined reference to dlopen' error is
>> >> thrown again.
>> >>
>> >> If I run ./python setup.py --verbose -library-dirs /path/to/lib
>> >> --libraries='-lc -ldl -lm' -f the build continues past _struct...even
>> >> though ld throws the expected 'unable to find -l-lc' and other errors.
>> >>
>> >> Let me know if you need me to provide additional information. Any
>> >> help would be greatly appreciated.
>> >>
>> >> Cyd
>> >
>> >
>> > Additionally I took a strace of the error producing command. The
>> > following is (hopefully) a relevant portion minus the various 'no such
>> > file' lines before the correct lib is found (which it always is)
>> >
>> > 16513
>> open("/data/data/jackpal.androidterm/kbox2/bld/python/Python-2.7.8/Lib/distutils/unixccompiler.py",
>> > O_RDONLY|O_LARGEFILE) = 3 16513
>> >
>> open("/data/data/jackpal.androidterm/kbox2/bld/python/Python-2.7.8/Lib/distutils/unixccompiler.pyc",
>> > O_RDONLY|O_LARGEFILE) = 4 16513 vfork()
>> > = 16525
>> > 16513 wait4(16525,
>> > 16525 open("/data/data/jackpal.androidterm/kbox2/bin/sh",
>> > O_RDONLY|O_LARGEFILE) = 3
>> > 16525 execve("/data/data/jackpal.androidterm/kbox2/bin/sh", ["sh",
>> > "-c", "gcc --sysroot=/usr/gcc-4.9.2/sysroot -print-multiarch >
>> > build/temp.linux-armv7l-2.7/multiarch 2> /dev/null"], [/* 58 vars */])
>> > = 0
>> >
>> > *snip call to libc intercepted by libfakechroot*
>> >
>> > 16525 open("/system/lib/libc.so", O_RDONLY|O_LARGEFILE|0x8) = 3
>> > 16525 open("/system/lib/libm.so", O_RDONLY|O_LARGEFILE|0x8) = 3
>> > 16525 open("/dev/__properties__",
>> > O_RDONLY|O_LARGEFILE|O_NOFOLLOW|0x8) = 3
>> > 16525 open("build/temp.linux-armv7l-2.7/multiarch",
>> > O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 3
>> > 16525 open("/data/data/jackpal.androidterm/kbox2/dev/null",
>> > O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 3
>> > 16525 fork()= 16526
>> > 16525 wait4(-1,
>> > 16526 open("/acct/uid/10186/tasks", O_RDWR|O_CREAT|O_LARGEFILE, 0666)
>> > = -1 EACCES (Permission denied)
>> >
>> > See attached for remainder
>>
>> Should I be posting this issue elsewhere?
>> Is more information needed?
>>
> ___
>> Python-Dev mailing list
>> [email protected]
>> https://mail.python.org/mailman/listinfo/python-dev
>>
> Unsubscribe:
>> https://mail.python.org/mailman/options/python-dev/guido%40python.org
>>
>
>
>
> --
> --Guido van Rossum (python.org/~guido)
> ___
> Python-Dev mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> brett%40python.org
>
___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] PEP 448 (almost finished!) — Question regarding test_ast
On 20 Jan 2015, at 17:34, Neil Girdhar wrote: > My question first: > test_ast is mostly generated code, but I can't find where it is being > generated. I am pretty sure I know how to fix most of the introduced > problems. Who is generating test_ast?? > > Update: > > So far, I've done the following: > > Updated the patch to 3.5 > Fixed the grammar to accept final commas in argument lists always, and to > work with the already implemented code. > Fixed the ast to accept what it needs to accept and reject according to the > limitation laid down by Guido. > Fixed the parsing library. > > Fixed these tests: > test_ast.py > test_extcall.py > test_grammar.py > test_syntax.py > test_unpack_ex.py > > As far as I can tell, all I have left is to fix test_ast and possibly write > some more tests (there are already some new tests and some of the old > negative tests expecting SyntaxError are now positive tests). inspect.signature might need an update. Servus, Walter ___ Python-Dev mailing list [email protected] https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] PEP 448 (almost finished!) — Question regarding test_ast
Thanks for taking a look. I looked at inspect and I can't see anything that needs to change since it's the caller rather than the receiver who has more options after this PEP. Did you see anything in particular? Best, Neil On Thu, Jan 22, 2015 at 12:23 PM, Walter Dörwald wrote: > On 20 Jan 2015, at 17:34, Neil Girdhar wrote: > > > My question first: > > test_ast is mostly generated code, but I can't find where it is being > > generated. I am pretty sure I know how to fix most of the introduced > > problems. Who is generating test_ast?? > > > > Update: > > > > So far, I've done the following: > > > > Updated the patch to 3.5 > > Fixed the grammar to accept final commas in argument lists always, and to > > work with the already implemented code. > > Fixed the ast to accept what it needs to accept and reject according to > the > > limitation laid down by Guido. > > Fixed the parsing library. > > > > Fixed these tests: > > test_ast.py > > test_extcall.py > > test_grammar.py > > test_syntax.py > > test_unpack_ex.py > > > > As far as I can tell, all I have left is to fix test_ast and possibly > write > > some more tests (there are already some new tests and some of the old > > negative tests expecting SyntaxError are now positive tests). > > inspect.signature might need an update. > > Servus, >Walter > ___ Python-Dev mailing list [email protected] https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] [Python-checkins] cpython (3.4): Remove the unimplemented but ignored without='-E' parameters being passed to
I misinterpreted the side effect this code was triggering. It turns out that any kwarg would have the desired effect as a side effect (as seen in dummyvar='' being passed later in this file for the same purpose). I'm looking at refactoring various uses of -E that interfere with running the test suite in an environment where you need PYTHONHOME set. I will revert this change or otherwise do the equivalent of reinstating its behavior in a followup check-in as appropriate. -gregory.p.smith On Thu Jan 22 2015 at 10:05:56 PM gregory.p.smith < [email protected]> wrote: > https://hg.python.org/cpython/rev/7b833bd1f509 > changeset: 94249:7b833bd1f509 > branch: 3.4 > parent: 94247:7f3ac2ce24ed > user:Gregory P. Smith > date:Thu Jan 22 22:04:16 2015 -0800 > summary: > Remove the unimplemented but ignored without='-E' parameters being > passed to > script_helper.assert_python_failure(). No such feature has ever existed, > thus it doesn't do what the comment claims. (It does add a 'without' > variable to the environment of the child process but that was not intended) > > files: > Lib/test/test_cmd_line.py | 6 ++ > 1 files changed, 2 insertions(+), 4 deletions(-) > > > diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py > --- a/Lib/test/test_cmd_line.py > +++ b/Lib/test/test_cmd_line.py > @@ -426,13 +426,11 @@ > self.assertIn(b'Unknown option: -z', err) > self.assertEqual(err.splitlines().count(b'Unknown option: -z'), > 1) > self.assertEqual(b'', out) > -# Add "without='-E'" to prevent _assert_python to append -E > -# to env_vars and change the output of stderr > -rc, out, err = assert_python_failure('-z', without='-E') > +rc, out, err = assert_python_failure('-z') > self.assertIn(b'Unknown option: -z', err) > self.assertEqual(err.splitlines().count(b'Unknown option: -z'), > 1) > self.assertEqual(b'', out) > -rc, out, err = assert_python_failure('-a', '-z', without='-E') > +rc, out, err = assert_python_failure('-a', '-z') > self.assertIn(b'Unknown option: -a', err) > # only the first unknown option is reported > self.assertNotIn(b'Unknown option: -z', err) > > -- > Repository URL: https://hg.python.org/cpython > ___ > Python-checkins mailing list > [email protected] > https://mail.python.org/mailman/listinfo/python-checkins > ___ Python-Dev mailing list [email protected] https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
