[issue30300] asyncio.Controller

2017-05-29 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> Can you elaborate?  What's too specific about it?  Do you have in mind a use 
> case where you wouldn't need to provide hostname and port?

Any use case where setup is more elaborate than calling create_server(...).  
For example I might write a UDP server.  Or a distributed system that listens 
to several ports at once, or launches a thread pool. etc.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7074] Turtle module crashes python

2017-05-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I copied and pasted my code from turtlecrash.py into 3.7 editor, ran, and 
probably held key down for 3000 clicks, and it worked as it should.

--
status: pending -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25791] Raise an ImportWarning when __spec__.parent/__package__ isn't defined for a relative import

2017-05-29 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> Is it possible Cython is still supporting pre-PEP-328 style implicit relative 
> imports, even in Python 2.7+?

That might be the case.  I can't find anything in the Cython docs.  Stefan, 
could you shed a light?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30501] Produce optimized code for boolean conditions

2017-05-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1934

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25791] Raise an ImportWarning when __spec__.parent/__package__ isn't defined for a relative import

2017-05-29 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok, I did an experiment. I added "from __future__ import absolute_import" at 
the top of _multidict.c, and after a recompile the warning went away.

What changed was that the following line:

  __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) 
__PYX_ERR(0, 5, __pyx_L1_error)

was replaced with:

  __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, 0); if (unlikely(!__pyx_t_1)) 
__PYX_ERR(0, 3, __pyx_L1_error)


Ignore the change from "3" to "5", which is the line number for the traceback.  
The relevant change is the "level" argument to __Pyx_Import() which went from 
-1 to 0.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30502] Fix buffer handling of OBJ_obj2txt

2017-05-29 Thread Christian Heimes

New submission from Christian Heimes:

Frawser Tweedle from Red Hat's identity management team found an issue in PyCA 
cryptography's handling of buffers for OpenSSL OBJ_obj2txt(). Cryptography 
fails to handle long OIDs as used by Active Directory.

https://github.com/pyca/cryptography/pull/3612/
https://bugzilla.redhat.com/show_bug.cgi?id=1455755

CPython's ssl module doesn't handle buffer allocation for OBJ_obj2txt() 
correctly, too. A default buffer size of 255+1 makes the bug less likely to 
occur, though. We should fix the problem anyway.

--
assignee: christian.heimes
components: SSL
messages: 294679
nosy: christian.heimes
priority: critical
severity: normal
status: open
title: Fix buffer handling of OBJ_obj2txt
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30501] Produce optimized code for boolean conditions

2017-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Some examples.

if not a and b: x

Unpatched:
  1   0 LOAD_NAME0 (a)
  2 UNARY_NOT
  4 POP_JUMP_IF_FALSE   14
  6 LOAD_NAME1 (b)
  8 POP_JUMP_IF_FALSE   14
 10 LOAD_NAME2 (x)
 12 POP_TOP
>>   14 LOAD_CONST   0 (None)
 16 RETURN_VALUE

Patched:
  1   0 LOAD_NAME0 (a)
  2 POP_JUMP_IF_TRUE12
  4 LOAD_NAME1 (b)
  6 POP_JUMP_IF_FALSE   12
  8 LOAD_NAME2 (x)
 10 POP_TOP
>>   12 LOAD_CONST   0 (None)
 14 RETURN_VALUE

if a <= b < c: x

Unpatched:
  1   0 LOAD_NAME0 (a)
  2 LOAD_NAME1 (b)
  4 DUP_TOP
  6 ROT_THREE
  8 COMPARE_OP   1 (<=)
 10 JUMP_IF_FALSE_OR_POP18
 12 LOAD_NAME2 (c)
 14 COMPARE_OP   0 (<)
 16 JUMP_FORWARD 4 (to 22)
>>   18 ROT_TWO
 20 POP_TOP
>>   22 POP_JUMP_IF_FALSE   28
 24 LOAD_NAME3 (x)
 26 POP_TOP
>>   28 LOAD_CONST   0 (None)
 30 RETURN_VALUE

Patched:
  1   0 LOAD_NAME0 (a)
  2 LOAD_NAME1 (b)
  4 DUP_TOP
  6 ROT_THREE
  8 COMPARE_OP   1 (<=)
 10 POP_JUMP_IF_FALSE   20
 12 LOAD_NAME2 (c)
 14 COMPARE_OP   0 (<)
 16 POP_JUMP_IF_FALSE   28
 18 JUMP_FORWARD 4 (to 24)
>>   20 POP_TOP
 22 JUMP_FORWARD 4 (to 28)
>>   24 LOAD_NAME3 (x)
 26 POP_TOP
>>   28 LOAD_CONST   0 (None)
 30 RETURN_VALUE

if not (a and b) and c: x

Unpatched:
  1   0 LOAD_NAME0 (a)
  2 JUMP_IF_FALSE_OR_POP 6
  4 LOAD_NAME1 (b)
>>6 UNARY_NOT
  8 POP_JUMP_IF_FALSE   18
 10 LOAD_NAME2 (c)
 12 POP_JUMP_IF_FALSE   18
 14 LOAD_NAME3 (x)
 16 POP_TOP
>>   18 LOAD_CONST   0 (None)
 20 RETURN_VALUE

Patched:
  1   0 LOAD_NAME0 (a)
  2 POP_JUMP_IF_FALSE8
  4 LOAD_NAME1 (b)
  6 POP_JUMP_IF_TRUE16
>>8 LOAD_NAME2 (c)
 10 POP_JUMP_IF_FALSE   16
 12 LOAD_NAME3 (x)
 14 POP_TOP
>>   16 LOAD_CONST   0 (None)
 18 RETURN_VALUE

Note that the __bool__() method of every value is evaluated only once.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30502] Fix buffer handling of OBJ_obj2txt

2017-05-29 Thread Christian Heimes

Changes by Christian Heimes :


--
pull_requests: +1935

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30501] Produce optimized code for boolean conditions

2017-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It would be hard to get the same optimization in the peepholer.

For the first example, "if not a and b:", it is easy, just replace 
UNARY_NOT+POP_JUMP_IF_FALSE with POP_JUMP_IF_TRUE. The more complex third 
example, "if not (a and b) and c:", would need multiple passes (and more 
complex examples can need more passes, having the quadratic complexity in 
corner cases). The second example, with chained comparisons, is the most 
complex. It uses the fact that after the conditional jump and some stack 
operations we got a false value on the stack. This is too complex for the 
peepholer.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30503] It should be possible to use a module name with the same name as a package name

2017-05-29 Thread Håkon Hægland

New submission from Håkon Hægland:

I have the following folder structure:

.
├── aaa
│   ├── bbb
│   │   ├── ccc.py
│   │   └── __init__.py
│   ├── bbb.py
│   └── __init__.py
├── __init__.py
└── t.py

./t.py:

import sys
sys.path = ['.']
import aaa.bbb
print(aaa.bbb.get_name())

./aaa/bbb.py:

def get_name():
return "aaa/bbb"

however, when I run the main script:

$ python -B t.py 
Traceback (most recent call last):
  File "t.py", line 5, in 
print(aaa.bbb.get_name())
AttributeError: module 'aaa.bbb' has no attribute 'get_name'

The reason is that there is also a package with name 'aaa.bbb' (i.e. file 
"./aaa/bbb/__init__.py") and python will see this package before it sees my 
module "./aaa/bbb.py" and will never load the module.

If this is correct, than this is a bad design in my opinion. I should be 
possible to use a module with the same name as a package. 

Thanks for considering this issue, and let me know if I can help improve Python 
at this point.

Note: I asked the question first at stackoverflow.com:
https://stackoverflow.com/q/44227763/2173773

--
components: Interpreter Core
messages: 294682
nosy: hakonhagland
priority: normal
severity: normal
status: open
title: It should be possible to use a module name with the same name as a 
package name
type: enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30503] It should be possible to use a module name with the same name as a package name

2017-05-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +brett.cannon, eric.snow, ncoghlan

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30504] Allow inspecting buffering attribute of IO objects

2017-05-29 Thread Antoine Pitrou

New submission from Antoine Pitrou:

It would be useful to be able to inspect the buffering attribute of buffered 
and text I/O objects, especially for debugging.

I would expect e.g.:

>>> sys.stdout.buffering
1   # line-buffered
>>> sys.stdout.buffer.buffering
8192

--
components: IO
messages: 294683
nosy: benjamin.peterson, pitrou, stutzbach
priority: normal
severity: normal
stage: needs patch
status: open
title: Allow inspecting buffering attribute of IO objects
type: enhancement
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30502] Fix buffer handling of OBJ_obj2txt

2017-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Can the common code of _create_tuple_for_attribute() and asn1obj2py() be shared?

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30504] Allow inspecting buffering attribute of IO objects

2017-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

>>> sys.stdout.line_buffering
True

For buffered streams I would expect the attribute named "buffer_size", 
conforming to the name of the parameter of the constructor.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30505] Performance of typing._ProtocolMeta._get_protocol_attrs and isinstance

2017-05-29 Thread Oren Ben-Kiki

New submission from Oren Ben-Kiki:

In 3.6.0, invocation of isinstance calls 
typing._ProtocolMeta._get_protocol_attrs.
This creates a set of all attributes in all base classes, loops on these 
attributes to check they exist, and discards the set. It is very slow.

My program uses isinstance to allow for flexibility in parameter types in 
certain key functions. I realize that using isinstance is frowned upon, but it 
seems to make sense in my case.

As a result, >95% of its run-time is inside 
typing._ProtocolMeta._get_protocol_attrs (!).

I have created a simple wrapper around isinstance which caches its result with 
a Dict[Tuple[type, type], bool]. This solved the performance problem, but 
introduced a different problem - type checking.

I use mypy and type annotations, and my code cleanly type-checks (with the 
occasional # type: ignore). If I switch to using my own isinstance function, 
then mypy's type inference no longer treats it as special, so it starts 
complaining about all uses of values protected by if isinstance(value, 
SomeType): ...

I propose that either the private typing._ProtocolMeta.__subclasscheck__ (which 
invokes _get_protocol_attrs), or the public isinstance, would be modified to 
cache their results.

I can create a PR for either approach, if this is acceptable.

--
components: Library (Lib)
messages: 294686
nosy: orenbenkiki
priority: normal
severity: normal
status: open
title: Performance of typing._ProtocolMeta._get_protocol_attrs and isinstance
type: performance
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30502] Fix buffer handling of OBJ_obj2txt

2017-05-29 Thread Christian Heimes

Christian Heimes added the comment:

IMO it doesn't make sense to share a couple of lines of code. It makes the code 
even harder to read.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30500] urllib connects to a wrong host

2017-05-29 Thread Nam Nguyen

Changes by Nam Nguyen :


--
pull_requests: +1937

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30497] Line number of docstring in AST

2017-05-29 Thread STINNER Victor

STINNER Victor added the comment:

> We use this feature in pyflakes (https://github.com/PyCQA/pyflakes/issues/271)

AST is not designed to be 1-to-1 .py source to AST mapping. If you need the 
exact line number, you might use your own parser. I don't know what is using 
pylint for example? There is also https://github.com/PyCQA/redbaron which 
provides such 1-to-1 mapping but it has a different API than AST.

Sadly, I suggest to close this issue as WONTFIX.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30506] Replace 'list' with 'array' in array.remove and array.index

2017-05-29 Thread Jim Fasarakis-Hilliard

New submission from Jim Fasarakis-Hilliard:

Changes the error message for array.remove and array.index to say 
'array.(x): x not in array' instead of 'array.(x): x not 
in list'. 

This is a splinter issue of issue13349.

--
components: Library (Lib)
messages: 294689
nosy: Jim Fasarakis-Hilliard
priority: normal
severity: normal
status: open
title: Replace 'list' with 'array' in array.remove and array.index
type: behavior
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30506] Replace 'list' with 'array' in array.remove and array.index

2017-05-29 Thread Jim Fasarakis-Hilliard

Changes by Jim Fasarakis-Hilliard :


--
pull_requests: +1938

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30496] Incomplete traceback with `exec` on SyntaxError

2017-05-29 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
components: +Interpreter Core
nosy: +benjamin.peterson, brett.cannon, ncoghlan, yselivanov
stage:  -> needs patch
title: Incomplete traceback with `exec` -> Incomplete traceback with `exec` on 
SyntaxError

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30496] Incomplete traceback with `exec` on SyntaxError

2017-05-29 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
versions: +Python 2.7, Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30502] Fix buffer handling of OBJ_obj2txt

2017-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Your PR LGTM. But I think the code can be much simpler.

Here is a patch that shares common code and applies other simplifications to 
surrounded code. PR 1852 increases the total number of lines by 37 lines, 
issue30502-simpler.diff -- only by 3 lines.

PR 1852: 1 file changed, 49 insertions(+), 12 deletions(-)
issue30502-simpler.diff: 1 file changed, 46 insertions(+), 43 deletions(-)

--
keywords: +patch
Added file: http://bugs.python.org/file46909/issue30502-simpler.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30496] Incomplete traceback with `exec` on SyntaxError

2017-05-29 Thread Stefan Seefeld

Stefan Seefeld added the comment:

Some further experiements:

Replacing the `exec(f.read(), env)` line by
```
code = compile(f.read(), 'script', 'exec')
exec(code, env)
```
exhibits the same behaviour. If I remove the `try...except`, the correct
(full) traceback is printed out. So it looks like the issue is with the 
traceback propagation through exception handlers when the error happens during 
parsing.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30353] ctypes: pass by value for structs broken on Cygwin/MinGW 64-bit

2017-05-29 Thread Vinay Sajip

Vinay Sajip added the comment:

Patch LGTM now, perhaps others will concur?

--
nosy: +eryksun

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30501] Produce optimized code for boolean conditions

2017-05-29 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Any high-level benchmarks (i.e. other than pybench and similar programs) 
impacted by this?

--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30500] urllib connects to a wrong host

2017-05-29 Thread Nam Nguyen

Nam Nguyen added the comment:

I think the best behavior is to do what popular web browsers do. Chrome and 
Firefox, for example, parses this is host 127.0.0.1, path /, fragment 
#@evil.com.

If the code does want to support username/password, it should do a custom 
opener (with basic HTTP authentication) instead.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30495] IDLE: modernize textview module

2017-05-29 Thread Cheryl Sabella

Cheryl Sabella added the comment:

I've attached a patch for textview for your review.  Thanks for suggesting 
that.  I still need to work on test_textview.

Some comments/questions:
1.  I've made the Frame classes as you suggested.  I had also made a class for 
TextviewText (as help.py has), but it only had an __init__, so I removed it.
2.  I converted some of the tkinter imports to ttk.  Text didn't have a direct 
replacement, so I left it.  I didn't know if I should change it to NoteBook?
3.  Since Text wasn't converted, I left bg and fg as is. Is it correct to use 
parent.bg and parent.fg to refer to the values in the calling class?
4.  I also bind the button to parent.ok in ButtonFrame.  With this and #3, my 
question is probably more about my use of parent. to access an 
attribute/function of the calling class.  It doesn't feel like I'm doing it 
right.
5.  I changed the inheritance calls to use super().  If you prefer not to use 
that, I can change it back.
6.  In help.py, instead of using widget.config calls for setup, you used the 
dictionary access, so I changed those here.  For example, text['state'] = 
'disabled' instead of self.text.config(state=DISABLED).
7.  And, yes, I also changed the constants.  I did it to match help.py.  I can 
change it back if it's an issue.
8.  I changed the string formatting used on self.geometry.  I had to look up 
the usage, so I thought this would be more self-documenting.
9.  help.py used grid instead of pack.  I kept this as pack, but wanted to ask 
if that was something else you wanted to be done?
10.  help.py used self.wm_title.  wm_title is aliased to title, so I didn't 
know if you wanted those changed.  In help.py, you also used self.protocal and 
not self.wm_protocol, so I wasn't sure about it.

--
keywords: +patch
Added file: http://bugs.python.org/file46910/textview.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30216] xdrlib.Unpacker.unpack_string returns bytes (docs say should be str)

2017-05-29 Thread Jan Hnatek

Jan Hnatek added the comment:

There's a patch for xdrlib documentation in Issue9544. Would that solve this 
issue?

--
nosy: +hnhn

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9544] xdrlib.Packer().pack_fstring throws a TypeError when called with a str()

2017-05-29 Thread Jan Hnatek

Changes by Jan Hnatek :


--
nosy: +hnhn

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30507] Elements reports it is a list on Element.remove

2017-05-29 Thread Jim Fasarakis-Hilliard

New submission from Jim Fasarakis-Hilliard:

Another splinter issue from issue13349. Currently, Element reports it's a list 
when remove is called on it:

from xml.etree.ElementTree import Element
Element('').remove(Element('')) 

ValueError: list.remove(x): x not in list

>From what I understand, this was done in order for it to conform with the 
>error reporting performed from the pure python implementation of Element. 
>(side note: These also differ regarding the type of value supplied to .remove, 
>the C implementation only wants instances of Element)

The message, imo, is confusing and should be changed to Element.remove(x): x 
not in Element.

--
components: Library (Lib)
messages: 294697
nosy: Jim Fasarakis-Hilliard
priority: normal
severity: normal
status: open
title: Elements reports it is a list on Element.remove
type: behavior
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30507] Elements reports it is a list on Element.remove

2017-05-29 Thread Jim Fasarakis-Hilliard

Changes by Jim Fasarakis-Hilliard :


--
nosy: +eli.bendersky, scoder

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30503] It should be possible to use a module name with the same name as a package name

2017-05-29 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30300] asyncio.Controller

2017-05-29 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On May 29, 2017, at 07:07 AM, Antoine Pitrou wrote:

>For example I might write a UDP server.  Or a distributed system that listens
>to several ports at once, or launches a thread pool. etc.

Thanks, those are nice motivational examples.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26098] PEP 510: Specialize functions with guards

2017-05-29 Thread Jim Fasarakis-Hilliard

Changes by Jim Fasarakis-Hilliard :


--
nosy: +Jim Fasarakis-Hilliard

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30496] Incomplete traceback with `exec` on SyntaxError

2017-05-29 Thread Stefan Seefeld

Stefan Seefeld added the comment:

Answering my own question:

It appears I can get the location of a syntax error by inspecting the
raised `SyntaxError`, which solves my specific use-case. 
The bug remains, though: The traceback is incomplete if it stems from a syntax 
error.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9544] xdrlib.Packer().pack_fstring throws a TypeError when called with a str()

2017-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

issue9544.patch LGTM as the first step. There are other mentions of strings in 
the documentation.

--
nosy: +serhiy.storchaka
stage:  -> needs patch
versions: +Python 3.5, Python 3.6, Python 3.7 -Python 3.2, Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30216] xdrlib.Unpacker.unpack_string returns bytes (docs say should be str)

2017-05-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> duplicate
stage: needs patch -> resolved
status: open -> closed
superseder:  -> xdrlib.Packer().pack_fstring throws a TypeError when called 
with a str()

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30216] xdrlib.Unpacker.unpack_string returns bytes (docs say should be str)

2017-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Partially. Thank you for pointing on the predecessor Jan.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16500] Allow registering at-fork handlers

2017-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The one of potential advantages of the API proposed by Gregory is that 
os.register_at_fork() can be made atomic. Either register all callbacks, or do 
nothing in the case of error. But current proposed implementation is not 
atomic. If resizing of some list is failed due to MemoryError (or may be 
KeyboardInterrupt), some callbacks can already be registered.

Is it worth to guarantee the atomicity of os.register_at_fork().

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16500] Allow registering at-fork handlers

2017-05-29 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Le 29/05/2017 à 18:35, Serhiy Storchaka a écrit :
> 
> Is it worth to guarantee the atomicity of os.register_at_fork().

I don't think so, honestly.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30507] Elements reports it is a list on Element.remove

2017-05-29 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> The message, imo, is confusing

Sorry, I think this is an invented issue and not a actual problem.  ElementTree 
has been in the wild for a very long time.  AFAICT, no user has ever had an 
actual issue with this error message.  I've taught ElementTree (specifically 
including this method) at least one per month over six years and have never 
seen the slightest issue with these error messages (in PyPy, the actual 
ElementTree.py is used).

It would just be code clutter to wrap this and all the other accessors in:

try:
 self._children.remove(subelement)
except ValueError:
 raise ValueError('Element.remove(x): x not in Element')

I would like the standard library to *not* be filled with this sort of thing.  
The norm in pure Python code is to let the error checking occur at the lowest 
level and propagate its way up with its original error message.  Usually, the 
only time we rewrap the exception is if the message would be far off from the 
actual cause.

I'm concerned at the recent rise of "invented issues" where newcomers posit 
that long deployed, stable code, written by very smart people must be changed 
even though no actual user has ever been encountered.

Invented issues waste developer time and distract from the numerous real issues 
we have to deal with.  It also seems to be encouraging a mentality of roaming 
through the codebase with a desire to make numerous trivial changes and while 
second-guessing all the design decisions made a long time ago.  This isn't good 
for our project.

Guido has long encouraged "holistic refactoring" for a reason.  This particular 
tracker issue is a case study about why that is the case.  The origin of this 
issue was grepping the standard lib for "ValueError" and "remove" with the aim 
of second guessing every message.  It was not born out of actual usage of or 
concern for the ElementTree module.   

The reason that matters is that someone working with the module as a whole 
would have realized that this tracker issue is at odds with its creator's 
intended design as a thin wrapper around lists.  The docs explicitly describe 
the API "as a cross between a list and a dictionary".

This one error message isn't atypical (you get the same mention of "list" in 
most of the methods such as __getitem__, __setitem__, __delitem__, insert, etc).

We really don't want to start a practice of having every pure python class that 
accesses a list or dict revise its code to rewrap the error messages just to 
change the class mentioned in the message.  This isn't a normal pythonic 
practice.  It would just clutter, constipate, and slow down the code for nearly 
zero benefit.

We really should place more value on code stability, start focusing on modules 
holistically, respond to actual user issues rather than invented issues, avoid 
frequent trivial changes, and consider that the developers who came before us 
might have given a great deal of thought into their code.

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16500] Allow registering at-fork handlers

2017-05-29 Thread Gregory P. Smith

Gregory P. Smith added the comment:


New changeset 163468a766e16604bdea04a1ab808c0d3e729e5d by Gregory P. Smith in 
branch 'master':
bpo-16500: Don't use string constants for os.register_at_fork() behavior (#1834)
https://github.com/python/cpython/commit/163468a766e16604bdea04a1ab808c0d3e729e5d


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30506] Replace 'list' with 'array' in array.remove and array.index

2017-05-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16500] Allow registering at-fork handlers

2017-05-29 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
stage: commit review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30497] Line number of docstring in AST

2017-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Even if the line number of a docstring is known, it is not easy to determine 
the line number corresponding to the particular line in a docstring if it 
contains backslashes following by newline.

'''foo
bar
'''

and

'''\
foo
bar
'''

are equal strings, but the lines 'bar' have different offsets from the start of 
the strings.

The only robust method was parsing the source code starting from the start of a 
docstring. Now you just need to start parsing from the start of the 
function/class.

--
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30506] Replace 'list' with 'array' in array.remove and array.index

2017-05-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30496] Incomplete traceback with `exec` on SyntaxError

2017-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The traceback contain the location of the code that raised an exception when 
executed. In case of NameError this is a line in your script "x=u". In case of 
SyntaxError the code that failed is not in your script (it still is not 
executed), but in a compiler implicitly called by exec(). The line with exec() 
is correctly reported.

The behavior looks correct to me.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30497] Line number of docstring in AST

2017-05-29 Thread Steven Myint

Steven Myint added the comment:

I think what you guys have brought up makes sense.

Now that you mention it, I see that pyflakes gives the wrong line number if an 
escaped newline appears after the doctests. Though, it works fine if the 
escaped newline appears before it.

https://github.com/PyCQA/pyflakes/blob/1af4f14ad4675bf5c61c47bbb7c2421b50d1cba4/pyflakes/checker.py#L842

This is a non-default feature in pyflakes anyway, so we can live with it.

Thanks

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30496] Incomplete traceback with `exec` on SyntaxError

2017-05-29 Thread Stefan Seefeld

Stefan Seefeld added the comment:

OK, fair enough, that makes sense. As I said, in my last message, I was mainly 
simply trying to figure out the exact location of the error in the executed 
script, which I got from inspecting the SyntaxError.
So if all of this is expected behaviour, I think we can close this issue.

Many thanks for following up.

--
resolution:  -> not a bug
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28533] Replace asyncore

2017-05-29 Thread Grzegorz Grzywacz

Grzegorz Grzywacz added the comment:

I would like to work on this issue.

I think it's a good idea to split this task into few parts/PR.

Let me start from ./Lib/test/test_poplib.py.

What about rewriting pop3 server stub using asyncio, i think requests could be 
handled synchronously, there will be no benefits from asynchronous.

Please let me know what you think.

--
nosy: +grzgrzgrz3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16500] Allow registering at-fork handlers

2017-05-29 Thread STINNER Victor

STINNER Victor added the comment:

> New changeset 163468a766e16604bdea04a1ab808c0d3e729e5d by Gregory P. Smith in 
> branch 'master':
> bpo-16500: Don't use string constants for os.register_at_fork() behavior 
> (#1834)
> https://github.com/python/cpython/commit/163468a766e16604bdea04a1ab808c0d3e729e5d

Since there was a disagreement, FYI I also prefer this API. Just the
API, I didn't look at the implementation in detail.

Anyway, it's nice to see this very old issue finally fixed! It was
opened 5 years ago!

I also prefer to have a builtin registered callback in the random
module instead of having a custom callback in the multiprocessing
module to re-seed the RNG after fork!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28533] Replace asyncore

2017-05-29 Thread STINNER Victor

STINNER Victor added the comment:

> I think it's a good idea to split this task into few parts/PR. Let me start 
> from ./Lib/test/test_poplib.py.

Once you have a patch, open a new issue and mention it here.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28533] Replace asyncore

2017-05-29 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
stage:  -> needs patch
versions: +Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30501] Produce optimized code for boolean conditions

2017-05-29 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Will this negatively impact code coverage reporting or code tracing (by 
optimizing across basic blocks)?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30501] Produce optimized code for boolean conditions

2017-05-29 Thread Raymond Hettinger

Raymond Hettinger added the comment:

The improved code does look better.  I'm +1 on this proposal as long as we're 
sure it doesn't introduce any new problems.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30361] Docs example: converting mixed types to floating point

2017-05-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:


New changeset e405d4b8dfb8b497e1c3d1f0f8e28030040c165e by terryjreedy (gfyoung) 
in branch 'master':
bpo-30361: Use better example for mixed-type operands (#1701)
https://github.com/python/cpython/commit/e405d4b8dfb8b497e1c3d1f0f8e28030040c165e


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30361] Docs example: converting mixed types to floating point

2017-05-29 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

Thanks for merging the PR, Terry.

Now it needs backport :)

--
stage:  -> backport needed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30361] Docs example: converting mixed types to floating point

2017-05-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Go ahead.  I don't care much either way.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30361] Docs example: converting mixed types to floating point

2017-05-29 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +1940

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30361] Docs example: converting mixed types to floating point

2017-05-29 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +1939

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30361] Docs example: converting mixed types to floating point

2017-05-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:


New changeset d52f47a8f7794ee09151973a00d29c8612672e7a by terryjreedy 
(Mariatta) in branch '3.6':
[3.6] bpo-30361: Use better example for mixed-type operands (GH-1701) (#1856)
https://github.com/python/cpython/commit/d52f47a8f7794ee09151973a00d29c8612672e7a


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30361] Docs example: converting mixed types to floating point

2017-05-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:


New changeset 03c7cfcd52be702957cc174f5cb2ce4c8be8bfca by terryjreedy 
(Mariatta) in branch '3.5':
[3.5] bpo-30361: Use better example for mixed-type operands (GH-1701) (#1857)
https://github.com/python/cpython/commit/03c7cfcd52be702957cc174f5cb2ce4c8be8bfca


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30361] Docs example: converting mixed types to floating point

2017-05-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Just curious, what sprint?

--
resolution:  -> fixed
stage: backport needed -> resolved
status: open -> closed
type:  -> enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30361] Docs example: converting mixed types to floating point

2017-05-29 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

Sorry, I don't know whether this was a sprint project or not.]
Saw that the original PR has sprint label on it, I merely copied them over to 
the backport PRs.

Thanks.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30346] Odd behavior when unpacking `itertools.groupby`

2017-05-29 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I've looked at the patches but am still thinking about what I prefer before 
committing to a re-design.  Please give it a little time.  There is zero 
urgency here (nothing is broken, no user complaints, etc).   I have a bunch of 
other stuff on my plate for a little while and this isn't the top priority.  I 
had asked to hold off on PRs until a decision is made and not rush into coding 
(which is usually the easy part).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30484] Garbage Collector can cause Segfault whilst iterating dictionary items

2017-05-29 Thread Jelle Zijlstra

Jelle Zijlstra added the comment:

I could reproduce this on 3.4, but not on 3.3, 2.7, or master.

--
nosy: +Jelle Zijlstra
versions: +Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16500] Allow registering at-fork handlers

2017-05-29 Thread Gregory P. Smith

Gregory P. Smith added the comment:

This may also allow us to do something reasonable for 
http://bugs.python.org/issue6721 as well.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30300] asyncio.Controller

2017-05-29 Thread Yury Selivanov

Yury Selivanov added the comment:

I'm not sure we want this to be in asyncio: it's a very high-level object 
somewhere in between the low-level and the application level.  Some things off 
the top of my head that users will want from this API:

- detailed logging or hooks to implement it
- hooks on thread start / stop
- coroutines to run before starting the server
- coroutines to run before stopping the loop
- custom undhandled exceptions handlers
- type of the server created: TCP/UDP/Unix
- ability to configure SSL
- etc

Since asyncio is no longer provisional, it won't be possible to evolve the API 
in bugfix releases, which will likely make it impossible to use for many users 
until 3.8.

In general, the advice for things like this is to put them on PyPI, gather some 
feedback, and sort out the API details.

-1 to add this in 3.7 in its current state.

P.S. It would be interesting to try to evolve the idea a bit further: it would 
be interesting if Controller was a high-level description of a service and we 
had a separate concept of ControllerRunner to run Controllers in threads, 
processes and corotuines.  Maybe build something like erlang supervisor trees 
out of them.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30501] Produce optimized code for boolean conditions

2017-05-29 Thread Emily Morehouse

Changes by Emily Morehouse :


--
nosy: +emilyemorehouse

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6721] Locks in the standard library should be sanitized on fork

2017-05-29 Thread Gregory P. Smith

Gregory P. Smith added the comment:

http://bugs.python.org/issue16500 added the os.register_at_fork() API which may 
be usable for this.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6721] Locks in the standard library should be sanitized on fork

2017-05-29 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
versions: +Python 3.7 -Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30503] It should be possible to use a module name with the same name as a package name

2017-05-29 Thread Steven D'Aprano

Steven D'Aprano added the comment:

This is just module shadowing in action. If you have two or more modules, or 
packages, in the module search path, the first one found will block access to 
the others.

> this is a bad design in my opinion.

*shrug* It is what it is.

Often it is inconvenient. Occasionally it is useful. It is the same way nearly 
all other languages with a library search path works: the compiler searches for 
a library until it finds a match, then stops.

How would you change this? Here are some unacceptable or impractical solutions:

- get rid of the search path, and force the programmer to specify the full file 
system path of every module (package) they import;

- use different syntax for importing a .py module and a package;

- after an import, if there's an error, Python should automatically re-do the 
import with the next module in the module search path;

- "I don't care how you fix it, that's your problem not mine".


I think the answer here is: don't do this. Don't use a package with the same 
name as a module.

--
nosy: +steven.daprano

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29670] argparse: does not respect required args pre-populated into namespace

2017-05-29 Thread paul j3

paul j3 added the comment:

http://bugs.python.org/issue27859
argparse - subparsers does not retain namespace

may complicate this issue.  Due to changes in http://bugs.python.org/issue9351, 
a user defined namespace is not passed to the subparsers.  They get a fresh 
namespace, which is then copied onto the main namespace.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30495] IDLE: modernize textview module

2017-05-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Responses (without yet testing the code):

1. Generally, the only new subclass needed is for the master frame.  Existing 
Toplevel derivatives may have a single frame in the toplevel, which should 
become an instance of a new subclass, in this case TextviewFrame.  Some 
Toplevels contain multiple widgets, which will need to be moved into a new 
master frame.  The idea is that a single master frame can easily be put 
elsewhere.  For testing, it can go into the test root window.  For future IDLE, 
master frames might go on notebook tabs.

So we don't need the new ButtonFrame class.  I suspect that we do not even need 
the current button frame containing just one button.  But removing that can be 
deferred.

2. http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/index.html is a good 
reference for 8.5, with only a few errors I have seen.  The ttk widgets are 
listed from 28 on.  Notebooks are for the future.

3. Yes, but the following should be moved into TextviewFrame.
 # TODO: get fg/bg from theme.
 self.bg = '#ff'
 self.fg = '#00'

4. 'Containing widget', rather than 'calling class'.  ButtonFrame should go 
away.

5. My main objection to super(), that the abbreviated form does not work in 
2.x, does not matter now that I have mostly stopped backporting to 2.7. 

6&7. I prefer the newer, more Pythonic, subscript access and, as I said before, 
string literals. There main issue is making isolated changes in untested code 
versus doing the same in well-tested code as part of refactoring and 
line-by-line examination.

8. I generally prefer .format to %.  For 3.6+, we now have the option of 
f-strings.  The expressions for x and especially y are a bit too long to 
directly include, but temp vars solve that. 

+x = parent.winfo_rootx() + 10,
+y = parent.winfo_rooty() + (10 if not _htest else 100)))
+self.geometry("=750x500+{x}+{y}")

9. Grid is newer than pack, and at least some tk experts recommend using it in 
preference to pack.  (The reference above only covers gridding.  However, 
change is not necessary for the first refactoring.

Are you aware that running gui code files runs a visual sanity check that 
brings up an instance of the window?  One can quickly check the effects of 
changing gui code.

10. Synonyms are a nuisance, especially if one forgets that they are synonyms.  
I would prefer to consistently use the attribute names without the 'wm_' 
prefix.  I will try to remember to fix help.py when editing it next.

--
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29766] --with-lto still implied by --enable-optimizations in Python 2.7

2017-05-29 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +1941

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29766] --with-lto still implied by --enable-optimizations in Python 2.7

2017-05-29 Thread Gregory P. Smith

Gregory P. Smith added the comment:


New changeset 1f29cefc87c4c2ee629367ebe97a287d8e0b3e29 by Gregory P. Smith 
(Hanno Schlichting) in branch '2.7':
bpo-29766: Do not force --with-lto to true for --enable-optimizations (#1858)
https://github.com/python/cpython/commit/1f29cefc87c4c2ee629367ebe97a287d8e0b3e29


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29766] --with-lto still implied by --enable-optimizations in Python 2.7

2017-05-29 Thread Gregory P. Smith

Gregory P. Smith added the comment:

indeed, my mistake in the original backport.  thanks!

--
assignee:  -> gregory.p.smith
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
type:  -> compile error

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30508] "Task exception was never retrieved" reported for a canceled task

2017-05-29 Thread Miguel Grinberg

New submission from Miguel Grinberg:

I am seeing a strange issue that occurs when a task that is awaiting an 
asyncio.wait_for() is cancelled. I created a simple example that I think 
demonstrates the issue, even though it isn't exactly how it manifests on my 
application.

When I run the attached script never-retrieved.py I get the following error:

Task exception was never retrieved
future:  
exception=ZeroDivisionError('division by zero',)>
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
  File "never-retrieved.py", line 5, in crash
a = 1/0
ZeroDivisionError: division by zero

You can see in the script that the future was cancelled, but the cancel() call 
was made after the task finished in a zero division error. I think the cancel() 
call should update the internal state of the future so that the "exception was 
never retrieved" error does not appear.

My application has a more complex setup that I have been unable to reproduce 
with a simple example. I have a task that is waiting on asyncio.wait_for(fut, 
timeout), with fut subsequently waiting on a websocket server's receive 
function. When the websocket client closes the connection, a bunch of 
cancellations happen, but this future inside the wait_for call crashes before 
wait_for gets to call cancel() on it. Even though I need to investigate this 
crash, the fact is that wait_for did cancel this future, but because it already 
ended in an error the "never retried" error is reported anyway.

--
components: asyncio
files: never-retrieved.py
messages: 294732
nosy: Miguel Grinberg, yselivanov
priority: normal
severity: normal
status: open
title: "Task exception was never retrieved" reported for a canceled task
type: behavior
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file46911/never-retrieved.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30508] "Task exception was never retrieved" reported for a canceled task

2017-05-29 Thread Yury Selivanov

Yury Selivanov added the comment:

Yes, this is a known problem to me, thank you for creating the issue. Will work 
on a fix soon.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23787] sum() function docstring lists arguments incorrectly

2017-05-29 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +1942

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23787] sum() function docstring lists arguments incorrectly

2017-05-29 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23699] Add a macro to ease writing rich comparisons

2017-05-29 Thread Nick Coghlan

Nick Coghlan added the comment:

Assigning to myself to review.

To add some context that hasn't come up previously, the essential idea for this 
macro originated in the "Py3C" extension module compatibility project, where it 
helps authors of Python 2 extension modules update their projects to be 
compatible with Python 3: 
https://py3c.readthedocs.io/en/latest/reference.html#comparison-helpers

As with most such pattern extractions, the key intent is to make it easier for 
developers to correctly implement a Python-specific protocol in C by replacing 
the current copy-and-paste handling of such cases with the use of C's 
preprocessor.

--
assignee:  -> ncoghlan
nosy: +ncoghlan
stage:  -> patch review
versions: +Python 3.7 -Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27115] IDLE: replace used of tkinter simpledialog with query.Query

2017-05-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:

We should not change simpledialog.py, but we could change bindings after import.

However, since last summer, we can instead replace simpledialog.py with 
subclasses of ttk-using query.Query, with custom validators. editor.py uses 
askinterger for indent width, columns/tab, and goto line number. Iomenu uses 
askstring for encoding.  I have already planned to use Query for the line# box.

--
title: IDLE/tkinter: in simpledialog,  != [OK] click -> IDLE: replace 
used of tkinter simpledialog with query.Query
versions: +Python 3.7 -Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27115] IDLE: replace uses of tkinter simpledialog with query.Query

2017-05-29 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
title: IDLE: replace used of tkinter simpledialog with query.Query -> IDLE: 
replace uses of tkinter simpledialog with query.Query

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15786] IDLE code completion window can hang or misbehave with mouse

2017-05-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Click still causes disappearance with fresh binary on Win10.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29596] Unfinished sentence in howto/clinic.rst

2017-05-29 Thread Martin Panter

Martin Panter added the comment:

Currently for the “buffer” destination, it says

Suppress . . ., write . . . to ``block``, and write everything else to ``file``.

Would it be more correct to change “file“ to “buffer”? I.e.

Suppress . . ., write . . . to ``block``, and write everything else to 
``buffer``.

--
components: +Argument Clinic
nosy: +martin.panter
stage: needs patch -> patch review
title: Unfinished sentense in howto/clinic.rst -> Unfinished sentence in 
howto/clinic.rst

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30446] Embedded 3.6.1 distribution cannot find _socket module

2017-05-29 Thread Thomas Stevenson

Thomas Stevenson added the comment:

Thank you Steve and Zachary.  The context you provided helped me track it down, 
so I have marked this closed.  In case it benefits anyone in future as well, I 
ran into a subsequent topic where the C++ app was compiled in debug and hence 
the actual file being looked for was _socket_d.pyd which is not in the embedded 
distributable of course.

Thanks again for taking the time to provide your insights.

Thomas

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30509] Optimize calling type slots

2017-05-29 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

In excellent Peter Cawley's article "Why are slots so slow?" [1] analysed 
causes why `a + b` is slower than `a.__add__(b)` for custom __add__ and 
provided suggestions for optimizing type slot calls. `a + b` and `a.__add__(b)` 
execute the same user code, `a + b` should have smaller overhead of bytecode 
interpreting, but it was 2 times slower than  `a.__add__(b)`. In the article `a 
+ b` has been made 16% faster than `a.__add__(b)`.

In 3.7 the difference between two ways is smaller, but `a + b` still is 25-30% 
slower than `a.__add__(b)`. After analyzing the article and comparing it with 
the current code I have found that virtually all proposed optimization steps 
already applied in 3.7 by Victor! The difference is only in details.

The proposed patch tweaks the code and makes `a + b` only 12% slower than 
`a.__add__(b)`. There is similar effect for other type slot calls.

[1] https://www.corsix.org/content/why-are-slots-so-slow

--
components: Interpreter Core
files: type-slot-calls.diff
keywords: patch
messages: 294739
nosy: haypo, pitrou, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Optimize calling type slots
type: performance
versions: Python 3.7
Added file: http://bugs.python.org/file46912/type-slot-calls.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30509] Optimize calling type slots

2017-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Despite the fact that `a + b` still is slower than `a.__add__(b)` in 3.7, it is 
more than 2 times faster than in 2.7 and 3.5.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com