[issue8036] Interpreter crashes on invalid arg to spawnl on Windows

2018-07-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

All three test cases are raising a VallueError now:

C:\py\cpython3.8>python -c "import os; os.spawnl(os.P_WAIT, '')"
Running Debug|x64 interpreter...
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\py\cpython3.8\\lib\os.py", line 931, in spawnl
return spawnv(mode, file, args)
ValueError: spawnv() arg 2 cannot be empty

C:\py\cpython3.8>python -c "import os; os.spawnl(os.P_WAIT, 
'__not_existing_path__')"
Running Debug|x64 interpreter...
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\py\cpython3.8\\lib\os.py", line 931, in spawnl
return spawnv(mode, file, args)
ValueError: spawnv() arg 2 cannot be empty

C:\py\cpython3.8>python -c "import os; os.spawnl(os.P_WAIT, 
'__not_existing_path__', '')"
Running Debug|x64 interpreter...
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\py\cpython3.8\\lib\os.py", line 931, in spawnl
return spawnv(mode, file, args)
ValueError: spawnv() arg 2 first element cannot be empty


But the following one still causes a crash:

  python -c "import os; os.spawnl(os.P_WAIT, '', 'non-empty')"

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue34076] Nested loop in dictionary comprehension gives `global name not defined` inside class

2018-07-09 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I think this is explained in the below answers with example that the left most 
loop in the comprehension has access to the class variables which the nested 
comprehensions don't have

https://stackoverflow.com/a/22692274/2610955

https://stackoverflow.com/a/13913933/2610955

Thanks

--
nosy: +xtreak

___
Python tracker 

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



[issue28657] cmd.Cmd.get_help() implementation can't see do_*() methods added dynamically by setattr()

2018-07-09 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

>> Could this have been done with:  
>> setattr(self.__class__, "do_" + command, func)?

> Isn't that worse than doing that on an instance? It will work 
> as long as there's only one.

Why not have multiple classes instead of multiple instances?  Then use class 
composition to combine the components.

FWIW, I just looked through the Cmd2 project (which depends on and extends the 
Cmd class): https://cmd2.readthedocs.io/en/latest/index.html .  AFAICT, there 
is no precedent for the approach taken by your project.  This seems to be at 
odds with the design of module which is class based rather than instance based.

The existing class based design allows class composition which supports needs 
for separately maintained components.  It also allows regular methods to be 
dynamically attached to the class or any of its parents after the class is 
created.   Being regular methods, they would have access to the "self" instance 
parameter so that the application can be stateful (note that attaching 
functions to instances loses this advantage).  In Cmd2, the instance is 
considered the application and only one can be run at a time (it's not really 
about having multiple distinct instances that vary dynamically and 
independently of one another).

I've exhausted my triage efforts on this.  It doesn't seem be bug; rather, it 
is a feature request to take the module in a different direction that seems to 
be in conflict with its core concept and normal use (and in conflict with 
Python norms about where to attach methods).  

If you would like to push forward, consider eliciting opinions and analysis 
from Catherine Devlin and Todd Leonhardt (the maintainers of Cmd2).  If they 
think it is a good idea to have multiple instances with dynamically attached 
functions, then this feature request can go forward.

--

___
Python tracker 

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



[issue33351] Support compiling with clang-cl on Windows

2018-07-09 Thread Ethan Smith


Ethan Smith  added the comment:

I just updated the PR with some more information after trying this on every VS 
project. It seems that clang-cl still fails on some projects/tests, but I don't 
think that is a big problem. I was mostly interested in getting Python core to 
build with clang-cl, which it does (and passes all test with it). I will keep 
iterating on this as time allows.

I also think it would be helpful to have an idea of the expectation for 
review/merge.

--

___
Python tracker 

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



[issue11572] bring Lib/copy.py to 100% coverage

2018-07-09 Thread Éric Araujo

Éric Araujo  added the comment:

I realize now that calling self.fail at 
https://hg.python.org/cpython/rev/74e79b2c114a#l2.20 is a problem: self is an 
instance of the C class, not the TestCase instance.

(The line is unreachable anyway so this doesn’t matter a lot.  In other 
projects I’d use something like `__reduce__ = raiser(AssertionError)` to avoid 
this.)

--

___
Python tracker 

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



[issue32523] inconsistent spacing in changelog.html

2018-07-09 Thread Julien Palard


Julien Palard  added the comment:

Hi Ned, what do you think about https://github.com/python/cpython/pull/8154?

I feel this is a bit a huge change in NEWS entry writing policy which make them 
less readable (in text files). Is it really worth it to change the policy to 
single-paragraph only just for an HTML rendering issue?

Or should we silently join/trim those paragraphs only in blurb merge, maybe 
with an option like "--trim-paragraphs" while building the HTML documentations?

--

___
Python tracker 

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



[issue32245] OSError: raw write() returned invalid length on latest Win 10 Consoles

2018-07-09 Thread Segev Finer


Segev Finer  added the comment:

This should be fixed by the Windows 10 April Update (build 1803) according to 
https://github.com/Microsoft/vscode/issues/36630.

--

___
Python tracker 

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



[issue34078] Broken CRL functionality in ssl.py

2018-07-09 Thread Christian Heimes


Christian Heimes  added the comment:

Cert revocation check is working fine for me. I've attached a demo script that 
uses badssl.com:

$ curl -O http://crl3.digicert.com/ssca-sha2-g5.crl
$ openssl crl -in ssca-sha2-g5.crl -inform DER -out ssca-sha2-g5.pem.crl 
-outform PEM
$ python3.7 testcrl.py 
Traceback (most recent call last):
  File "testcrl.py", line 19, in 
s.connect(('revoked.badssl.com', 443))
  File "/usr/lib64/python3.7/ssl.py", line 1141, in connect
self._real_connect(addr, False)
  File "/usr/lib64/python3.7/ssl.py", line 1132, in _real_connect
self.do_handshake()
  File "/usr/lib64/python3.7/ssl.py", line 1108, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate 
verify failed: certificate revoked (_ssl.c:1045)

openssl s_client:

$ cat /etc/pki/tls/cert.pem ssca-sha2-g5.pem.crl > combined.pem
$ openssl s_client -connect revoked.badssl.com:443 -servername 
revoked.badssl.com -CAfile combined.pem | grep Verify
Verify return code: 0 (ok)
$ openssl s_client -connect revoked.badssl.com:443 -servername 
revoked.badssl.com -CAfile combined.pem -crl_check | grep Verify
Verify return code: 23 (certificate revoked)

--
Added file: https://bugs.python.org/file47679/testcrl.py

___
Python tracker 

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



[issue11572] bring Lib/copy.py to 100% coverage

2018-07-09 Thread Berker Peksag


Berker Peksag  added the comment:

Thanks, Brandon.

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



[issue11572] bring Lib/copy.py to 100% coverage

2018-07-09 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset 2708578736d1aa15685495e9b94b827a8e185a8c by Berker Peksag in 
branch 'master':
bpo-11572: Make minor improvements to copy module (GH-8208)
https://github.com/python/cpython/commit/2708578736d1aa15685495e9b94b827a8e185a8c


--

___
Python tracker 

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



[issue11572] bring Lib/copy.py to 100% coverage

2018-07-09 Thread Berker Peksag


Change by Berker Peksag :


--
pull_requests: +7757

___
Python tracker 

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



[issue24459] Mention PYTHONFAULTHANDLER in the man page

2018-07-09 Thread Berker Peksag


Berker Peksag  added the comment:

Thanks, Joshua!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8 -Python 3.6

___
Python tracker 

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



[issue24459] Mention PYTHONFAULTHANDLER in the man page

2018-07-09 Thread miss-islington


miss-islington  added the comment:


New changeset 22fb674fa4c8343c84c25d93f23a1d6315d0f4f5 by Miss Islington (bot) 
in branch '3.7':
bpo-24459: Document missing env variables in python.man (GH-4142)
https://github.com/python/cpython/commit/22fb674fa4c8343c84c25d93f23a1d6315d0f4f5


--
nosy: +miss-islington

___
Python tracker 

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



[issue24459] Mention PYTHONFAULTHANDLER in the man page

2018-07-09 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7756

___
Python tracker 

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



[issue24459] Mention PYTHONFAULTHANDLER in the man page

2018-07-09 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset 9863de0355caf23c44b708a5d68b603e135f7ae9 by Berker Peksag in 
branch 'master':
bpo-24459: Document missing env variables in python.man (GH-4142)
https://github.com/python/cpython/commit/9863de0355caf23c44b708a5d68b603e135f7ae9


--

___
Python tracker 

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



[issue34078] Broken CRL functionality in ssl.py

2018-07-09 Thread Joe N


New submission from Joe N :

CRLs in ssl.py or at the documentation is broken. Specifically I think the 
documentation here is wrong: 
https://docs.python.org/3/library/ssl.html#ssl.SSLContext.load_verify_locations

Here is a stackoverflow post: 
https://stackoverflow.com/questions/51196492/how-to-use-crls-in-pyopenssl?noredirect=1#comment89407186_51196492
 

I made a very user friendly test suite of files to show how it is broken. 

Run the code in here (follow readme instructions) to see the bug.
https://github.com/nettijoe96/bugInSSL

--
assignee: christian.heimes
components: SSL
messages: 321343
nosy: Joe N, christian.heimes, docs@python
priority: normal
severity: normal
status: open
title: Broken CRL functionality in ssl.py
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



[issue22689] Posix getenv makes no guarantee of lifetime of returned string

2018-07-09 Thread miss-islington


miss-islington  added the comment:


New changeset 6f4fbf8ea428e13959a7aaba0ac9725ed407752a by Miss Islington (bot) 
in branch '3.7':
bpo-22689: Copy the result of getenv() in sys_breakpointhook(). (GH-8194)
https://github.com/python/cpython/commit/6f4fbf8ea428e13959a7aaba0ac9725ed407752a


--
nosy: +miss-islington

___
Python tracker 

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



[issue22689] Posix getenv makes no guarantee of lifetime of returned string

2018-07-09 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7755

___
Python tracker 

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



[issue22689] Posix getenv makes no guarantee of lifetime of returned string

2018-07-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset f60bf0e168255b7675a4c049250ba6b202f8e647 by Serhiy Storchaka in 
branch 'master':
bpo-22689: Copy the result of getenv() in sys_breakpointhook(). (GH-8194)
https://github.com/python/cpython/commit/f60bf0e168255b7675a4c049250ba6b202f8e647


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33944] Deprecate and remove pth files

2018-07-09 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

On Jul 5, 2018, at 14:23, Ivan Pozdeev  wrote:
> 
> Ivan Pozdeev  added the comment:
> 
>> They are very difficult to debug because they're processed too early.
> 
> .pth's are processed by site.py, so no more difficult than site/sitecustomize.
> You can e.g. run `site.addpackage(,,None)' to debug the logic.

Not really.  By the time you have access to a REPL to run that, site.py has 
already run, so you already have an unclean environment.  Running with -S 
really isn’t feasible either since that’s often impossible (e.g. in a zip app 
like shiv or pex), or that leaves you with a broken environment so you can’t 
get to a usable REPL.  What you often have to do is actually modify Python to 
put a breakpoint in site.py to see what’s actually happening.  Yuck.

> 
>> They usually contain globs of inscrutable code.
> 
> An ability to contain code is there for a reason: to allow a module do 
> something more intelligent than adding hardcoded paths if needed (e.g. 
> pywin32 adds a subdir with .dll dependencies to PATH).
> 
> A chunk of code is limited to a single line -- a conscious limitation to 
> deter misuse 'cuz search path setup code is presumed to be small.

Trust me, once you can execute arbitrary code in .pth files, you’re lost.  And 
packages *do* execute arbitrary code that is very difficult to debug.  And yes, 
those complex lines are both inscrutable and non-standard.

> If someone needs something other than path setup, they should do it upon the 
> module's import instead.

Except they often don’t.

> If they insist on misusing the feature, Python's design does what it's 
> supposed to do in such cases: "make right things easy, make wrong things 
> hard”.

The problem comes when some random module you are including in your application 
does something weird in their .pth files that breaks assumptions *other* 
libraries or code is making.  It’s not as uncommon as it might seem.

> If there's a valid reason to allow larger code chunks, we can introduce a 
> different syntax -- e.g. something like bash here-documents.

The size of the code chunks isn’t the only issue.  Running arbitrary code in a 
.pth file has all kinds of negative consequences.  It’s basically code that 
happens at import time, with all the problems that happen with that 
anti-pattern.

> 
>> Exceptions in pth files can get swallowed in some cases.
> 
> If this happens, it's a bug. A line from .pth is executed with "exec line", 
> any exceptions should propagate up the stack as usual.
> 
>> They are loaded in indeterminate order.
> 
> Present a use case justifying a specific order.

Interdependent namespace packages.  If they get loaded in the wrong order, they 
can mess up __path__ settings, causing other namespace package portions to be 
un-importable.  Yes, this does happen!

--

___
Python tracker 

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



[issue34075] We should prohibit setting a ProcessPoolExecutor in with set_default_executor

2018-07-09 Thread Guido van Rossum


Guido van Rossum  added the comment:

Of course, that's what I meant.

--

___
Python tracker 

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



[issue34075] We should prohibit setting a ProcessPoolExecutor in with set_default_executor

2018-07-09 Thread Yury Selivanov


Yury Selivanov  added the comment:

> We should warn against this in the docs right away (and backport the warning 
> to all previous versions that have set_executor).

I think we'll only allow instances of c.f.ThreadPoolExecutor (and its 
subclasses) to be passed to set_default_executor.  That's a more robust check 
than just guarding against ProcessPoolExecutor.

--

___
Python tracker 

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



[issue31353] Implement PEP 553 - built-in breakpoint()

2018-07-09 Thread Barry A. Warsaw


Barry A. Warsaw  added the comment:

It's a convenient API.  I think originally I may have just don't effectively a 
getattr on the imported module, but I don't remember (and don't have original 
implementation handy - thanks, rebase!)

I don't have particularly strong feelings on the matter.  If you want to submit 
a PR, I'll take a look.  I suppose technically it *is* a functional change that 
might not be acceptable now that 3.7.0 is released though.

--

___
Python tracker 

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



[issue32933] mock_open does not support iteration around text files.

2018-07-09 Thread Anthony Flury


Anthony Flury  added the comment:

But the __next__ is a method on the iterator; 

So long as __iter__ returns a valid iterator (which it does in my pull 
request), it will by definition support __next___

Although it is entirely possible that I have misunderstood what you are saying.

--

___
Python tracker 

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



[issue34077] doc Be explicit about mock_open created mocks not supporting __iter__

2018-07-09 Thread Berker Peksag


Berker Peksag  added the comment:

There is also bpo-32933.

--

___
Python tracker 

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



[issue32933] mock_open does not support iteration around text files.

2018-07-09 Thread Berker Peksag


Berker Peksag  added the comment:

This is basically a duplicate of bpo-21258, but I haven't closely look at the 
patches in both issues yet.

We should probably consider adding support for __next__ as well.

--
nosy: +berker.peksag

___
Python tracker 

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



[issue34077] doc Be explicit about mock_open created mocks not supporting __iter__

2018-07-09 Thread Berker Peksag


Berker Peksag  added the comment:

-1. We can't document every non-existent feature in the stdlib documentation.

There is an already open issue for adding __iter__ support to mock_open(): 
Issue 21258

--
nosy: +berker.peksag
resolution:  -> rejected
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



[issue34073] asyncio and ProcessPoolExecutor: OSError on loop.close()

2018-07-09 Thread Yury Selivanov


Yury Selivanov  added the comment:

We plan to deprecate and later prohibit setting ProcessPoolExecutor as the 
default executor.  See https://bugs.python.org/issue34075 for more details.

--
resolution:  -> remind
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



[issue34075] We should prohibit setting a ProcessPoolExecutor in with set_default_executor

2018-07-09 Thread Yury Selivanov


Yury Selivanov  added the comment:

Great! Thanks for the quick reply, Guido.

--

___
Python tracker 

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



[issue34075] We should prohibit setting a ProcessPoolExecutor in with set_default_executor

2018-07-09 Thread Guido van Rossum


Guido van Rossum  added the comment:

Yeah, that's a good idea. It was never meant for a ProcessPoolExecutor.

We should warn against this in the docs right away (and backport the warning to 
all previous versions that have set_executor).

I also support non-silent deprecation in 3.8.

--

___
Python tracker 

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



[issue34074] Asyncio breaks coroutine finalization process

2018-07-09 Thread Yury Selivanov


Yury Selivanov  added the comment:

> To make example more practical, let's change `loop.stop()` to `raise 
> KeyboardInterrupt()`. Program stops without calling `close()`

Try to use the new `asyncio.run()` function (in Py 3.7)

--

___
Python tracker 

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



[issue34077] doc Be explicit about mock_open created mocks not supporting __iter__

2018-07-09 Thread Andrés Delfino

Change by Andrés Delfino :


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

___
Python tracker 

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



[issue23926] skipitem() in getargs.c still supports 'w' and 'w#', and shouldn't

2018-07-09 Thread Joe Jevnik


Change by Joe Jevnik :


--
pull_requests: +7754

___
Python tracker 

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



[issue34066] Possible resource warning in "with open()"

2018-07-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset eeaae26ce5abce56292330c29459337d6bd57aaf by Serhiy Storchaka in 
branch '3.6':
[3.6] bpo-34066: Disabled interruption before SETUP_WITH and BEFORE_ASYNC_WITH. 
(GH-8159) (GH-8198)
https://github.com/python/cpython/commit/eeaae26ce5abce56292330c29459337d6bd57aaf


--

___
Python tracker 

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



[issue34066] Possible resource warning in "with open()"

2018-07-09 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue34074] Asyncio breaks coroutine finalization process

2018-07-09 Thread Andriy Maletsky


Andriy Maletsky  added the comment:

I meant that my example is a complete python script, and after 
`loop.run_forever()` the interpreter stops. So I expected every python object 
to be destructed on interpreter shutdown, but coro's `close()` is not called.

To make example more practical, let's change `loop.stop()` to `raise 
KeyboardInterrupt()`. Program stops without calling `close()`

--

___
Python tracker 

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



[issue34077] doc Be explicit about mock_open created mocks not supporting __iter__

2018-07-09 Thread Andrés Delfino

New submission from Andrés Delfino :

I've been bitten by this one, and while the docs are clear in what the created 
mock objects support, I think something explicit about __iter__ will help.

--
assignee: docs@python
components: Documentation
messages: 321327
nosy: adelfino, docs@python
priority: normal
severity: normal
status: open
title: doc Be explicit about mock_open created mocks not supporting __iter__
type: enhancement
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



[issue34076] Nested loop in dictionary comprehension gives `global name not defined` inside class

2018-07-09 Thread Jan Christoph


New submission from Jan Christoph :

The python code: 
```
class _tri(object):
infts = '(+/-)inf, (+/-)infty, (+/-)infinity'

strange_failing = {x+s.replace('(+/-)',''):None for x in ('+','-','') for s 
in infts.split(', ')}
```

gives a `global name 'infts' is not defined` exception, when normal dictionary 
comprehensions (without nested loops) and regular nested for-loops work 
perfectly well.

For a complete shell session and more illustrative example in versions 2.7.15 
and 3.6.4 see: https://pastebin.ubuntu.com/p/9Pg8DThbsd/

--
components: Interpreter Core
files: what_a_dict.py
messages: 321326
nosy: con-f-use
priority: normal
severity: normal
status: open
title: Nested loop in dictionary comprehension gives `global name not defined` 
inside class
type: behavior
versions: Python 2.7
Added file: https://bugs.python.org/file47678/what_a_dict.py

___
Python tracker 

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



[issue34075] We should prohibit setting a ProcessPoolExecutor in with set_default_executor

2018-07-09 Thread Yury Selivanov


New submission from Yury Selivanov :

I've had a few conversations with people who were confused that asyncio starts 
to behave weirdly when a ProcessPoolExecutor is set as the default one.  We 
don't really test that asyncio's built-in functionality (like DNS resolving) 
works well with a process-pool, which leads to bug reports like [1].  
Third-party libraries also always assume that the loop is always configured to 
use the ThreadPoolExecutor (as it is by default), and also don't even test 
against ProcessPool.

My idea here would be to deprecate setting ProcessPoolExecutor as a default one 
in 3.8 and prohibit that in 3.9.

Guido, Andrew, what do you think?

[1] https://bugs.python.org/issue34073

--
components: asyncio
messages: 321324
nosy: asvetlov, gvanrossum, yselivanov
priority: normal
severity: normal
status: open
title: We should prohibit setting a ProcessPoolExecutor in with 
set_default_executor
type: behavior
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



[issue34074] Asyncio breaks coroutine finalization process

2018-07-09 Thread Yury Selivanov


Yury Selivanov  added the comment:

There's no bug here. `loop.stop()` simply stops the loop, all running tasks are 
just paused. You can re-run the same loop, and the `work()` task will resume.

In other words, `loop.stop()` does not trigger task cancellation, therefore it 
does not throw in any exceptions into the `work()` task.

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



[issue34067] Problem with contextlib.nullcontext

2018-07-09 Thread miss-islington


miss-islington  added the comment:


New changeset 1b6e21730417c56748d500a96cafebbaa1bd0120 by Miss Islington (bot) 
in branch '3.7':
bpo-34067: Include a more easily understood example for nullcontext (GH-8158)
https://github.com/python/cpython/commit/1b6e21730417c56748d500a96cafebbaa1bd0120


--
nosy: +miss-islington

___
Python tracker 

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



[issue34074] Asyncio breaks coroutine finalization process

2018-07-09 Thread Andriy Maletsky


New submission from Andriy Maletsky :

Source: https://stackoverflow.com/q/51245011/6275324

Asyncio somehow breaks coroutine finalization. I believe there may be a bug in 
C implementation (_asyncio) of tasks or futures. Reproducible within version 
3.7.0@python:3.7 docker container.

Consider this example (except and finally blocks will never execute):


import asyncio

async def work():
try:
print('started working')
await asyncio.sleep(3600)
except BaseException as e:
print('caught ' + str(type(e)))
finally:
print('finalization completed')

async def stopper():
await asyncio.sleep(5)
loop.stop()

loop = asyncio.get_event_loop()
loop.create_task(work())
loop.create_task(stopper())
loop.run_forever()



And there is asyncio-free piece of code, which works properly, catching 
GeneratorExit, thrown by coro destructor:


import asyncio

async def work():
try:
print('started working')
await asyncio.sleep(3600)
except BaseException as e:
print('caught ' + str(type(e)))
finally:
print('finalization completed')

coro = work()
coro.send(None)
del coro

--
components: asyncio
messages: 321321
nosy: and800, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Asyncio breaks coroutine finalization process
type: behavior
versions: 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



[issue28626] Tutorial: rearrange discussion of output formatting to encourage f-strings

2018-07-09 Thread miss-islington


miss-islington  added the comment:


New changeset 80a5f04592f7d732a541d5c35a1be1e9a6472ecb by Miss Islington (bot) 
in branch '3.7':
bpo-28626: rearrange discussion of output formatting to encourage f-strings 
(GH-6036)
https://github.com/python/cpython/commit/80a5f04592f7d732a541d5c35a1be1e9a6472ecb


--
nosy: +miss-islington

___
Python tracker 

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



[issue34067] Problem with contextlib.nullcontext

2018-07-09 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7752

___
Python tracker 

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



[issue34067] Problem with contextlib.nullcontext

2018-07-09 Thread Nick Coghlan


Nick Coghlan  added the comment:


New changeset c287545d62edf1a1ee65727d3c57befa8c99c13a by Nick Coghlan (Daniel 
Porteous) in branch 'master':
bpo-34067: Include a more easily understood example for nullcontext (GH-8158)
https://github.com/python/cpython/commit/c287545d62edf1a1ee65727d3c57befa8c99c13a


--

___
Python tracker 

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



[issue29988] with statements are not ensuring that __exit__ is called if __enter__ succeeds

2018-07-09 Thread Nick Coghlan


Nick Coghlan  added the comment:

While Greg Smith and I both cringed at the idea when I first raised it, I'm 
becoming more and more convinced that the only way we're going to be able to 
make resource cleanup reliable is for with statements to have the ability to 
disable signal handling while __enter__ and __exit__ methods are running.

When a with statement switches signal handling off in a particular execution 
context, there'd then need to be some absolute timing deadline for switching 
them back on, so resource acquisition or cleanup that got stuck in an infinite 
loop could still be interrupted eventually.

If you combined that with the signal handling approach in 
https://github.com/ncoghlan/cpython/pull/2/files, then I think we'd have as 
solid a solution as CPython is likely to be able to provide.

--

___
Python tracker 

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



[issue31623] Build MSI installer for 3.4 security releases on Windows

2018-07-09 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Larry answered on pydev.

--
resolution:  -> wont fix
stage: test needed -> 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



[issue34066] Possible resource warning in "with open()"

2018-07-09 Thread miss-islington


miss-islington  added the comment:


New changeset f5197ddfd0f2c5da848af57196448810bd18bb82 by Miss Islington (bot) 
in branch '3.7':
bpo-34066: Disabled interruption before SETUP_WITH and BEFORE_ASYNC_WITH. 
(GH-8159)
https://github.com/python/cpython/commit/f5197ddfd0f2c5da848af57196448810bd18bb82


--
nosy: +miss-islington

___
Python tracker 

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



[issue34067] Problem with contextlib.nullcontext

2018-07-09 Thread Daniel Porteous


Change by Daniel Porteous :


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

___
Python tracker 

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



[issue34072] 3.7.0 Windows embeddable zip vcruntime140.dll

2018-07-09 Thread Steve Dower


Steve Dower  added the comment:

It's deliberate (and documented, IIRC). You should include the C and C++ 
runtimes in your application installer.

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



[issue34066] Possible resource warning in "with open()"

2018-07-09 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +7750

___
Python tracker 

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



[issue34066] Possible resource warning in "with open()"

2018-07-09 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7749

___
Python tracker 

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



[issue34066] Possible resource warning in "with open()"

2018-07-09 Thread Nick Coghlan


Nick Coghlan  added the comment:


New changeset 3f4d90d4d72921f16babd3f52d7df804916af224 by Nick Coghlan (Serhiy 
Storchaka) in branch 'master':
bpo-34066: Disabled interruption before SETUP_WITH and BEFORE_ASYNC_WITH. 
(GH-8159)
https://github.com/python/cpython/commit/3f4d90d4d72921f16babd3f52d7df804916af224


--

___
Python tracker 

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



[issue33305] Improve syntax error for numbers with leading zero

2018-07-09 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue33967] functools.singledispatch: Misleading exception when calling without arguments

2018-07-09 Thread INADA Naoki


INADA Naoki  added the comment:

Signature mismatch should raise TypeError, not IndexError.
I think this should be backported to 3.6 and 3.7.

--
nosy: +inada.naoki
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



[issue33305] Improve syntax error for numbers with leading zero

2018-07-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset cf7303ed2aa19fb48687d7140dbc86fc23c9fca4 by Serhiy Storchaka in 
branch 'master':
bpo-33305: Improve SyntaxError for invalid numerical literals. (GH-6517)
https://github.com/python/cpython/commit/cf7303ed2aa19fb48687d7140dbc86fc23c9fca4


--

___
Python tracker 

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



[issue26544] platform.libc_ver() returns incorrect version number

2018-07-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset b1e6e5615a8e82fcf569368fac5c5b0385929855 by Serhiy Storchaka in 
branch '2.7':
bpo-26544: Fixed implementation of platform.libc_ver(). (GH-7684). (GH-8193) 
(GH-8196)
https://github.com/python/cpython/commit/b1e6e5615a8e82fcf569368fac5c5b0385929855


--

___
Python tracker 

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



[issue26544] platform.libc_ver() returns incorrect version number

2018-07-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset d73497ba52171bc8f786a70ecf50d3104b596221 by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.6':
bpo-26544: Fixed implementation of platform.libc_ver(). (GH-7684). (GH-8193) 
(GH-8195)
https://github.com/python/cpython/commit/d73497ba52171bc8f786a70ecf50d3104b596221


--

___
Python tracker 

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



[issue32521] NIS module fails to build due to the removal of interfaces related to Sun RPC from glibc.

2018-07-09 Thread Matej Cepl


Matej Cepl  added the comment:

> On Fedora after the fix we had also to BuildRequire libnsl2-devel and 
> libtirpc-devel after the glibc change was implemented for the correct headers 
> to be included within the buildroot.

libnsl-devel requires libtirpc-devel here, so that isn't the issue.

--

___
Python tracker 

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



[issue26544] platform.libc_ver() returns incorrect version number

2018-07-09 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +7748

___
Python tracker 

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



[issue26544] platform.libc_ver() returns incorrect version number

2018-07-09 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7747

___
Python tracker 

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



[issue26544] platform.libc_ver() returns incorrect version number

2018-07-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 7c43b801503c802ed6ea4b811f5bc73791249d94 by Serhiy Storchaka in 
branch '3.7':
[3.7] bpo-26544: Fixed implementation of platform.libc_ver(). (GH-7684). 
(GH-8193)
https://github.com/python/cpython/commit/7c43b801503c802ed6ea4b811f5bc73791249d94


--

___
Python tracker 

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



[issue22689] Posix getenv makes no guarantee of lifetime of returned string

2018-07-09 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue19660] decorator syntax: allow testlist instead of just dotted_name

2018-07-09 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

Real world example where this actually came up:

https://github.com/jupyter-widgets/ipywidgets/issues/430#issuecomment-247016263

--
nosy: +jdemeyer

___
Python tracker 

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



[issue31353] Implement PEP 553 - built-in breakpoint()

2018-07-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Is it needed to specify the fromlist argument for 
PyImport_ImportModuleLevelObject()? The only effect of this is that Python will 
try to import the hook as a submodule if it is not an attribute of the parent 
module. But I think that callable modules is very uncommon case and we should 
not support is specially. Getting rid of the fromlist argument will simplify 
the code.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue28657] cmd.Cmd.get_help() implementation can't see do_*() methods added dynamically by setattr()

2018-07-09 Thread Błażej Michalik

Błażej Michalik  added the comment:

It seems to me as if the current implementation forces the user to violate SRP, 
but I'm not going to argue about that. I don't feel equipped well enough to 
judge.

> Could this have been done with:  setattr(self.__class__, "do_" + command, 
> func)?

Isn't that worse than doing that on an instance? It will work as long as 
there's only one.

--

___
Python tracker 

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



[issue24665] CJK support for textwrap

2018-07-09 Thread INADA Naoki


INADA Naoki  added the comment:

Thanks, Terry.

I have doubt about "east asian width" support should be merged.
While I agree it is "better than nothing", it may make textwrap much slower.
But I didn't have courage to reject the PR.

Textwrap focused on ASCII and English-like (space separated) language.
"support unicode" is very hard problem.  We should consider about grapheme 
cluster (UAX29), east asian width (UAX11) (But utf8proc is better than UAX11), 
and line breaking algorithm (UAX14).

For wrapping text on terminal, some terminal emulators and multiplexers (e.g. 
tmux) implements much nicer algorithm.

I think 3rd party C extension based on algorithm used by tmux is best solution.
If someone really want this feature, please try it on PyPI.

I understand "want it in stdlib!". But text wrapping is very hard, complicated 
problem.  Since stdlib grows slower, and backward compatibility restrict us, I 
think it should be implemented in 3rd party library first.

--
dependencies:  -textwrap.wrap: add control for fonts with different character 
widths
resolution:  -> rejected
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



[issue26544] platform.libc_ver() returns incorrect version number

2018-07-09 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +7745

___
Python tracker 

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



[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2018-07-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

After fixing platform.libc_ver() in issue26544 we can use it for conditional 
skipping this assertion depending on the libc version.

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



[issue26544] platform.libc_ver() returns incorrect version number

2018-07-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 2a9b8babf0d09946ebebfdb2931cc0d3db5a1d3d by Serhiy Storchaka in 
branch 'master':
bpo-26544: Fixed implementation of platform.libc_ver(). (GH-7684)
https://github.com/python/cpython/commit/2a9b8babf0d09946ebebfdb2931cc0d3db5a1d3d


--

___
Python tracker 

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



[issue23927] getargs.c skipitem() doesn't skip 'w*'

2018-07-09 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +7744
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



[issue17180] shutil copy* unsafe on POSIX - they preserve setuid/setgit bits

2018-07-09 Thread Giampaolo Rodola'


Change by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 

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



[issue23926] skipitem() in getargs.c still supports 'w' and 'w#', and shouldn't

2018-07-09 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
components: +Interpreter Core
versions: +Python 3.7, Python 3.8 -Python 3.5

___
Python tracker 

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



[issue23926] skipitem() in getargs.c still supports 'w' and 'w#', and shouldn't

2018-07-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Do you mind to convert your patch into a pull request Joe?

--

___
Python tracker 

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