Re: [Python-Dev] bytes & bytearray

2015-01-20 Thread Paul Sokolovsky
Hello,

On Tue, 20 Jan 2015 18:15:02 +1300
Greg Ewing  wrote:

> Guido van Rossum wrote:
> > On Mon, Jan 19, 2015 at 11:43 AM, Paul Sokolovsky
> > mailto:[email protected]>> wrote:
> > 
> > b.lower_inplace()
> > b.lower_i()
> > 
> > Please don't go there. The use cases are too rare.
> 
> And if you have such a use case, it's not too
> hard to do
> 
>b[:] = b.lower()

The point of inplace operations (memoryview's, other stuff already in
Python) is to avoid unneeded memory allocation and copying. For 1Tb
bytearray with 1Tb of RAM, it will be very hard to do. (Ditto for 100K
bytearray with 150K RAM.)



-- 
Best regards,
 Paul  mailto:[email protected]
___
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


[Python-Dev] How do I ensure that my code is being executed?

2015-01-20 Thread Neil Girdhar
I get error:

TypeError: init_builtin() takes exactly 1 argument (0 given)

The only source file that can generate that error
is Modules/_ctypes/_ctypes.c, but when I make changes to that file such as:

PyErr_Format(PyExc_TypeError,
 "call takes exactly %d arguments XYZABC (%zd given)",
 inargs_index, actual_args);

I do not see any difference after make clean and a full rebuild.  How is
this possible?  I need to debug the arguments passed.

Best,

Neil
___
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] How do I ensure that my code is being executed?

2015-01-20 Thread Skip Montanaro
On Tue, Jan 20, 2015 at 8:35 AM, Neil Girdhar  wrote:
>
> I get error:
>
> TypeError: init_builtin() takes exactly 1 argument (0 given)
>
> The only source file that can generate that error is 
> Modules/_ctypes/_ctypes.c, but when I make changes to that file such as:
>
> PyErr_Format(PyExc_TypeError,
>  "call takes exactly %d arguments XYZABC (%zd given)",
>  inargs_index, actual_args);
>
> I do not see any difference after make clean and a full rebuild.  How is this 
> possible?  I need to debug the arguments passed.

Neil,

I'm a little bit confused. Why are you modifying the Python
interpreter to see if your code (presumably not part of the Python
interpreter) is being executed? I will take a stab at your question
though, and suggest you aren't actually running the interpreter you
just built.

Can you provide some more context for your question?

One last thing. Are you working on Python itself
([email protected] is the right place to ask questions) or using
Python to develop an application (python-dev is not the right place,
try [email protected])?

Skip
___
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] How do I ensure that my code is being executed?

2015-01-20 Thread Brett Cannon
This is a mailing to discuss the development *of* Python, not its *use*.
You should be able to get help from python-list or #python on IRC.

On Tue Jan 20 2015 at 9:44:48 AM Neil Girdhar  wrote:

> I get error:
>
> TypeError: init_builtin() takes exactly 1 argument (0 given)
>
> The only source file that can generate that error
> is Modules/_ctypes/_ctypes.c, but when I make changes to that file such as:
>
> PyErr_Format(PyExc_TypeError,
>  "call takes exactly %d arguments XYZABC (%zd given)",
>  inargs_index, actual_args);
>
> I do not see any difference after make clean and a full rebuild.  How is
> this possible?  I need to debug the arguments passed.
>
> Best,
>
> Neil
>
> ___
> 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] How do I ensure that my code is being executed?

2015-01-20 Thread Benjamin Peterson


On Tue, Jan 20, 2015, at 09:51, Brett Cannon wrote:
> This is a mailing to discuss the development *of* Python, not its *use*.
> You should be able to get help from python-list or #python on IRC.

To be fair, he's asking to debug his patch in
https://bugs.python.org/issue2292
___
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] How do I ensure that my code is being executed?

2015-01-20 Thread Stefan Ring
On Tue, Jan 20, 2015 at 3:35 PM, Neil Girdhar  wrote:
> I get error:
>
> TypeError: init_builtin() takes exactly 1 argument (0 given)
>
> The only source file that can generate that error is
> Modules/_ctypes/_ctypes.c, but when I make changes to that file such as:
>
> PyErr_Format(PyExc_TypeError,
>  "call takes exactly %d arguments XYZABC (%zd given)",
>  inargs_index, actual_args);
>
> I do not see any difference after make clean and a full rebuild.  How is
> this possible?  I need to debug the arguments passed.

The message says "argument", the source code says "arguments" (I
suppose that you only added the XYZABC), so this cannot be source of
this exception.

grep for "given" in ceval.c
___
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] How do I ensure that my code is being executed?

2015-01-20 Thread Brett Cannon
On Tue Jan 20 2015 at 9:53:52 AM Benjamin Peterson 
wrote:

>
>
> On Tue, Jan 20, 2015, at 09:51, Brett Cannon wrote:
> > This is a mailing to discuss the development *of* Python, not its *use*.
> > You should be able to get help from python-list or #python on IRC.
>
> To be fair, he's asking to debug his patch in
> https://bugs.python.org/issue2292


Ah, sorry about that. The issue wasn't referenced in the email.
___
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] How do I ensure that my code is being executed?

2015-01-20 Thread Neil Girdhar
Hi Skip,

I'm trying to finish the implementation of PEP 448.  I have updated the
patch to 3.5, fixed the grammar, and the ast.  There is a bug with the
argument counting or unpacking, which I can't seem to locate.

Best,

Neil

On Tue, Jan 20, 2015 at 9:53 AM, Skip Montanaro 
wrote:

> On Tue, Jan 20, 2015 at 8:35 AM, Neil Girdhar 
> wrote:
> >
> > I get error:
> >
> > TypeError: init_builtin() takes exactly 1 argument (0 given)
> >
> > The only source file that can generate that error is
> Modules/_ctypes/_ctypes.c, but when I make changes to that file such as:
> >
> > PyErr_Format(PyExc_TypeError,
> >  "call takes exactly %d arguments XYZABC (%zd
> given)",
> >  inargs_index, actual_args);
> >
> > I do not see any difference after make clean and a full rebuild.  How is
> this possible?  I need to debug the arguments passed.
>
> Neil,
>
> I'm a little bit confused. Why are you modifying the Python
> interpreter to see if your code (presumably not part of the Python
> interpreter) is being executed? I will take a stab at your question
> though, and suggest you aren't actually running the interpreter you
> just built.
>
> Can you provide some more context for your question?
>
> One last thing. Are you working on Python itself
> ([email protected] is the right place to ask questions) or using
> Python to develop an application (python-dev is not the right place,
> try [email protected])?
>
> Skip
>
___
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] How do I ensure that my code is being executed?

2015-01-20 Thread Neil Girdhar
Sorry, I should have provided more context.

Best,

Neil

On Tue, Jan 20, 2015 at 9:55 AM, Brett Cannon  wrote:

>
>
> On Tue Jan 20 2015 at 9:53:52 AM Benjamin Peterson 
> wrote:
>
>>
>>
>> On Tue, Jan 20, 2015, at 09:51, Brett Cannon wrote:
>> > This is a mailing to discuss the development *of* Python, not its *use*.
>> > You should be able to get help from python-list or #python on IRC.
>>
>> To be fair, he's asking to debug his patch in
>> https://bugs.python.org/issue2292
>
>
> Ah, sorry about that. The issue wasn't referenced in the email.
>
___
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] How do I ensure that my code is being executed?

2015-01-20 Thread Neil Girdhar
Good eye!  I did the following grep:

~/cpython: grep -R takes.exac *
Doc/c-api/bytes.rst:   Identical to :c:func:`PyBytes_FromFormat` except
that it takes exactly two
Doc/c-api/unicode.rst:   Identical to :c:func:`PyUnicode_FromFormat` except
that it takes exactly two
Doc/library/unittest.mock.rst:   TypeError: () takes exactly 3
arguments (1 given)
Doc/whatsnew/2.0.rst:The ``\x`` escape in string literals now takes exactly
2 hex digits.  Previously
Lib/test/test_compileall.py:def test_d_takes_exactly_one_dir(self):
Lib/test/test_inspect.py:# f1 takes exactly 2 arguments
Lib/test/test_inspect.py:# f1/f2 takes exactly/at most 2
arguments
Lib/tkinter/__init__.py:# TypeError: setvar() takes exactly 3
arguments (2 given)
Modules/_ctypes/_ctypes.c: "call takes exactly %d
arguments xxx (%zd given)",
Objects/methodobject.c:"%.200s() takes exactly one argument
(%zd given)",
Binary file Objects/methodobject.o matches
Binary file Programs/_freeze_importlib matches
Binary file Programs/_testembed matches
Python/ceval.c: "%.200s() takes exactly one argument
(%d given)",
Python/ceval.c.orig: "%.200s() takes exactly one
argument (%d given)",
Binary file Python/ceval.o matches
Binary file libpython3.5dm.a matches
Binary file python.exe matches

I'll keep searching…

On Tue, Jan 20, 2015 at 9:52 AM, Stefan Ring  wrote:

> On Tue, Jan 20, 2015 at 3:35 PM, Neil Girdhar 
> wrote:
> > I get error:
> >
> > TypeError: init_builtin() takes exactly 1 argument (0 given)
> >
> > The only source file that can generate that error is
> > Modules/_ctypes/_ctypes.c, but when I make changes to that file such as:
> >
> > PyErr_Format(PyExc_TypeError,
> >  "call takes exactly %d arguments XYZABC (%zd
> given)",
> >  inargs_index, actual_args);
> >
> > I do not see any difference after make clean and a full rebuild.  How is
> > this possible?  I need to debug the arguments passed.
>
> The message says "argument", the source code says "arguments" (I
> suppose that you only added the XYZABC), so this cannot be source of
> this exception.
>
> grep for "given" in ceval.c
>
___
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] How do I ensure that my code is being executed?

2015-01-20 Thread Neil Girdhar
Okay, found it thanks.

On Tue, Jan 20, 2015 at 9:59 AM, Neil Girdhar  wrote:

> Good eye!  I did the following grep:
>
> ~/cpython: grep -R takes.exac *
> Doc/c-api/bytes.rst:   Identical to :c:func:`PyBytes_FromFormat` except
> that it takes exactly two
> Doc/c-api/unicode.rst:   Identical to :c:func:`PyUnicode_FromFormat`
> except that it takes exactly two
> Doc/library/unittest.mock.rst:   TypeError: () takes exactly 3
> arguments (1 given)
> Doc/whatsnew/2.0.rst:The ``\x`` escape in string literals now takes
> exactly 2 hex digits.  Previously
> Lib/test/test_compileall.py:def test_d_takes_exactly_one_dir(self):
> Lib/test/test_inspect.py:# f1 takes exactly 2 arguments
> Lib/test/test_inspect.py:# f1/f2 takes exactly/at most 2
> arguments
> Lib/tkinter/__init__.py:# TypeError: setvar() takes exactly 3
> arguments (2 given)
> Modules/_ctypes/_ctypes.c: "call takes exactly %d
> arguments xxx (%zd given)",
> Objects/methodobject.c:"%.200s() takes exactly one
> argument (%zd given)",
> Binary file Objects/methodobject.o matches
> Binary file Programs/_freeze_importlib matches
> Binary file Programs/_testembed matches
> Python/ceval.c: "%.200s() takes exactly one argument
> (%d given)",
> Python/ceval.c.orig: "%.200s() takes exactly one
> argument (%d given)",
> Binary file Python/ceval.o matches
> Binary file libpython3.5dm.a matches
> Binary file python.exe matches
>
> I'll keep searching…
>
> On Tue, Jan 20, 2015 at 9:52 AM, Stefan Ring  wrote:
>
>> On Tue, Jan 20, 2015 at 3:35 PM, Neil Girdhar 
>> wrote:
>> > I get error:
>> >
>> > TypeError: init_builtin() takes exactly 1 argument (0 given)
>> >
>> > The only source file that can generate that error is
>> > Modules/_ctypes/_ctypes.c, but when I make changes to that file such as:
>> >
>> > PyErr_Format(PyExc_TypeError,
>> >  "call takes exactly %d arguments XYZABC (%zd
>> given)",
>> >  inargs_index, actual_args);
>> >
>> > I do not see any difference after make clean and a full rebuild.  How is
>> > this possible?  I need to debug the arguments passed.
>>
>> The message says "argument", the source code says "arguments" (I
>> suppose that you only added the XYZABC), so this cannot be source of
>> this exception.
>>
>> grep for "given" in ceval.c
>>
>
>
___
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] How do I ensure that my code is being executed?

2015-01-20 Thread Neil Girdhar
(in fact, it was Python/getargs.c)

On Tue, Jan 20, 2015 at 10:01 AM, Neil Girdhar 
wrote:

> Okay, found it thanks.
>
> On Tue, Jan 20, 2015 at 9:59 AM, Neil Girdhar 
> wrote:
>
>> Good eye!  I did the following grep:
>>
>> ~/cpython: grep -R takes.exac *
>> Doc/c-api/bytes.rst:   Identical to :c:func:`PyBytes_FromFormat` except
>> that it takes exactly two
>> Doc/c-api/unicode.rst:   Identical to :c:func:`PyUnicode_FromFormat`
>> except that it takes exactly two
>> Doc/library/unittest.mock.rst:   TypeError: () takes exactly 3
>> arguments (1 given)
>> Doc/whatsnew/2.0.rst:The ``\x`` escape in string literals now takes
>> exactly 2 hex digits.  Previously
>> Lib/test/test_compileall.py:def test_d_takes_exactly_one_dir(self):
>> Lib/test/test_inspect.py:# f1 takes exactly 2 arguments
>> Lib/test/test_inspect.py:# f1/f2 takes exactly/at most 2
>> arguments
>> Lib/tkinter/__init__.py:# TypeError: setvar() takes exactly 3
>> arguments (2 given)
>> Modules/_ctypes/_ctypes.c: "call takes exactly %d
>> arguments xxx (%zd given)",
>> Objects/methodobject.c:"%.200s() takes exactly one
>> argument (%zd given)",
>> Binary file Objects/methodobject.o matches
>> Binary file Programs/_freeze_importlib matches
>> Binary file Programs/_testembed matches
>> Python/ceval.c: "%.200s() takes exactly one argument
>> (%d given)",
>> Python/ceval.c.orig: "%.200s() takes exactly one
>> argument (%d given)",
>> Binary file Python/ceval.o matches
>> Binary file libpython3.5dm.a matches
>> Binary file python.exe matches
>>
>> I'll keep searching…
>>
>> On Tue, Jan 20, 2015 at 9:52 AM, Stefan Ring  wrote:
>>
>>> On Tue, Jan 20, 2015 at 3:35 PM, Neil Girdhar 
>>> wrote:
>>> > I get error:
>>> >
>>> > TypeError: init_builtin() takes exactly 1 argument (0 given)
>>> >
>>> > The only source file that can generate that error is
>>> > Modules/_ctypes/_ctypes.c, but when I make changes to that file such
>>> as:
>>> >
>>> > PyErr_Format(PyExc_TypeError,
>>> >  "call takes exactly %d arguments XYZABC (%zd
>>> given)",
>>> >  inargs_index, actual_args);
>>> >
>>> > I do not see any difference after make clean and a full rebuild.  How
>>> is
>>> > this possible?  I need to debug the arguments passed.
>>>
>>> The message says "argument", the source code says "arguments" (I
>>> suppose that you only added the XYZABC), so this cannot be source of
>>> this exception.
>>>
>>> grep for "given" in ceval.c
>>>
>>
>>
>
___
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


[Python-Dev] PEP 448 (almost finished!) — Question regarding test_ast

2015-01-20 Thread Neil Girdhar
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).

Best,

Neil
___
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

2015-01-20 Thread Benjamin Peterson


On Tue, Jan 20, 2015, at 11: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??

It generates itself.
___
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] bytes & bytearray

2015-01-20 Thread Guido van Rossum
On Tue, Jan 20, 2015 at 1:48 AM, Paul Sokolovsky  wrote:

> The point of inplace operations (memoryview's, other stuff already in
> Python) is to avoid unneeded memory allocation and copying. For 1Tb
> bytearray with 1Tb of RAM, it will be very hard to do. (Ditto for 100K
> bytearray with 150K RAM.)
>

So you'll have to figure a better way to do it. We're not going to add
inplace_lower(), and that's the final word. (Of course you can add it to
microPython as an extension of the language.)

-- 
--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/archive%40mail-archive.com


[Python-Dev] Possible "REMOTE HOST IDENTIFICATION HAS CHANGED!" Error.

2015-01-20 Thread Donald Stufft
Just a heads up that people might see a "REMOTE HOST IDENTIFICATION HAS
CHANGED!" error when connecting to hg.python.org's SSH (or any other PSF
machine). The reason for this is that previously we allowed RSA, ECDSA, and 
ED25519 host keys. However ECDSA relies on having an unbiased random number
generator on every connection and any bias in the random numbers can leak the
private key. Since these are running on VMs where we don't know for sure what
the quality is of the random numbers I've disabled the ECDSA host key.

The impact of this is if you had previously connected to a PSF machine, and
your client had the ECDSA key in your ~/.ssh/known_hosts file, that you'll
see an error like:

@@@
@WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.

The remediation is to remove the ECDSA for the PSF servers from your known
hosts and connect again and accept either the RSA or the ED25519 key when it
presents it.

The fingerprints for hg.python.org for both of those keys are:

$ ssh-keygen -lf /etc/ssh/ssh_host_rsa_key.pub
2048 a0:12:52:50:4a:4b:db:43:ac:65:26:b6:6f:0a:f7:b8 
/etc/ssh/ssh_host_rsa_key.pub (RSA)
$ ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub
256 1d:02:d1:d2:7b:a1:cb:e0:51:65:25:d7:19:dd:4e:74 
/etc/ssh/ssh_host_ed25519_key.pub (ED25519)

Sorry for any inconvience this causes!

---
Donald Stufft
PGP: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

___
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] bytes & bytearray

2015-01-20 Thread Trent Nelson
On Tue, Jan 20, 2015 at 11:48:10AM +0200, Paul Sokolovsky wrote:
> Hello,
> 
> On Tue, 20 Jan 2015 18:15:02 +1300
> Greg Ewing  wrote:
> 
> > Guido van Rossum wrote:
> > > On Mon, Jan 19, 2015 at 11:43 AM, Paul Sokolovsky
> > > mailto:[email protected]>> wrote:
> > > 
> > > b.lower_inplace()
> > > b.lower_i()
> > > 
> > > Please don't go there. The use cases are too rare.
> > 
> > And if you have such a use case, it's not too
> > hard to do
> > 
> >b[:] = b.lower()
> 
> The point of inplace operations (memoryview's, other stuff already in
> Python) is to avoid unneeded memory allocation and copying. For 1Tb
> bytearray with 1Tb of RAM, it will be very hard to do. (Ditto for 100K
> bytearray with 150K RAM.)

You can just loop through the bytearray and assign elements.  I use
something along the lines of this for PyParallel where I'm operating on
bytearrays that are backed by underlying socket buffers, where I don't
want to do any memory allocations/reallocations:

def toupper_bytes(data):
assert isinstance(data, bytearray)
a = ord('a')
z = ord('z')
for i in range(0, len(data)):
c = data[i]
if c >= a and c <= z:
data[i] = c - 32

Low overhead, mostly stays within the same ceval frame.  Should be a
walk in the park for PyPy, Cython or Numba to optimize, too.

Trent.
___
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

2015-01-20 Thread Neil Girdhar
Hi Benjamin,

I'm having trouble finding where it is generating the lines below

 EVERYTHING BELOW IS GENERATED #

Neither a call to test_ast nor a make (in case it's generated somewhere
else) regenerate those lines if they have been removed.

How were those lines generated?

Best,
Neil


On Tue, Jan 20, 2015 at 11:36 AM, Benjamin Peterson 
wrote:

>
>
> On Tue, Jan 20, 2015, at 11: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??
>
> It generates itself.
>
___
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

2015-01-20 Thread Neil Girdhar
Thanks!

On Tue, Jan 20, 2015 at 12:09 PM, Benjamin Peterson 
wrote:

> $ ./python Lib/test/test_ast.py -g
> exec_results = [
> ('Module', [('Expr', (1, 0), ('NameConstant', (1, 0), None))]),
> ('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, [], [],
> None, []), [('Pass', (1, 9))], [], None)]),
> ('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [('arg', (1, 6),
> 'a', None)], None, [], [], None, []), [('Pass', (1, 10))], [], None)]),
> ('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [('arg', (1, 6),
> 'a', None)], None, [], [], None, [('Num', (1, 8), 0)]), [('Pass', (1,
> 12))], [], None)]),
> ('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], ('arg', (1,
> 7), 'args', None), [], [], None, []), [('Pass', (1, 14))], [], None)]),
> ('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, [], [],
> ('arg', (1, 8), 'kwargs', None), []), [('Pass', (1, 17))], [], None)]),
> 
>
> On Tue, Jan 20, 2015, at 12:06, Neil Girdhar wrote:
> > Hi Benjamin,
> >
> > I'm having trouble finding where it is generating the lines below
> >
> >  EVERYTHING BELOW IS GENERATED #
> >
> > Neither a call to test_ast nor a make (in case it's generated somewhere
> > else) regenerate those lines if they have been removed.
> >
> > How were those lines generated?
> >
> > Best,
> > Neil
> >
> >
> > On Tue, Jan 20, 2015 at 11:36 AM, Benjamin Peterson  >
> > wrote:
> >
> > >
> > >
> > > On Tue, Jan 20, 2015, at 11: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??
> > >
> > > It generates itself.
> > >
>
___
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

2015-01-20 Thread Benjamin Peterson
$ ./python Lib/test/test_ast.py -g
exec_results = [
('Module', [('Expr', (1, 0), ('NameConstant', (1, 0), None))]),
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, [], [],
None, []), [('Pass', (1, 9))], [], None)]),
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [('arg', (1, 6),
'a', None)], None, [], [], None, []), [('Pass', (1, 10))], [], None)]),
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [('arg', (1, 6),
'a', None)], None, [], [], None, [('Num', (1, 8), 0)]), [('Pass', (1,
12))], [], None)]),
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], ('arg', (1,
7), 'args', None), [], [], None, []), [('Pass', (1, 14))], [], None)]),
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, [], [],
('arg', (1, 8), 'kwargs', None), []), [('Pass', (1, 17))], [], None)]),


On Tue, Jan 20, 2015, at 12:06, Neil Girdhar wrote:
> Hi Benjamin,
> 
> I'm having trouble finding where it is generating the lines below
> 
>  EVERYTHING BELOW IS GENERATED #
> 
> Neither a call to test_ast nor a make (in case it's generated somewhere
> else) regenerate those lines if they have been removed.
> 
> How were those lines generated?
> 
> Best,
> Neil
> 
> 
> On Tue, Jan 20, 2015 at 11:36 AM, Benjamin Peterson 
> wrote:
> 
> >
> >
> > On Tue, Jan 20, 2015, at 11: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??
> >
> > It generates itself.
> >
___
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

2015-01-20 Thread Neil Girdhar
Okay, I think it's ready for a code review.  Would anyone be kind enough to
offer comments?

On Tue, Jan 20, 2015 at 12:10 PM, Neil Girdhar 
wrote:

> Thanks!
>
> On Tue, Jan 20, 2015 at 12:09 PM, Benjamin Peterson 
> wrote:
>
>> $ ./python Lib/test/test_ast.py -g
>> exec_results = [
>> ('Module', [('Expr', (1, 0), ('NameConstant', (1, 0), None))]),
>> ('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, [], [],
>> None, []), [('Pass', (1, 9))], [], None)]),
>> ('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [('arg', (1, 6),
>> 'a', None)], None, [], [], None, []), [('Pass', (1, 10))], [], None)]),
>> ('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [('arg', (1, 6),
>> 'a', None)], None, [], [], None, [('Num', (1, 8), 0)]), [('Pass', (1,
>> 12))], [], None)]),
>> ('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], ('arg', (1,
>> 7), 'args', None), [], [], None, []), [('Pass', (1, 14))], [], None)]),
>> ('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, [], [],
>> ('arg', (1, 8), 'kwargs', None), []), [('Pass', (1, 17))], [], None)]),
>> 
>>
>> On Tue, Jan 20, 2015, at 12:06, Neil Girdhar wrote:
>> > Hi Benjamin,
>> >
>> > I'm having trouble finding where it is generating the lines below
>> >
>> >  EVERYTHING BELOW IS GENERATED #
>> >
>> > Neither a call to test_ast nor a make (in case it's generated somewhere
>> > else) regenerate those lines if they have been removed.
>> >
>> > How were those lines generated?
>> >
>> > Best,
>> > Neil
>> >
>> >
>> > On Tue, Jan 20, 2015 at 11:36 AM, Benjamin Peterson <
>> [email protected]>
>> > wrote:
>> >
>> > >
>> > >
>> > > On Tue, Jan 20, 2015, at 11: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??
>> > >
>> > > It generates itself.
>> > >
>>
>
>
___
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-ideas] What's going on with PEP 448 - Additional Unpacking Generalizations ?

2015-01-20 Thread Guido van Rossum
Thanks very much for your work! I am CC'ing python-dev to see if there are
any last calls for PEP 448. Assuming no material objection appear to the
new syntax and semantics, I can approve the PEP later this week. To get it
committed, you need one of the active committers to give you a code review
(waiting for me would mean waiting forever). Maybe Antoine, Benjamin or
Victor?

On Tue, Jan 20, 2015 at 9:39 AM, Neil Girdhar  wrote:

> I believe I have finally finished the work on the patch for PEP 448 (
> http://bugs.python.org/issue2292).  How do we get the PEP approved?  What
> else would we need to check it into Python?
>
> Best,
>
> Neil
>
> On Tue, Jan 20, 2015 at 12:03 PM, Guido van Rossum 
> wrote:
>
>> OK. I don't like arg unpackings after keyword args, for the same reason
>> plain positional args aren't allowed after keyword args, but I guess I
>> didn't pay attention when it was introduced, so we're stuck with it now,
>> it's not the end of the world, and at least the definition is clear
>> (collect all positional args first, then handle keyword args).
>>
>> On Tue, Jan 20, 2015 at 8:51 AM, Neil Girdhar 
>> wrote:
>>
>>>
>>>
>>> Okay, so: positional arguments neither follow keyword arguments nor
>>> keyword argument unpackings; iterable argument unpackings never follow
>>> keyword argument unpackings.
>>>
>>>
>>>
>>> On Tue, Jan 20, 2015 at 11:47 AM, Joshua Landau 
>>> wrote:
>>>
 On 20 January 2015 at 16:38, Guido van Rossum  wrote:
 > The PEP hasn't been accepted yet AFAIK...  I'm generally okay with
 allowing
 > multiple *x things (except in an *unpack* position of course) but I
 still
 > don't think we should be mixing positional and keyword args. So, no
 f(a,
 > b=2, c), nor f(a, b=2, *c).
 >

 f(a, b=2, *c) is currently legal as both a call and as a definition:

 a, *c = 1, 2, 3

 def f(*args, **kwargs):
 print(args, kwargs)

 f(a, b=2, *c)
 #>>> (1, 2, 3) {'b': 2}

 def f(a, b=2, *c):
 print(a, b, c)

 f(1, 2, 3)
 #>>> 1 2 (3,)

 So I imagine that's staying (or, at least, this PEP isn't removing
 it). I don't think anyone is (yet) arguing for f(a, b=2, c).
 ___
 Python-ideas mailing list
 [email protected]
 https://mail.python.org/mailman/listinfo/python-ideas
 Code of Conduct: http://python.org/psf/codeofconduct/

 --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups "python-ideas" group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/python-ideas/J99EFY1D1nI/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 [email protected].
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>> ___
>>> Python-ideas mailing list
>>> [email protected]
>>> https://mail.python.org/mailman/listinfo/python-ideas
>>> Code of Conduct: http://python.org/psf/codeofconduct/
>>>
>>
>>
>>
>> --
>> --Guido van Rossum (python.org/~guido)
>>
>
>


-- 
--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/archive%40mail-archive.com