[issue33414] Make shutil.copytree use os.scandir to take advantage of cached is_(dir|file|symlink)

2018-05-03 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Could you show an example that exposes a significant overhead of the current 
implementation?

There were reasons of using os.scandir() in os.walk() and glob.glob(). You may 
scan thousands of files and performs a heavy I/O only with few of them. There 
was smaller reason of using it in shutil.rmtree() -- removing an entry from the 
directory is fast, but likely you will spent much more time for creating a tree.

But I don't know reasons of using it in shutil.copytree() in which you need to 
performs a heavy I/O with every file and directory.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33038] GzipFile doesn't always ignore None as filename

2018-05-03 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

The workaround in the current 2.7 is specifying an explicit filename argument:

with tempfile.SpooledTemporaryFile() as fd:
with gzip.GzipFile(filename='', mode='wb', fileobj=fd) as gz:
gz.write(b'asdf')

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33415] When add_mutually_exclusive_group is built without argument, the help breaks with "IndexError: list index out of range"

2018-05-03 Thread Ariel Otilibili Anieli

New submission from Ariel Otilibili Anieli :

Hello,

When add_mutually_exclusive_group is built without argument, the help breaks 
with "IndexError: list index out of range". Indeed this snippet:

actions_ = parser.add_argument_group('Actions')
actions  = actions_.add_mutually_exclusive_group()

Breaks the help of argparse:

# --help
Traceback (most recent call last):
  File "./ovpauto", line 135, in 
args = parser.parse_args()
  File "/usr/lib/python2.7/argparse.py", line 1701, in parse_args
args, argv = self.parse_known_args(args, namespace)
  File "/usr/lib/python2.7/argparse.py", line 1733, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
  File "/usr/lib/python2.7/argparse.py", line 1939, in _parse_known_args
start_index = consume_optional(start_index)
  File "/usr/lib/python2.7/argparse.py", line 1879, in consume_optional
take_action(action, args, option_string)
  File "/usr/lib/python2.7/argparse.py", line 1807, in take_action
action(self, namespace, argument_values, option_string)
  File "/usr/lib/python2.7/argparse.py", line 996, in __call__
parser.print_help()
  File "/usr/lib/python2.7/argparse.py", line 2340, in print_help
self._print_message(self.format_help(), file)
  File "/usr/lib/python2.7/argparse.py", line 2314, in format_help
return formatter.format_help()
  File "/usr/lib/python2.7/argparse.py", line 281, in format_help
help = self._root_section.format_help()
  File "/usr/lib/python2.7/argparse.py", line 211, in format_help
func(*args)
  File "/usr/lib/python2.7/argparse.py", line 319, in _format_usage
action_usage = format(optionals + positionals, groups)
  File "/usr/lib/python2.7/argparse.py", line 390, in _format_actions_usage
start = actions.index(group._group_actions[0])
IndexError: list index out of range

Moreover, the trace does not say whence the error came from.

# uname -a 
Linux quasar 4.8.0-2-amd64 #1 SMP Debian 4.8.15-2 (2017-01-04) x86_64 GNU/Linux

#  lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:Debian GNU/Linux testing (buster)
Release:testing
Codename:   buster

#  gcc --version
gcc (Debian 7.3.0-17) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# python --version 
Python 2.7.15rc1

#  dpkg -l | grep -P '\s+python\s+.*2.7.15'
ii  python   
2.7.15~rc1-1   amd64interactive 
high-level object-oriented language (default version)

Regards,
Ariel

--
messages: 316113
nosy: ariel-anieli, bethard
priority: normal
severity: normal
status: open
title: When add_mutually_exclusive_group is built without argument, the help 
breaks with "IndexError: list index out of range"
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue3692] improper scope in list comprehension, when used in class declaration

2018-05-03 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

Mariatta,

> While I understand why it behaves the way it is now, but it seems wrong 
> behavior. Perhaps we should look into finding a solution.

I am all in favour of dropping implicit function scope in comprehensions 
(mostly because of weirdness like described here, but it will also fix some 
`yield` issues and simplify some `await` aspects). But I was not able to 
convince others it worth the effort. Maybe we can make another attempt at 
discussing this?

--
nosy: +gvanrossum, levkivskyi, serhiy.storchaka

___
Python tracker 

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



[issue33346] Syntax error with async generator inside dictionary comprehension

2018-05-03 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

My guess this is a consequence of the implicit function scope in 
comprehensions, see https://bugs.python.org/issue3692

I would say a proper solution would be to drop the implicit function scope in 
favour of other mechanisms, but this will require some work and discussions.

--
nosy: +levkivskyi

___
Python tracker 

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



[issue3692] improper scope in list comprehension, when used in class declaration

2018-05-03 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

See https://bugs.python.org/issue33346 for yet another example where implicit 
function scope complicates life.

--

___
Python tracker 

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



[issue33337] Provide a supported Concrete Syntax Tree implementation in the standard library

2018-05-03 Thread Ivan Levkivskyi

Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

___
Python tracker 

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



[issue33416] Add endline and endcolumn to every AST node

2018-05-03 Thread Ivan Levkivskyi

New submission from Ivan Levkivskyi :

Some Python tools (in particular I am interested in type checkers) will benefit 
from knowing where a given expression ends to indicate/highlight location of an 
error in the source code. Other tools and IDEs may have also some other 
benefits. Currently such tools need to use some hacks and/or custom parser to 
find the end line and end column of an expression, while it would be more 
straightforward to just add this information to every AST node by CPythons own 
parser.

This will increase memory usage, but expectation is that this effect will be 
minor.

What do you think?

--
components: Interpreter Core
messages: 316117
nosy: gvanrossum, levkivskyi, lukasz.langa, serhiy.storchaka, vstinner
priority: normal
severity: normal
status: open
title: Add endline and endcolumn to every AST node
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue33417] Isinstance() behavior is not consistent with the document

2018-05-03 Thread weapon

New submission from weapon :

In the PEP 3119(https://www.python.org/dev/peps/pep-3119/),it introduce about 
Customizing instance and subclass checks.

>The primary mechanism proposed here is to allow overloading the built-in 
>functions isinstance() and issubclass(). The overloading works as follows: The 
>call isinstance(x, C) first checks whether C.__instancecheck__ exists, and if 
>so, calls C.__instancecheck__(x) instead of its normal implementation.


but my code doesn't works.
```
class Sizeable(object):
def __instancecheck__(cls, instance):
print("__instancecheck__ call")
return hasattr(instance, "__len__")

class B(object):
pass

b = B()
print(isinstance(b, Sizeable)) # output:False
```
The __instancecheck__ function  is not called. In PyObject_IsInstance,when 
isinstance(x, C) the following three conditions are reached, __instancecheck__ 
will take effect:
1. x can not be directly instantiated by C;

2. The C class specifies the metaclass;

3. The __instancecheck__ in the specified metaclass class is defined.

This code can work:
```
class MetaSizeable(type):
def __instancecheck__(cls, instance):
print("__instancecheck__ call")
return hasattr(instance, "__len__")

class Sizeable(metaclass=MetaSizeable):
pass

class B(object):
pass

b = B()
print(isinstance(b, Sizeable))  # output: False
print(isinstance([], Sizeable)) # output: True
```

So,the problem is that the document does not conform to the reality.Can it be 
guaranteed that __instancecheck__  is always called?

If yes: PyObject_IsInstance should be tweaked.
If no:  document should be tweaked.

--
assignee: docs@python
components: Documentation, Interpreter Core
messages: 316118
nosy: docs@python, hongweipeng
priority: normal
severity: normal
status: open
title: Isinstance() behavior is not consistent with the document
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



[issue33315] Allow queue.Queue to be used in type annotations

2018-05-03 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

> Could you please product a draft PR showing how that would work? It might
not be accepted right away but it would be useful to have.

It is not 100% clear to whom this was addressed. Anyway, Semyon, if you don't 
have time, then I can make a simple PR, otherwise can you try doing it yourself?

--

___
Python tracker 

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



[issue32962] test_gdb fails in debug build with `-mcet -fcf-protection -O0`

2018-05-03 Thread Charalampos Stratakis

Change by Charalampos Stratakis :


--
nosy: +Dormouse759

___
Python tracker 

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



[issue4470] smtplib SMTP_SSL not working.

2018-05-03 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

This issue has been in pending status for over 18 months following Christian's 
question to the OP, so closing as out of date.

--
nosy: +csabella
resolution:  -> out of date
stage: patch review -> resolved
status: pending -> closed

___
Python tracker 

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



[issue8613] Decimal module flags undetermined when a signal is trapped.

2018-05-03 Thread Cheryl Sabella

Change by Cheryl Sabella :


--
status: pending -> closed

___
Python tracker 

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



[issue32769] Add 'annotations' to the glossary

2018-05-03 Thread Andrés Delfino

Andrés Delfino  added the comment:

Guido, now that we are working on this, perhaps you can list what other terms 
related to type hints/annotations you were thinking for addition.

--

___
Python tracker 

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



[issue31463] test_multiprocessing_fork hangs test_subprocess

2018-05-03 Thread STINNER Victor

Change by STINNER Victor :


--
nosy: +vstinner

___
Python tracker 

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



[issue33414] Make shutil.copytree use os.scandir to take advantage of cached is_(dir|file|symlink)

2018-05-03 Thread Andrés Delfino

Andrés Delfino  added the comment:

To be frank, I just searched the tree for uses of listdir() combined with 
isdir()/isfile()/issymlink(). Thought that using scandir() would make sense, 
and didn't think of a reason for not using it. That being said, I cannot state 
a case and I'll be happy to close the PR if there's no need for this :)

--

___
Python tracker 

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



[issue33414] Make shutil.copytree use os.scandir to take advantage of cached is_(dir|file|symlink)

2018-05-03 Thread STINNER Victor

Change by STINNER Victor :


--
nosy: +vstinner

___
Python tracker 

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



[issue33332] Expose valid signal set (sigfillset()): add signal.valid_signals()

2018-05-03 Thread STINNER Victor

Change by STINNER Victor :


--
title: Expose valid signal set (sigfillset()) -> Expose valid signal set 
(sigfillset()): add signal.valid_signals()

___
Python tracker 

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




[issue32414] PyCapsule_Import fails when name is in the form 'package.module.capsule'

2018-05-03 Thread Nick Coghlan

Nick Coghlan  added the comment:

"package.module:attribute" is also the syntax used in packaging tools to 
unambiguously separate the name of the module to be imported from the attribute 
chain to be looked up within that module: 
https://packaging.python.org/specifications/entry-points/

So +1 from me for extending it to this use case as well.

--

___
Python tracker 

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



[issue32981] Catastrophic backtracking in poplib (CVE-2018-1060) and difflib (CVE-2018-1061)

2018-05-03 Thread STINNER Victor

STINNER Victor  added the comment:

FYI I tracked this vulnerability at:
http://python-security.readthedocs.io/vuln/cve-2018-1060_difflib_and_poplib_catastrophic_backtracking.html

--
nosy: +vstinner

___
Python tracker 

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



[issue20722] newline is (partially) independent of universal newlines; needs to be made more clear in docs

2018-05-03 Thread Cheryl Sabella

Change by Cheryl Sabella :


--
stage:  -> needs patch
type:  -> enhancement
versions: +Python 3.8 -Python 3.4

___
Python tracker 

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



[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-03 Thread Ivan Pozdeev

Change by Ivan Pozdeev :


Added file: 
https://bugs.python.org/file47565/0001-Build-non-threaded-debug-Tcl.zip

___
Python tracker 

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



[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-03 Thread Ivan Pozdeev

Change by Ivan Pozdeev :


Added file: 
https://bugs.python.org/file47566/0001-build-2.7-with-threaded-Tcl.patch

___
Python tracker 

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



[issue33418] Memory leaks in functions

2018-05-03 Thread Jeroen Demeyer

New submission from Jeroen Demeyer :

This is a memory leak:

>>> while True:
...def f(): pass
...f.__doc__ = f

This also:

>>> while True:
... f = [].append   


... f.__module__ = f

This is because the classes "function" and "builtin_function_or_method" do not 
implement tp_clear.

--
messages: 316125
nosy: jdemeyer
priority: normal
severity: normal
status: open
title: Memory leaks in functions

___
Python tracker 

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



[issue33418] Memory leaks in functions

2018-05-03 Thread Jeroen Demeyer

Change by Jeroen Demeyer :


--
components: +Interpreter Core
type:  -> resource usage

___
Python tracker 

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



[issue33419] Add functools.partialclass

2018-05-03 Thread Neil Girdhar

New submission from Neil Girdhar :

functools.partial is almost good enough for specifying some of the parameters 
of an object's initializer, but the partial object doesn't respond properly to 
issubclass.  Adding functools.partialclass is similar to the addition of 
partialmethod in 3.4.

--
files: partialclass.diff
keywords: patch
messages: 316126
nosy: neil.g
priority: normal
severity: normal
status: open
title: Add functools.partialclass
versions: Python 3.7
Added file: https://bugs.python.org/file47567/partialclass.diff

___
Python tracker 

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



[issue33420] __origin__ invariant broken

2018-05-03 Thread Adam Paszke

New submission from Adam Paszke :

Hi everyone,

I have a module that needs to inspect type annotations on a few functions. One 
of the types I need to special case on is typing.Tuple, and I used code like 
this to detect it:

if getattr(annotation, '__origin__', None) == typing.Tuple:
... 
else:
...

This was based on the comment from the typing module (Lib/typing.py:609) that 
specified this particular invariant on the __origin__ attribute:

> __origin__ keeps a reference to a type that was subscripted,
  e.g., Union[T, int].__origin__ == Union;

Everything worked just fine until I checked it on the alpha release of Python 
3.7 in my CI. Turns out, that in that release we have

typing.Tuple[str, int].__origin__ == tuple

and not (which is the case in e.g. 3.6)

typing.Tuple[str, int].__origin__ == typing.Tuple


I know this is not a documented attribute, so it can change, but I wanted to 
highlight that it's either a regression, or the comment will need to be 
updated, so people won't try to depend on that.

--
components: Library (Lib)
messages: 316127
nosy: apaszke
priority: normal
severity: normal
status: open
title: __origin__ invariant broken
type: behavior
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue33419] Add functools.partialclass

2018-05-03 Thread Neil Girdhar

Change by Neil Girdhar :


--
components: +Library (Lib)
type:  -> enhancement

___
Python tracker 

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



[issue33419] Add functools.partialclass

2018-05-03 Thread Neil Girdhar

Change by Neil Girdhar :


Added file: https://bugs.python.org/file47568/partialclass2.diff

___
Python tracker 

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



[issue33418] Memory leaks in functions

2018-05-03 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka
versions: +Python 2.7, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue33420] __origin__ invariant broken

2018-05-03 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +gvanrossum, levkivskyi

___
Python tracker 

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



[issue33419] Add functools.partialclass

2018-05-03 Thread Neil Girdhar

Neil Girdhar  added the comment:

I edited some of the documentation as well to use the technical terms "partial 
function application", "partial method application", and "partial class 
application".  This emphasizes the parallel structure and reduces confusion 
with "partial functions" that mean something else in other languages.

I also removed a phrase that used the term "freezes" since in Python "frozen" 
is also used in frozenset to mean frozen for good whereas the keyword arguments 
in a partial function application are overridable.

--

___
Python tracker 

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



[issue33315] Allow queue.Queue to be used in type annotations

2018-05-03 Thread Semyon Proshev

Semyon Proshev  added the comment:

I'm not sure that I'll be able to make a PR quickly, so feel free to do it

--

___
Python tracker 

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



[issue33420] __origin__ invariant broken

2018-05-03 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

Yes, the comment needs to be updated, but as you said, no guaranties about 
undocumented dunder attribute. We tried to preserve as much of the API as 
possible in 3.7 after PEP 560, but something needs to be sacrificed (especially 
in the purely internal API you used).

You may instead use `typing_inspect` library on PyPI, I am not 100% sure it 
will help in your case, but it has `is_tuple_type` function that should work 
across several versions of `typing`.

--

___
Python tracker 

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



[issue33420] __origin__ invariant broken

2018-05-03 Thread Adam Paszke

Adam Paszke  added the comment:

Of course, I'm not expecting this to be 100% reliable, and so I'm ok with the 
answer that the comment is now outdated.

I'd like to avoid adding extra dependencies for so simple things, so I guess 
I'll just special case that in my code for now. It would be great if the typing 
module had some tools for introspection built in!

--

___
Python tracker 

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



[issue33412] Tkinter hangs if using multiple threads and event handlers

2018-05-03 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

>From 1994 to 2017, _tkinter.c has received a steady flow of multiple revisions 
>each year, for 333 total, by maybe 20 people including Guido.  This makes it 
>one of the more actively maintained files and indicates the opposite of 
>indifference and not caring.

I tested event generation from threads on my Win 10 machine.  With installed 
2.7, with non-thread tcl 8.5, the process hangs as described, after 1 key event 
is sent and received.  So we should document "don't do that".

With installed 64-bit 3.6 with thread-compiled tcl 8.6, I see something 
completely different.  The process runs for 5 seconds until the stop call.  The 
two threads alternate sending key events, which are all received in the main 
thread.  Ditto for built 32-big debug 3.6 and 3.8.  

The only problem is that the first t.join() hangs because of a thread deadlock 
bug.  t.join() blocks until t.run exits.  t.run does not exit until the last 
event_generate, with running=False, returns.  But that blocks until 
dummy_handler runs.  Dummy_handler does not run when the main thread is blocked 
by t.join.

I fixed this by not generating events when running is False.  The revised 
program exits properly.

def run(self):
tid = self.ident
while True:
time.sleep(0.02)
c = random.choice(string.ascii_letters)
print(running, "%d: sending '%s'"%(tid,c),file=sys.stderr)
if running:
self.target.event_generate(c)
else:
break

I suppose there is a teeny possibility that 'running' could be flipped between 
the test and the call.  Can that be prevented with a lock?

Another possibility is for stop() to change conditions so that 
'self.target.event_generate(c)' fails with an exception, and change if/else to 
for/except.  My first try sort of works in IDLE but not the console.

--
nosy: +serhiy.storchaka, terry.reedy

___
Python tracker 

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



[issue33375] warnings: get filename from frame.f_code.co_filename

2018-05-03 Thread Thomas Kluyver

Thomas Kluyver  added the comment:

Hi Brett! If you get a moment, any review of the linked PR would be welcome. :-)

https://github.com/python/cpython/pull/6622

--

___
Python tracker 

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



[issue33375] warnings: get filename from frame.f_code.co_filename

2018-05-03 Thread Brett Cannon

Brett Cannon  added the comment:

I just added myself to review the PR. At worst I will get to it during the
sprints at PyCon US.

On Thu, 3 May 2018 at 12:52 Thomas Kluyver  wrote:

>
> Thomas Kluyver  added the comment:
>
> Hi Brett! If you get a moment, any review of the linked PR would be
> welcome. :-)
>
> https://github.com/python/cpython/pull/6622
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue33375] warnings: get filename from frame.f_code.co_filename

2018-05-03 Thread Thomas Kluyver

Thomas Kluyver  added the comment:

Thanks! No rush, I just thought I'd take the opportunity when you added 
yourself to the nosy list.

--

___
Python tracker 

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



[issue32625] Update the dis module documentation to reflect switch to wordcode

2018-05-03 Thread Dmitry Alimov

Dmitry Alimov  added the comment:

The documentation for EXTENDED_ARG opcode should also be updated for Python 
versions 3.6, 3.7, 3.8.

--
nosy: +delimitry
versions: +Python 3.6, Python 3.8

___
Python tracker 

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



[issue22848] Subparser help does not respect SUPPRESS argument

2018-05-03 Thread paul j3

paul j3  added the comment:

I've reviewed the comments and proposed patch, and still think that the custom 
metavar is still the best fix.

subparses.metavar  can be changed after subparsers has been created.  The 
programmer could, for example, write a simple helper function that calls 
add_parser, and also appends names to a list.  Then at the end, turn that list 
into a properly formatted metavar string.

subparsers.metavar = '(%s}'%','.join(['cmd1','foo','cmd3'])

In fact, if I were to write a patch, I'd take this approach, trying to confine 
all changes to the _SubParsersAction.add_parser method, and out of the 
HelpFormatter.

--

___
Python tracker 

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



[issue33419] Add functools.partialclass

2018-05-03 Thread Neil Girdhar

Neil Girdhar  added the comment:

Added functools experts.

Links to relevant stackoverflow questions:

https://stackoverflow.com/questions/38911146/python-equivalent-of-functools-partial-for-a-class-constructor

https://stackoverflow.com/questions/50143864/is-there-a-nice-way-to-partially-bind-class-parameters-in-python/50143893

--
nosy: +ncoghlan, rhettinger

___
Python tracker 

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



[issue33419] Add functools.partialclass

2018-05-03 Thread Eric V. Smith

Eric V. Smith  added the comment:

This has to be a 3.8 feature.

It would be best if you could convert this to a github pull request, and use 
blurb to generate the news entry. But those aren't strictly necessary, someone 
else can do the mechanics of that. I'm willing to do it if you'd like, and at 
the appropriate time.

--
nosy: +eric.smith
versions: +Python 3.8 -Python 3.7

___
Python tracker 

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



[issue33419] Add functools.partialclass

2018-05-03 Thread Neil Girdhar

Change by Neil Girdhar :


Added file: https://bugs.python.org/file47569/partialclass3.diff

___
Python tracker 

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



[issue33419] Add functools.partialclass

2018-05-03 Thread Neil Girdhar

Neil Girdhar  added the comment:

I figured it would have to be 3.8, but it looks like Doc/whatsnew/3.8.rst has 
not been created?  Do I create that?

--

___
Python tracker 

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



[issue33419] Add functools.partialclass

2018-05-03 Thread Eric V. Smith

Eric V. Smith  added the comment:

You'll need to use blurb:

https://pypi.org/project/blurb/
https://devguide.python.org/committing/#what-s-new-and-news-entries

Well, technically it's possible to not use blurb and do it manually, but you'll 
want to use it.

--

___
Python tracker 

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



[issue3692] improper scope in list comprehension, when used in class declaration

2018-05-03 Thread Guido van Rossum

Guido van Rossum  added the comment:

There's a proposal for a fix currently in PEP 572. I'm linking to the commit 
here because we're likely to remove it from PEP 572, but it may be proposed as 
a separate PEP: 
https://github.com/python/peps/commit/71fea57f19231b9917ce6a558c0b763288385398

Bug or not this is not going to change without a PEP, so I'm not sure it's a 
good idea to keep this issue open.

--

___
Python tracker 

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



[issue32769] Add 'annotations' to the glossary

2018-05-03 Thread Guido van Rossum

Guido van Rossum  added the comment:

Perhaps you can start with the more important terms from PEP 484 (and
perhaps also PEP 483, and then PEP 526 and PEP 544). E.g. start with terms
from the ToC of those PEPs.

--

___
Python tracker 

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



[issue33419] Add functools.partialclass

2018-05-03 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +6391
stage:  -> patch review

___
Python tracker 

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



[issue33419] Add functools.partialclass

2018-05-03 Thread Neil Girdhar

Neil Girdhar  added the comment:

Done: https://github.com/python/cpython/pull/6699

--

___
Python tracker 

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



[issue33421] Missing documentation for typing.AsyncContextManager

2018-05-03 Thread Travis DePrato

New submission from Travis DePrato :

The documentation for the typing module makes no mention of 
AsyncContextManager, which is defined in Lib/typing.py as

AsyncContextManager = _alias(contextlib.AbstractAsyncContextManager, T_co)

as of >= Python 3.8; before 3.8, no such AbstractAsyncContextManager class 
exists.

--
assignee: docs@python
components: Documentation
messages: 316145
nosy: Travis DePrato, docs@python, eric.araujo, ezio.melotti, willingc
priority: normal
severity: normal
status: open
title: Missing documentation for typing.AsyncContextManager
type: enhancement
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue32769] Add 'annotations' to the glossary

2018-05-03 Thread Andrés Delfino

Andrés Delfino  added the comment:

Great, I'll look into them.

It will take me some time to make a list of the new terms and write proper 
descriptions. Perhaps we could deliver the updates to the glossary by waves so 
people can make benefit of it? As in multiple PR being merged while retaining 
this issue open until all required terms are added.

--

___
Python tracker 

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



[issue33421] Missing documentation for typing.AsyncContextManager

2018-05-03 Thread Roundup Robot

Change by Roundup Robot :


--
keywords: +patch
pull_requests: +6392
stage:  -> patch review

___
Python tracker 

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



[issue32769] Add 'annotations' to the glossary

2018-05-03 Thread Guido van Rossum

Guido van Rossum  added the comment:

I'm okay with multiple PRs, but do beware that each PR requires a core dev
to open a browser window etc., so try to group them a bit. But no need to
wait for the perfect list!

--

___
Python tracker 

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



[issue33422] Fix and update string/byte literals in help()

2018-05-03 Thread Andrés Delfino

New submission from Andrés Delfino :

Right now, for string/byte literals help() shows, for example:

No Python documentation found for 'r'.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.

PR fixes the quotation mark removal and updates the list with f and u literals, 
while also adding uppercase versions of all literals. While the list is install 
incomplete (e.g., fR and the others could be listed) I believe that's too much.

--
components: Library (Lib)
messages: 316148
nosy: adelfino
priority: normal
severity: normal
status: open
title: Fix and update string/byte literals in help()
versions: Python 3.8

___
Python tracker 

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



[issue33422] Fix and update string/byte literals in help()

2018-05-03 Thread Andrés Delfino

Change by Andrés Delfino :


--
keywords: +patch
pull_requests: +6393
stage:  -> patch review

___
Python tracker 

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



[issue33422] Fix and update string/byte literals in help()

2018-05-03 Thread Andrés Delfino

Andrés Delfino  added the comment:

*While the list is still incomplete

--

___
Python tracker 

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



[issue20104] expose posix_spawn(p)

2018-05-03 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

Since this is a new API, the most important thing is to have decided how we 
want it to look in 3.7, it is okay for it to be missing features so long as the 
API doesn't prevent them from being added in the future.

ie: It is fine to ship it without posix_spawnattr_t attrp "flags" support and 
without the "p" variant supported in 3.7.

Regarding PR 6693, I agree, keyword only arguments for the flags instead of a 
sequence of tuples is a good idea.  Since 3.7b4 has shipped I'm not sure we 
should even consider adding new _features_ to this new API in 3.7 to appear in 
rc1 - though being entirely new it wouldn't break anything, it just doesn't 
give us any change to revise them.  I'd be conservative at this point.

--

___
Python tracker 

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



[issue33412] Tkinter hangs if using multiple threads and event handlers

2018-05-03 Thread Ivan Pozdeev

Ivan Pozdeev  added the comment:

> Another possibility is for stop() to change conditions so that 
> 'self.target.event_generate(c)' fails with an exception

Could you elaborate? Since there're no docs on event_generate(), I can't look 
up how to make it "fail with an exception" without actually posting an event.


> The only problem is that the first t.join() hangs because of a thread 
> deadlock bug.  t.join() blocks until t.run exits.  t.run does not exit until 
> the last event_generate, with running=False, returns.  But that blocks until 
> dummy_handler runs.
> I suppose there is a teeny possibility that 'running' could be flipped 
> between the test and the call.  Can that be prevented with a lock?

The idea is to let the worker threads finish their work, not terminate them 
forcibly.
So the real problem is that stop() blocks the event loop.
It should rather run asynchronously, wait for threads, then trigger 
`self.root.destroy()` in the main thread... somehow.

--
resolution: wont fix -> not a bug

___
Python tracker 

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



[issue33412] Tkinter hangs if using multiple threads and event handlers

2018-05-03 Thread Ivan Pozdeev

Ivan Pozdeev  added the comment:

Attached a fixed script.

`Tk.after()` works from a worker thread, while `Tk.destroy()` doesn't.

That's because Tkinter implements Tcl calls (_tkinter.c:Tkapp_Call) from 
another thread by posting an event to the interpreter's queue 
(Tcl_ThreadQueueEvent) and waiting for result. So a call normally works, but 
would hang if the interpreter's event loop is not running.

`destroy()`'s Python part (Lib\tkinter\__init__.py:2055) stops the event loop, 
then makes more Tcl calls -- which hang for the aforementioned reason if made 
from another thread.

--
Added file: https://bugs.python.org/file47570/TkinterHanders32.py

___
Python tracker 

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



[issue33423] [logging] Improve consistency of logger mechanism.

2018-05-03 Thread Daehee Kim

New submission from Daehee Kim :

There's a proposal for a fix inconsistency of logger mechanism.
See below.

Example 1.
---
import logging

app_logger = logging.getLogger('app')

app_logger.error('foo')
logging.error('goo')
app_logger.error('foo')
---

result:
foo
ERROR:root:goo
ERROR:app:foo
---
You can see the inconsistency of app_logger results.


Example 2.
---
import logging

stream_handler = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - 
%(message)s')
stream_handler.setFormatter(formatter)

app_logger: logging.Logger = logging.getLogger('app')
app_logger.setLevel(logging.ERROR)
app_logger.addHandler(stream_handler)


app_logger.critical('foo')
logging.critical('goo')
app_logger.critical('foo')
---

results:
2018-05-04 11:21:15,199 - app - CRITICAL - foo
CRITICAL:root:goo
2018-05-04 11:21:15,200 - app - CRITICAL - foo
CRITICAL:app:foo
---

You can see even inconsistency of app_logger`s outputs count.

So I have some proposals for fix it.

Proposal 1. 
Remove implicit calling `basicConfig`. Then you can get the consistent results.

Result of the example 1.
foo
goo
foo

Result of the example 2.
2018-05-04 11:31:36,069 - app - CRITICAL - foo
goo
2018-05-04 11:31:36,070 - app - CRITICAL - foo

link : 
https://github.com/zsaladin/cpython/commit/c4e789af32da36ba49196fd6be9c070f62346b7a#diff-043d23e54edc5360a7785ae212d1b806


Proposal 2.
Add calling `basicConfig` in `callHandlers` method if the root logger has no 
handler.

Result of the example 1.
foo
goo
foo

Result of the example 2.
2018-05-04 11:31:36,069 - app - CRITICAL - foo
goo
2018-05-04 11:31:36,070 - app - CRITICAL - foo

Result of the example 1.
ERROR:app:foo
ERROR:root:goo
ERROR:app:foo

Result of the example 2.
2018-05-04 11:36:45,318 - app - CRITICAL - foo
CRITICAL:app:foo
CRITICAL:root:goo
2018-05-04 11:36:45,319 - app - CRITICAL - foo
CRITICAL:app:foo

https://github.com/zsaladin/cpython/commit/fc295b46a4de584dc5c6724125b2c0f8b2694aa6#diff-043d23e54edc5360a7785ae212d1b806


Thank you.

--
components: Library (Lib)
messages: 316153
nosy: Daehee Kim
priority: normal
severity: normal
status: open
title: [logging] Improve consistency of logger mechanism.
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue33423] [logging] Improve consistency of logger mechanism.

2018-05-03 Thread Daehee Kim

Daehee Kim  added the comment:

There's a proposal for a fix inconsistency of logger mechanism.
See below.

Example 1.
---
import logging

app_logger = logging.getLogger('app')

app_logger.error('foo')
logging.error('goo')
app_logger.error('foo')
---

result:
foo
ERROR:root:goo
ERROR:app:foo
---
You can see the inconsistency of app_logger results.


Example 2.
---
import logging

stream_handler = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - 
%(message)s')
stream_handler.setFormatter(formatter)

app_logger: logging.Logger = logging.getLogger('app')
app_logger.setLevel(logging.ERROR)
app_logger.addHandler(stream_handler)


app_logger.critical('foo')
logging.critical('goo')
app_logger.critical('foo')
---

results:
2018-05-04 11:21:15,199 - app - CRITICAL - foo
CRITICAL:root:goo
2018-05-04 11:21:15,200 - app - CRITICAL - foo
CRITICAL:app:foo
---

You can see even inconsistency of app_logger`s outputs count.

So I have some proposals for fix it.

Proposal 1. 
Remove implicit calling `basicConfig`. Then you can get the consistent results.

Result of the example 1.
foo
goo
foo

Result of the example 2.
2018-05-04 11:31:36,069 - app - CRITICAL - foo
goo
2018-05-04 11:31:36,070 - app - CRITICAL - foo

link : 
https://github.com/zsaladin/cpython/commit/c4e789af32da36ba49196fd6be9c070f62346b7a#diff-043d23e54edc5360a7785ae212d1b806


Proposal 2.
Add calling `basicConfig` in `callHandlers` method if the root logger has no 
handler.

Result of the example 1.
ERROR:app:foo
ERROR:root:goo
ERROR:app:foo

Result of the example 2.
2018-05-04 11:36:45,318 - app - CRITICAL - foo
CRITICAL:app:foo
CRITICAL:root:goo
2018-05-04 11:36:45,319 - app - CRITICAL - foo
CRITICAL:app:foo

https://github.com/zsaladin/cpython/commit/fc295b46a4de584dc5c6724125b2c0f8b2694aa6#diff-043d23e54edc5360a7785ae212d1b806


Thank you.

--

___
Python tracker 

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



[issue33423] [logging] Improve consistency of logger mechanism.

2018-05-03 Thread Daehee Kim

Daehee Kim  added the comment:

Please, ignore first one, `msg316153`

It has duplicated message so I rewrote `msg316154`.
I could not find delete or edit messages menu.

--

___
Python tracker 

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



[issue33423] [logging] Improve consistency of logger mechanism.

2018-05-03 Thread Emanuel Barry

Change by Emanuel Barry :


--
Removed message: https://bugs.python.org/msg316153

___
Python tracker 

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



[issue33423] [logging] Improve consistency of logger mechanism.

2018-05-03 Thread Emanuel Barry

Emanuel Barry  added the comment:

You don't have access to this feature, so I've deleted the message for you :)

--
nosy: +ebarry

___
Python tracker 

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



[issue33423] [logging] Improve consistency of logger mechanism.

2018-05-03 Thread Daehee Kim

Daehee Kim  added the comment:

Oh! Thank you for your kindness. :)

--

___
Python tracker 

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



[issue33424] 4.4. break and continue Statements, and else Clauses on Loops

2018-05-03 Thread CH

New submission from CH :

range function second parameter is excluded. Hence for x in range(2, n): will 
not execute when n = 2, and "2 is a prime number" will never appear.
Moreover, might need a break in the else block too.

--
messages: 316158
nosy: joesatriani
priority: normal
severity: normal
status: open
title: 4.4. break and continue Statements, and else Clauses on Loops

___
Python tracker 

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



[issue33424] 4.4. break and continue Statements, and else Clauses on Loops

2018-05-03 Thread Tim Peters

Tim Peters  added the comment:

Closing because this appears to be senseless.

--
nosy: +tim.peters
resolution:  -> rejected
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



[issue33412] Tkinter hangs if using multiple threads and event handlers

2018-05-03 Thread Guido van Rossum

Change by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue33424] 4.4. break and continue Statements, and else Clauses on Loops

2018-05-03 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

Joe, we have no idea what you think is the bug.

It is intentional that the second argument for range is excluded. This is 
called an "half-open" range, and it helps avoid off-by-one and signpost errors.

Your comments about break, continue and else don't seem to actually mean 
anything. Please write in complete English sentences and explain the nature of 
the supposed bug.

--
nosy: +steven.daprano

___
Python tracker 

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