[issue33261] inspect.isgeneratorfunction fails on hand-created methods

2018-04-13 Thread Nick Coghlan

Nick Coghlan  added the comment:

The inspect functions throwing an exception when handed a method wrapping a 
non-function callable instead of returning False is a definite bug.

The behaviour of MethodType when handed a non-function callable is cryptic, but 
not actually a bug: the problem is that it expects to be able to delegate 
accesses to __name__ and __code__ to the underlying callable.

A docs bug to clarify exactly which accesses are going to get delegated would 
make sense (and perhaps make MethodType.__dir__ a bit smarter about that 
delegation), but it's a separate issue from the one Jeroen has reported here.

--

___
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-04-13 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I believe I have seen this exact error message within the last few months, and 
I found one example on SO. 
https://stackoverflow.com/questions/21209124/weird-error-that-comes-up-during-python-program-run

--
nosy: +terry.reedy

___
Python tracker 

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



[issue33184] Update OpenSSL to 1.1.0h / 1.0.2o

2018-04-13 Thread Ned Deily

Ned Deily  added the comment:

Steve, what about 2.7 for 2.7.15rc1?
(I'm working on that for the Mac installer now.)

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

___
Python tracker 

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



[issue33184] Update OpenSSL to 1.1.0h / 1.0.2o

2018-04-13 Thread Steve Dower

Change by Steve Dower :


--
resolution:  -> fixed
stage: patch 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



[issue33184] Update OpenSSL to 1.1.0h / 1.0.2o

2018-04-13 Thread miss-islington

miss-islington  added the comment:


New changeset df958ff28af9c5c4563fd1b050f04f0e9745ab80 by Miss Islington (bot) 
in branch '3.7':
bpo-33184: Update Windows installer to OpenSSL 1.1.0h (GH-6463)
https://github.com/python/cpython/commit/df958ff28af9c5c4563fd1b050f04f0e9745ab80


--
nosy: +miss-islington

___
Python tracker 

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



[issue33264] Remove to-be-deprecated urllib.request.urlretrieve function reference from HOWTO

2018-04-13 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

The label has been changed.  Senthil, go ahead and merge this.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue33184] Update OpenSSL to 1.1.0h / 1.0.2o

2018-04-13 Thread Steve Dower

Steve Dower  added the comment:


New changeset 1672c2fbae6128ee4717e08c4e65a0ab99a02a02 by Steve Dower in branch 
'3.6':
bpo-33184: Update Windows installer to OpenSSL 1.0.2o (GH-6464)
https://github.com/python/cpython/commit/1672c2fbae6128ee4717e08c4e65a0ab99a02a02


--

___
Python tracker 

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



[issue33184] Update OpenSSL to 1.1.0h / 1.0.2o

2018-04-13 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6163

___
Python tracker 

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



[issue33184] Update OpenSSL to 1.1.0h / 1.0.2o

2018-04-13 Thread Steve Dower

Steve Dower  added the comment:


New changeset b1dc07509f78b354e83f5f4a902f1ff80c7bb05d by Steve Dower in branch 
'master':
bpo-33184: Update Windows installer to OpenSSL 1.1.0h (GH-6463)
https://github.com/python/cpython/commit/b1dc07509f78b354e83f5f4a902f1ff80c7bb05d


--

___
Python tracker 

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



[issue33269] InteractiveConsole behaves differently on terminal, within script

2018-04-13 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

[For future reference, if I were not closing this, I would ask the following:  
Does 'on terminal mean that you started Python in interactive mode and then 
entered lines in response to the '>>> prompt'?  If so, did you start Python 
from an actual (non-Python) terminal or console? or from an icon or start menu? 
 What OS?  When you ran a script, did you run it from the system console or 
from the file itself?  However, I now consider this a moot point.]

The test for the code module is test.test_code_module, as test_code
tests code objects.  It created a code.InteractiveConsole and calls .interact.  
There are no direct unittests of any of the other methods, but most, if not 
all, including .push, are called directly or indirecty within .interact.  This 
is all within a script, which you say has problmes.  Input is fed to the 
interact loop with lines such as

self.infunc.side_effect = ["try: ham\nexcept: eggs\n",
EOFError('Finished')]

I cannot see that you have identified a real problem.  Your iitests.py fails 
because it is buggy.  It creates a new interactive console for each line.  When 
"print('i', i)" is pushed to a new console, in response to >>>, there 
*should* be an indentation error.  Similarly, 'sleep(1)' in a new console 
*should* fail with a NameError.

In iiteswok.py, which you say works, only one console is created.  After adding 
'ii.push("")', to tell the console that the statement is complete, and removing 
unneeded code, the following works for me when run as a script

import code
ii = code.InteractiveConsole()
ii.push("for i in range(3):")
ii.push("print ('i', i)")
ii.push("")

# prints

i 0
i 1
i 2

Adding

ii.push("from time import sleep")
ii.push("print('start')")
ii.push("sleep(1)")
ii.push("print('stop')")

prints 'start' and 'stop' with a one second delay.

--
nosy: +terry.reedy
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
title: InteractiveConsole behaves differently when used on terminal and used 
within script -> InteractiveConsole behaves differently on terminal, within 
script

___
Python tracker 

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



[issue33277] Deprecate __loader__, __package__, __file__, and __cached__ on modules

2018-04-13 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

I agree.  It should also be pointed out that we've had inconsistencies between 
the module attributes and the spec attributes, and even fixing those has lead 
to problems.  There should be a single source of truth, and the module spec 
should be that.

+1, and I agree about not being able to __name__ and __path__.

--
nosy: +barry

___
Python tracker 

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



[issue13041] argparse: terminal width is not detected properly

2018-04-13 Thread Mark Lawrence

Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue33275] glob.glob should explicitly note that results aren't sorted

2018-04-13 Thread Ben FrantzDale

Ben FrantzDale  added the comment:

Fascinating. That seems like an even wilder gotcha: It sounds like a script 
assuming sorted results would work in one directory (on one filesystem) but not 
on another. Or even weirder, if I had a mounted scratch partition, the script 
could work until I (or a sys admin) mounts a larger drive with a different 
filesystem on the same mountpoint. Yikes! Either way, this gotcha seems worth 
mentioning explicitly.

--

___
Python tracker 

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



[issue13041] argparse: terminal width is not detected properly

2018-04-13 Thread Julian Mehnle

Julian Mehnle  added the comment:

What's holding up the merging of this patch?

--
nosy: +jmehnle

___
Python tracker 

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



[issue33275] glob.glob should explicitly note that results aren't sorted

2018-04-13 Thread Eryk Sun

Eryk Sun  added the comment:

> The sortedness of glob.glob's output is platform-dependent.

It's typically file-system dependent (e.g. NTFS, FAT, ISO9660, UDF) -- at least 
on Windows. NTFS and ISO9660 store directories in sorted order based on the 
filename (Unicode or ASCII ordinal sort).

--
nosy: +eryksun

___
Python tracker 

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



[issue33261] inspect.isgeneratorfunction fails on hand-created methods

2018-04-13 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Nick and Raymond, I added both of you as nosy because, among other reasons, you 
commented on the latest version of PEP575.

I agree that there is a bug in current CPython, in that the is* functions 
should return, not raise, but I am not sure where is it, and hence if the PR is 
the right fix.  I am wondering if, instead, the bug is in m, the object 
returned by MethodType, or in attribute lookup thereupon.

MethodType is the type of bound user-defined (Python-coded) functions and 
ismethod is true for instances thereof.  Consider 4 other bound methods, two 
'normal'(callable is method of instance class) and two, like Jeroen's, 'odd' 
(callable not related to int).

>>> cm = Callable().__call__
>>> cm.__code__
", line 2>
>>> cm.__name__
'__call__'

>>> cm2 = MethodType(Callable.__call__, Callable())
>>> cm2.__code__
", line 2>
>>> cm2.__name__
'__call__'

>>> m2 = MethodType(Callable.__call__, 42)
>>> m2.__code__
", line 2>
>>> m2.__name__
'__call__'
>>> m2()
()

>>> m3 = MethodType(Callable().__call__, 42)
>>> m3.__code__
", line 2>
>>> m3.__name__
'__call__'
>>> m3()
(42,)

>>> m = MethodType(Callable(), 42)
>>> m.__code__
... AttributeError: 'Callable' object has no attribute '__code__'
>>> m.__name__
... AttributeError: 'Callable' object has no attribute '__name__'
>>> m()
(42,)

They all have the same attributes exposed by dir(), which omits both'__name__', 
promised in the docstring for ismethod*, and '__code__', assumed by the is--- 
functions under discussion.

>>> dir(cm) == dir(cm2) == dir(m) == dir(m2) == dir(m3)
True
>>> ('__code__' in dir(cm)) or ('__name__' in dir(cm))
False

However, accessing those names anyway, as (hidden) attributes, works for all 
but m.  Should doing so also work for m?  (If not, the ismethod docstring 
should not 'guarantee' .__name__.)

* "Instance method objects provide these attributes:
__doc__ documentation string
__name__name with which this method was defined
..."

--
nosy: +ncoghlan, rhettinger, terry.reedy

___
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-04-13 Thread Ivan Pozdeev

Ivan Pozdeev  added the comment:

My best idea for a test as of now is to run the example ~20 times in a loop (or 
continuously for a comparable amount of time & threads) and catch and register 
any exceptions in all threads as per 
https://stackoverflow.com/questions/18349614/check-if-a-python-thread-threw-an-exception
 .

--

___
Python tracker 

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



[issue33255] json.dumps has different behaviour if encoding='utf-8' or encoding='utf8'

2018-04-13 Thread Ivan Pozdeev

Ivan Pozdeev  added the comment:

Treating 'utf-8' and its aliases differently (when they specifically mean the 
Python's, rather than something else's, encoding) is definitely as issue.

You shouldn't hardcode a list of aliases though; rather use existing facilities 
to resolve them. From quick googling, e.g. `codecs.lookup().name` can 
get the canonical name.


Make sure to follow https://devguide.python.org/pullrequest when doing the PR; 
a test case will likely be needed, too.

--
nosy: +Ivan.Pozdeev

___
Python tracker 

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



[issue33254] importlib.resources.contents() incorrectly yields an empty list

2018-04-13 Thread Brett Cannon

Change by Brett Cannon :


--
keywords: +patch
pull_requests: +6162
stage: test needed -> patch review

___
Python tracker 

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



[issue33277] Deprecate __loader__, __package__, __file__, and __cached__ on modules

2018-04-13 Thread Brett Cannon

Change by Brett Cannon :


--
priority: normal -> low

___
Python tracker 

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



[issue33277] Deprecate __loader__, __package__, __file__, and __cached__ on modules

2018-04-13 Thread Brett Cannon

New submission from Brett Cannon :

If you look at 
https://docs.python.org/3/reference/import.html#import-related-module-attributes
 you will notice there are a lot of attributes on modules. But since the 
introduction of module specs 
(https://docs.python.org/3/library/importlib.html#importlib.machinery.ModuleSpec),
 all of those attributes became redundant.

Now some attributes can never be taken away based on common idioms in the 
Python community. __name__ can't go due to `if __name__ == '__main__'`. 
__path__ can't go due to people manipulating it with e.g. pkg_resources or 
pkgutil. The rest, though, don't have such strong idioms tied to them (and in 
the case of __package__, has actually been made officially redundant by the 
import system since Python 3.6). That means setting them is unnecessary and any 
time someone wants to read or potentially manipulate them they have to choose 
between those attributes or the spec (or update both). Either way it can lead 
to bugs (I know I have nearly forgotten to set both the spec and the attribute 
before).

I don't know if we can easily deprecate these attributes using __getattr__ on 
modules as added in Python 3.7, or if this is more of a documentation thing and 
need a long period of clearly messaging that these redundant attributes will no 
longer be set at some point.

--
components: Library (Lib)
messages: 315269
nosy: brett.cannon, eric.snow
priority: normal
severity: normal
stage: test needed
status: open
title: Deprecate __loader__, __package__, __file__, and __cached__ on modules
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



[issue12029] Allow catching virtual subclasses in except clauses

2018-04-13 Thread Michael McCoy

Michael McCoy  added the comment:

Sorry, my last message referred to Github PR6460 / pull_request6160.

--
versions: +Python 3.4, 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



[issue12029] Allow catching virtual subclasses in except clauses

2018-04-13 Thread Michael McCoy

Michael McCoy  added the comment:

Amalgamating the patch history here, I've updated the tests on Github (PR6160) 
to include tests for both the recursive case and ensure the correct error is 
propagated up if an exception occurs during the subclass check. 

I've also added a check to ensure that unittest's assertRaises behaves as 
expected. (The test currently passes on master, which is a bug if this doesn't 
get merged.)

Finally, the PR updates the documentation for try/except.

--
nosy: +Michael McCoy

___
Python tracker 

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



[issue27129] Wordcode, part 2

2018-04-13 Thread Kirill Balunov

Kirill Balunov  added the comment:

Hello, what is the future of this patch? Such a feeling that the transition to 
wordcode is still in some half-way state.

--
nosy: +godaygo

___
Python tracker 

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



[issue12029] Allow catching virtual subclasses in except clauses

2018-04-13 Thread Antony Lee

Change by Antony Lee :


--
nosy:  -Antony.Lee

___
Python tracker 

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



[issue33176] Allow memoryview.cast(readonly=...)

2018-04-13 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
pull_requests: +6161

___
Python tracker 

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



[issue24882] ThreadPoolExecutor doesn't reuse threads until #threads == max_workers

2018-04-13 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Creating a new PR would be cleaner IMHO.

--

___
Python tracker 

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



[issue24882] ThreadPoolExecutor doesn't reuse threads until #threads == max_workers

2018-04-13 Thread iunknwn

iunknwn  added the comment:

Alright - I'll put together another patch that removes the logic, and spins up 
all threads during initialization. 

Do you want me to create a completely new PR, or just update my existing one?

--

___
Python tracker 

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



[issue33270] tags for anonymous code objects should be interned

2018-04-13 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

+1

--
nosy: +rhettinger

___
Python tracker 

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



[issue33271] Exception handling should match subclasses, not subtypes

2018-04-13 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Let to keep the discussion in a single place -- in issue12029.

--
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> Allow catching virtual subclasses in except clauses

___
Python tracker 

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



[issue12029] Allow catching virtual subclasses in except clauses

2018-04-13 Thread Michael McCoy

Change by Michael McCoy :


--
pull_requests: +6160

___
Python tracker 

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



[issue24882] ThreadPoolExecutor doesn't reuse threads until #threads == max_workers

2018-04-13 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> That said, if threads are cheap, why not just create all the work threads on 
> initialization, and then remove all the logic entirely?

That would sound reasonable to me.  bquinlan has been absent for a long time, 
so I wouldn't expect an answer from him on this issue.

> Also, regarding the executor and thread-safety, there's an example in the 
> current docs showing a job being added to the executor from a worker thread

Actually, looking at the code again, submit() is protected by the 
shutdown_lock, so it seems it should be thread-safe.  That's on git master btw.

--

___
Python tracker 

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



[issue33251] ConfigParser.items returns items present in vars

2018-04-13 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
nosy: +terry.reedy

___
Python tracker 

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



[issue33240] shutil.rmtree fails if inner folder is open in Windows Explorer

2018-04-13 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
title: shutil.rmtree fails when the inner floder is opened in Explorer on 
Windows -> shutil.rmtree fails if inner folder is open in Windows Explorer

___
Python tracker 

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



[issue24882] ThreadPoolExecutor doesn't reuse threads until #threads == max_workers

2018-04-13 Thread iunknwn

iunknwn  added the comment:

The existing behavior seems strange (and isn't well documented). The code had a 
TODO comment from bquinlan to implement idle thread recycling, so that was why 
I made the change. 

That said, if threads are cheap, why not just create all the work threads on 
initialization, and then remove all the logic entirely?

Also, regarding the executor and thread-safety, there's an example in the 
current docs showing a job being added to the executor from a worker thread 
(it's part of the example on deadlocks, but it focuses on max worker count, not 
on the executor's thread-safety).

--

___
Python tracker 

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



[issue33275] glob.glob should explicitly note that results aren't sorted

2018-04-13 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

This seems reasonable.  I would like like it to be part of the regular text 
rather rather than appearing as a big ..note entry which can be visually 
distracting from the core functionality.

--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
keywords: +easy
nosy: +docs@python, rhettinger
stage:  -> needs patch
versions:  -Python 3.4, Python 3.5

___
Python tracker 

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



[issue33275] glob.glob should explicitly note that results aren't sorted

2018-04-13 Thread Raymond Hettinger

Change by Raymond Hettinger :


--
nosy: +csabella

___
Python tracker 

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



[issue33271] Exception handling should match subclasses, not subtypes

2018-04-13 Thread Michael McCoy

Michael McCoy  added the comment:

Serhiy, it sure is. I'll note that the issue is open. Moreover, reading through 
the history, Guido says it's a bug (msg160418), and there was agreement that it 
should be fixed. It's unclear why it was dropped.

Can you help me get this in? I'm not sure the correct protocol, since this is 
my first contrib.

Note that if this is not a bug, then there are probably bugs anywhere 
issubclass(...) is used to emulate exception handling. For example, unittest's 
self.assertRaises is inconsistent with the current behavior:

from abc import ABC
import unittest

class TestExceptionABC(unittest.TestCase):

def test_exception(self):
class A(Exception, ABC):
pass
class B(Exception):
pass
A.register(B)
with self.assertRaises(A, msg="Wrong exception raised"):
raise B

Test passes in python3, but not in python2.

--

___
Python tracker 

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



[issue12029] Allow catching virtual subclasses in except clauses

2018-04-13 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Silencing exceptions like MemoryError, RecursionError or KeyboardInterrupt and 
returning a lying result doesn't look like a good idea to me. These exceptions 
can be raised in virtually any code for causes not related to executed code. 
MemoryError -- if other parts of the program allocated too much memory, 
RecursionError -- if the exception check is performed too deep in the execution 
stack, KeyboardInterrupt -- for obvious reasons.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33276] Clarify that __path__ can't be set to just anything

2018-04-13 Thread Brett Cannon

New submission from Brett Cannon :

https://docs.python.org/3/reference/import.html#module-path says that 
"regardless of its value", __path__'s mere existence is key. But then later the 
docs say "__path__ must be an iterable of strings, but it may be empty". 
Technically the latter is more accurate, so the docs should get touched up to 
match itself better.

--
assignee: brett.cannon
components: Documentation
keywords: easy
messages: 315256
nosy: brett.cannon
priority: normal
severity: normal
stage: needs patch
status: open
title: Clarify that __path__ can't be set to just anything
versions: 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



[issue33271] Exception handling should match subclasses, not subtypes

2018-04-13 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Isn't this a duplicate of issue12029?

--

___
Python tracker 

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



[issue33184] Update OpenSSL to 1.1.0h / 1.0.2o

2018-04-13 Thread Steve Dower

Change by Steve Dower :


--
pull_requests: +6159

___
Python tracker 

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



[issue33270] tags for anonymous code objects should be interned

2018-04-13 Thread Brett Cannon

Change by Brett Cannon :


--
stage:  -> needs patch
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



[issue33275] glob.glob should explicitly note that results aren't sorted

2018-04-13 Thread Ben FrantzDale

New submission from Ben FrantzDale :

The sortedness of glob.glob's output is platform-dependent. While the docs do 
not mention sorting, and so are strictly correct, if you are on a platform 
where its output is sorted, it's easy to believe that the output is always 
sorted.

I propose we a Note maybe next to "Note: Using the “**” pattern in large 
directory trees may consume an inordinate amount of time." that says "Note: 
While the output of glob.glob may be sorted on some architectures, ordering is 
not guaranteed. Use `sort(glob.glob(...))` if ordering is important."

This wrong assumption burned us when scripts inexplicably stopped working on 
OSX High Sierra.

--
components: Library (Lib)
messages: 315254
nosy: Ben FrantzDale
priority: normal
severity: normal
status: open
title: glob.glob should explicitly note that results aren't sorted
type: enhancement
versions: Python 2.7, Python 3.4, 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



[issue33274] minidom removeAttributeNode returns None

2018-04-13 Thread Ari Krupnik

Change by Ari Krupnik :


--
type:  -> behavior

___
Python tracker 

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



[issue33184] Update OpenSSL to 1.1.0h / 1.0.2o

2018-04-13 Thread Steve Dower

Change by Steve Dower :


--
pull_requests: +6158

___
Python tracker 

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



[issue33274] minidom removeAttributeNode returns None

2018-04-13 Thread Ari Krupnik

New submission from Ari Krupnik :

W3C DOM Level 1[1] requires removeAttributeNode() to return the removed node:

removeAttributeNode: Removes the specified attribute.
Return Value: The Attr node that was removed.

Minidom implementation returns None.

[1]https://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#method-removeAttributeNode

--
components: Library (Lib), XML
messages: 315253
nosy: iter
priority: normal
pull_requests: 6157
severity: normal
status: open
title: minidom removeAttributeNode returns None
versions: Python 2.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



[issue33271] Exception handling should match subclasses, not subtypes

2018-04-13 Thread Michael McCoy

Michael McCoy  added the comment:

Adding Serhiy because this relates to issue31091, and specifically claims that 
there _was_ a bug in the old code (msg299585).

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33271] Exception handling should match subclasses, not subtypes

2018-04-13 Thread Michael McCoy

Change by Michael McCoy :


--
title: Exception handling matches subclasses, not subtypes -> Exception 
handling should match subclasses, not subtypes

___
Python tracker 

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



[issue33271] Exception handling matches subclasses, not subtypes

2018-04-13 Thread Michael McCoy

Change by Michael McCoy :


--
title: Exception handling matches subtypes, not subclasses -> Exception 
handling matches subclasses, not subtypes

___
Python tracker 

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



[issue14573] json iterencode can not handle general iterators

2018-04-13 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Things are more complicated. bytes object is an iterable. I think serialize an 
bytes object (which can be unexpectedly leaked in a code ported from 2.7) as a 
list of integers is not expected behavior in most cases. It is safer to fail by 
default and provide an explicit handling for bytes if it is needed. There are 
other iterables that are better not to serialize by default: mappings, which 
are not dict subclasses, exhaustible iterators.

I'm working on large patch for the json module (maybe even a PEP). It will not 
allow serializing all iterables by default, but will make easy to switch on 
serialization for particular types, including iterables.

--
assignee:  -> serhiy.storchaka
nosy: +serhiy.storchaka
priority: normal -> low

___
Python tracker 

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



[issue32771] merge the underlying data stores of unicodedata and the str type

2018-04-13 Thread Matej Cepl

Change by Matej Cepl :


--
nosy: +mcepl

___
Python tracker 

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



[issue12735] request full Unicode collation support in std python library

2018-04-13 Thread Matej Cepl

Change by Matej Cepl :


--
nosy: +mcepl

___
Python tracker 

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



[issue10685] trace does not ignore --ignore-module

2018-04-13 Thread Tom Hines

Tom Hines  added the comment:

bump

--

___
Python tracker 

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



[issue14573] json iterencode can not handle general iterators

2018-04-13 Thread Alfred Morgan

Alfred Morgan  added the comment:

I would love to but it is a bit late for me now. The json encoding has been 
optimized in c which falls outside my expertise.
https://github.com/python/cpython/blob/master/Modules/_json.c

--

___
Python tracker 

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



[issue33273] Allow multiple imports from one module while preserving its namespace

2018-04-13 Thread Zachary Ware

Zachary Ware  added the comment:

Do you mean like `from lib import mod1, mod2, mod3`?  If that doesn't cover 
what you're looking for, try sending your idea (fleshed out a bit more :)) to 
the python-id...@python.org mailing list, where you can get feedback on your 
idea.

For now, I'm closing this issue; if your discussions on python-ideas prove 
fruitful and you can come back with a clearer plan for a change, you can reopen 
it.

--
nosy: +zach.ware
resolution:  -> works for me
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



[issue33273] Allow multiple imports from one module while preserving its namespace

2018-04-13 Thread Julian DeMille

New submission from Julian DeMille :

An example of this would be to have something like `import .{ 
, , ... }`

--
components: Interpreter Core
messages: 315247
nosy: jdemilledt
priority: normal
severity: normal
status: open
title: Allow multiple imports from one module while preserving its namespace
type: enhancement

___
Python tracker 

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



[issue19173] Expose Queue maxsize parameter to multiprocessing.Pool class

2018-04-13 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

A similar issue for concurrent.futures is bpo-29595.

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



[issue31226] shutil.rmtree fails when target has an internal directory junction (Windows)

2018-04-13 Thread Vidar Fauske

Vidar Fauske  added the comment:

A PR that fixes the issue according to the feedback from Eryk Sun is available. 
It does seem to have stranded a bit on the review side. That being said, would 
a bugfix for shutil.rmtree be appropriate? It is very annoying when junction 
points made by other tools break pip source install of packages (since pip 
calls shutil.rmtree on its temporary directory after a build).

--

___
Python tracker 

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



[issue33265] contextlib.ExitStack abuses __self__

2018-04-13 Thread Nick Coghlan

Nick Coghlan  added the comment:

Classifying this as a minor performance enhancement, since methods are much 
simpler objects than full Python level closures.

Thanks!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> performance
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



[issue33265] contextlib.ExitStack abuses __self__

2018-04-13 Thread Nick Coghlan

Nick Coghlan  added the comment:


New changeset 23ab5ee667a9b29014f6f7f01797c611f63ff743 by Nick Coghlan 
(jdemeyer) in branch 'master':
bpo-33265: use an actual method instead of a method-like function in ExitStack 
(GH-6456)
https://github.com/python/cpython/commit/23ab5ee667a9b29014f6f7f01797c611f63ff743


--

___
Python tracker 

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



[issue33272] Which are reasonable reason for recursion limit in function _vformat of class Formatter lib string?

2018-04-13 Thread Eric V. Smith

Change by Eric V. Smith :


--
nosy: +eric.smith

___
Python tracker 

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



[issue33272] Which are reasonable reason for recursion limit in function _vformat of class Formatter lib string?

2018-04-13 Thread Mikhail

New submission from Mikhail :

The presence of the restriction of recursion prevent making nested conditions 
for the superformatter: https://github.com/ebrehault/superformatter

for example:

import string


class SuperFormatter(string.Formatter):
"""World's simplest Template engine."""

def format_field(self, value, spec):
if spec.startswith('repeat'):
template = spec.partition(':')[-1]
if type(value) is dict:
value = value.items()
return ''.join([template.format(item=item) for item in value])
elif spec == 'call':
return value()
elif spec.startswith('if'):
return (value and spec.partition(':')[-1]) or ''
else:
return super(SuperFormatter, self).format_field(value, spec)


data = {
'a1':1,
'a2':2,
'a3':3
}

tmpl = '''
{a1:if:
{a2:if:
{a2}
}
{a1}
}
'''

sf = SuperFormatter()
out = sf.format(tmpl, **data)
print(out)


Causes error:

$ python3.6 my_progs/test.py 
Traceback (most recent call last):
  File "my_progs/test.py", line 37, in 
out = sf.format(tmpl, **data)
  File "/usr/lib64/python3.6/string.py", line 190, in format
return self.vformat(format_string, args, kwargs)
  File "/usr/lib64/python3.6/string.py", line 194, in vformat
result, _ = self._vformat(format_string, args, kwargs, used_args, 2)
  File "/usr/lib64/python3.6/string.py", line 244, in _vformat
auto_arg_index=auto_arg_index)
  File "/usr/lib64/python3.6/string.py", line 244, in _vformat
auto_arg_index=auto_arg_index)
  File "/usr/lib64/python3.6/string.py", line 244, in _vformat
auto_arg_index=auto_arg_index)
  File "/usr/lib64/python3.6/string.py", line 201, in _vformat
raise ValueError('Max string recursion exceeded')
ValueError: Max string recursion exceeded


If there was not this restriction, then the example code is worked.

--
components: Library (Lib)
messages: 315242
nosy: mv.gavrilov
priority: normal
severity: normal
status: open
title: Which are reasonable reason for recursion limit in function _vformat of 
class Formatter lib string?
type: behavior
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



[issue33271] Exception handling matches subtypes, not subclasses

2018-04-13 Thread Roundup Robot

Change by Roundup Robot :


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

___
Python tracker 

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



[issue33271] Exception handling matches subtypes, not subclasses

2018-04-13 Thread Michael McCoy

New submission from Michael McCoy :

Exception handling matches subtypes, not subclasses


# Example


from abc import ABC

class MyException(Exception, ABC):
pass

class OtherException(Exception):
pass

MyException.register(OtherException)

try:
raise OtherException
except MyException:
print("Correct: Caught MyException")
except Exception:
print("Wrong: Caught something else")

# "Wrong: Caught something else"


# Background and evidence of bug-ness

Issue 2534 [1] (10 years ago!) introduced the behavior, but only in the Python 
3 patch [2]. During code review, the correct function call was used [3], but 
the function's name got switched in the final python3 patch without any comment.

The current Python 2 code uses `PyObject_IsSubclass`, and produces the correct 
behavior in the example above (using `__metaclass__ = ABCMeta`, of course). 
This leads me to strongly suspect that this is a bug, not a feature. The note 
below regarding unittest for further evidence that this code has eight legs.

Given the ancient nature of this bug, it affects all versions of python3.

[1] https://bugs.python.org/issue2534
[2] https://bugs.python.org/file11257/isinstance3k-2.patch
[3] https://codereview.appspot.com/483/diff/1/21#newcode114
[4] https://github.com/python/cpython/blob/2.7/Python/errors.c#L119


# Solution

Coming very soon in a PR on Github, but in short, we do the following:

  1. Switch `PyType_IsSubtype` to  `PyObject_IsSubclass`.
  2. Revert the changes made to remove “dead code” in 
https://bugs.python.org/issue31091. The code was dead because the wrong 
function was used—the PR left only the bug.
  3. Add tests. Note that `unittest`’s `self.assertRaises` function uses 
`issubclass` and does not alert to this bug. (Different symptom, same cause.)


# Note

This bug has nothing to do with the `abc` package, beyond being a simple way to 
generate the error.


-Mike

Gitub: mbmccoy

--
components: Interpreter Core
messages: 315241
nosy: Michael McCoy
priority: normal
severity: normal
status: open
title: Exception handling matches subtypes, not subclasses
versions: Python 3.4, 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