[issue42818] AttributeError: 'zipimporter' object has no attribute 'find_spec'

2021-01-07 Thread Klaus Ethgen


Klaus Ethgen  added the comment:

I also tested the original bug and it seems to be gone.

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



[issue42818] AttributeError: 'zipimporter' object has no attribute 'find_spec'

2021-01-07 Thread Klaus Ethgen


Klaus Ethgen  added the comment:

You are right.

Generally I have the installation on devuan Linux, the unstable tree.

But... In 2019-03-13 I started to patch this file as many python scripts 
started to fail due to the fact that they had the find_spec implemented. This 
was still true in Apr 2020, when I had to renew the patch. And let me say, many 
failed; not only the egg part.

I don't know where I found the patch at first but it worked now for nearly two 
years. I did revert it now and for the moment, the scripts that I remember was 
failing, seems to work now.

Let me say that this find_spec/find_module stuff is (or was) a bit of a mess.

--

___
Python tracker 

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



[issue42851] Subclassing Enum with ipaddress.IPv4Network/IPv6Network raises TypeError.

2021-01-07 Thread Mariusz Felisiak


Mariusz Felisiak  added the comment:

Ethan, Thanks for the patch.

--

___
Python tracker 

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



[issue42836] docs: struct: clarify struct caching behaviour

2021-01-07 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 2.0 -> 3.0
pull_requests: +22992
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24164

___
Python tracker 

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



[issue42725] PEP 563: Should the behavior change for yield/yield from's

2021-01-07 Thread Guido van Rossum

Guido van Rossum  added the comment:

Oh, you’re right about walrus. And I don’t actually understand async generator 
expressions.

This suggests that we definitely need a PEP. :-)

--

___
Python tracker 

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



[issue42798] pip search fails

2021-01-07 Thread Desmond Cheong


Desmond Cheong  added the comment:

Seems that this is due to PyPI's search API being disabled.

https://github.com/pypa/pip/issues/5216#issuecomment-744605466

--
nosy: +desmondcheongzx

___
Python tracker 

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



[issue42818] AttributeError: 'zipimporter' object has no attribute 'find_spec'

2021-01-07 Thread Desmond Cheong


Desmond Cheong  added the comment:

Could you provide some information about the system you're running this on? I 
might be wrong, but this does seem like an issue with this copy of setuptools. 
From the Traceback, it seems that line 2196 of 
/usr/lib/python3/dist-packages/pkg_resources/__init__.py runs `loader = 
importer.find_spec(packageName)` when trying to handle the AttributeError 
exception. However, this line should instead have run `loader = 
importer.find_module(packageName)` based on the source code 
https://github.com/pypa/setuptools/blob/95a9c474d30acc729b536f9ad88ead7efab62c5d/pkg_resources/__init__.py#L2190-L2197

Git blame also tells me that this fall-back has been implemented for a few 
years now.

It also appears that the zipimporter.find_spec method is not implemented in 
Python3.9 and earlier. However, zipimporter.find_module has been implemented 
for at least Python3.8 onwards, if not earlier 
(https://github.com/python/cpython/blob/ca8e96d1edbeb536f58da91e607082463398fce1/Lib/zipimport.py#L139-L150).

--
nosy: +desmondcheongzx

___
Python tracker 

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



[issue25457] json dump fails for mixed-type keys when sort_keys is specified

2021-01-07 Thread naught101


naught101  added the comment:

I want to do something like this:

hashlib.md5(json.dumps(d, sort_keys=True))

So I can check if a dict's contents are the same as a DB version, but I can't 
guarantee that all the keys are strings, so it breaks, annoyingly. I would very 
much like the apply-default-function-then-sort approach. Until then, my 
work-around is this:

def deep_stringize_dict_keys(item):
"""Converts all keys to strings in a nested dictionary"""
if isinstance(item, dict):
return {str(k): deep_stringize_dict_keys(v) for k, v in 
item.items()}

if isinstance(item, list):
# This will check only ONE layer deep for nested dictionaries 
inside lists.
# If you need deeper than that, you're probably doing something 
stupid.
if any(isinstance(v, dict) for v in item):
return [deep_stringize_dict_keys(v) if isinstance(v, dict) else 
v
for v in item]

# I don't care about tuples, since they don't exist in JSON

return item

Maybe it can be of some use for others.

--
nosy: +naught101

___
Python tracker 

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



[issue42865] sysconfig appends CFLAGS to LD

2021-01-07 Thread Victor Lopez


Victor Lopez  added the comment:

I'm updating this to comply with the GitHub PR policies

--
keywords: +patch
message_count: 1.0 -> 2.0
pull_requests: +22991
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24163

___
Python tracker 

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



[issue42865] sysconfig appends CFLAGS to LD

2021-01-07 Thread Victor Lopez


New submission from Victor Lopez :

This should not happen as some CFLAGS are exclusive to the compiler and it will 
break cross-compiling linkers

The proposed sysconfig is attached

--
components: Distutils
files: sysconfig.py
messages: 384632
nosy: Greentwip, dstufft, eric.araujo
priority: normal
pull_requests: 22989
severity: normal
status: open
title: sysconfig appends CFLAGS to LD
versions: Python 3.9
Added file: https://bugs.python.org/file49728/sysconfig.py

___
Python tracker 

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



[issue42762] infinite loop resulted by "yield"

2021-01-07 Thread Xinmeng Xia


Xinmeng Xia  added the comment:

I get a little confused. So is it a bug in Python 3.5 and 3.6?

--

___
Python tracker 

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



[issue42864] Improve error messages regarding unclosed parentheses

2021-01-07 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +lys.nikolaou
stage: patch review -> 

___
Python tracker 

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



[issue42864] Improve error messages regarding unclosed parentheses

2021-01-07 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch
pull_requests: +22988
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24161

___
Python tracker 

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



[issue42864] Improve error messages regarding unclosed parentheses

2021-01-07 Thread Pablo Galindo Salgado

New submission from Pablo Galindo Salgado :

Consider this file:

```
x = (


```

The error that we get is:

❯ python ../a.py
  File "/home/pablogsal/github/python/master/../a.py", line 6

^
SyntaxError: unexpected EOF while parsin

This is quite uninformative of the actual problem, which is the closed 
parentheses.

The same happens with something like this:

( 1+2

  File "/home/pablogsal/github/python/master/lel.py", line 3

^
SyntaxError: unexpected EOF while parsing

With some effort, we can include the location of the unclosed parentheses.

--
messages: 384630
nosy: pablogsal
priority: normal
severity: normal
status: open
title: Improve error messages regarding unclosed parentheses
versions: Python 3.10

___
Python tracker 

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



[issue42850] Process hangs when calling urllib.request in a multiprocessing.Process with import of sounddevice package

2021-01-07 Thread Robin Scheibler


Robin Scheibler  added the comment:

Thank you very much for the reply! I was indeed hesitating where to post the 
issue. I have now cross-posted in the sounddevice issue tracker.

https://github.com/spatialaudio/python-sounddevice/issues/302

I'll update the issue if things progress on that side.

The sounddevice is essentially a wrapper around the portaudio library, similar 
to pyaudio. I have tried the test code with an import of pyaudio rather than 
sounddevice, but the issue does not happen in that case.

--

___
Python tracker 

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



[issue14678] Update zipimport to support importlib.invalidate_caches()

2021-01-07 Thread Desmond Cheong


Change by Desmond Cheong :


--
keywords: +patch
nosy: +desmondcheongzx
nosy_count: 9.0 -> 10.0
pull_requests: +22987
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24159

___
Python tracker 

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



[issue42863] Python venv inconsistent folder structure on windows

2021-01-07 Thread Jeff Moguillansky


New submission from Jeff Moguillansky :

When creating a virtual environment on windows using venv, the folder 
structure: "Scripts", "Include", "Lib", is inconsistent with other platforms 
(e.g. "include", "lib", "bin", etc).  

This causes various integration issues.  

For example, suppose we want to build a native C library, and install it to the 
folder structure generated by the virtual environment.  
The pkg-config file assumes a folder structure of "include", "lib", "bin", and 
the generated pkg-config files are inconsistent with the python virtual 
environment folder structure.  

Can we have a consistent folder structure across platforms?

--
components: Windows
messages: 384628
nosy: jmoguill2, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Python venv inconsistent folder structure on windows
type: behavior
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue42862] Use functools.lru_cache iso. _sqlite.Cache in sqlite3 module

2021-01-07 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Short diffstat: 8 files changed, 85 insertions(+), 406 deletions(-)

--

___
Python tracker 

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



[issue42848] asyncio produces an unexpected traceback with recursive __getattribute__

2021-01-07 Thread Irit Katriel


Irit Katriel  added the comment:

So, we have a contact chain of length almost equal to the recursion limit, 
which is too much to process recursively in python (in c it does work, hence 
the difference between the outputs of the OP's two scripts).

The PR removes recursion from TracebackException (in constructor as well as in 
format()).  The code is less readable and I'm not sure this case is worth that. 
Should we instead truncate the output, ie add a limit on the recursion depth?  
(note that in this case this would remove the last "recursion depth exceeded" 
exception and show only some of the repetitive ones).

--

___
Python tracker 

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



[issue42848] asyncio produces an unexpected traceback with recursive __getattribute__

2021-01-07 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +patch
pull_requests: +22986
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24158

___
Python tracker 

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



[issue42862] Use functools.lru_cache iso. _sqlite.Cache in sqlite3 module

2021-01-07 Thread Erlend Egeberg Aasland


New submission from Erlend Egeberg Aasland :

Pro: less code, less complexity, improved maintainability
Con: minor performance hit

PoC here: https://github.com/erlend-aasland/cpython/commits/sqlite-cache

$ ./python.exe
>>> import sqlite3
>>> con = sqlite3.connect(":memory:")
>>> con.execute("select * from sqlite_master")
>>> con.execute("select * from sqlite_master")
>>> c = con.cache()
>>> c.cache_info()
CacheInfo(hits=1, misses=1, maxsize=128, currsize=1)

The test suite runs approx. 10-20 ms slower with this change. Using 
_functools._lru_cache_wrapper iso. functools.lru_cache almost removes this 
performance regression.


Berker, is it worth pursuing?

--
components: Library (Lib)
messages: 384625
nosy: berker.peksag, erlendaasland, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Use functools.lru_cache iso. _sqlite.Cache in sqlite3 module
type: enhancement
versions: Python 3.10

___
Python tracker 

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



[issue42861] ipaddress - add ability to get next closet subnet of any prefix size

2021-01-07 Thread Faisal Mahmood


Faisal Mahmood  added the comment:

Not sure how to edit an issue, but I made a mistake, where I said:
"...Calling this method would return an IPv4/v6 address that is the closest 
possible match..."

I meant to say:
"...Calling this method would return an IPv4/v6 -NETWORK- that is the closest 
possible match..."

--

___
Python tracker 

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



[issue42861] ipaddress - add ability to get next closet subnet of any prefix size

2021-01-07 Thread Faisal Mahmood


New submission from Faisal Mahmood :

The ipaddress module in Python is an excellent tool, but I noticed it is 
missing a feature that I needed several months ago, which is the ability to 
find the next closest subnet with a specific prefix length.

For example, imagine I had a IPv4Network("10.10.0.72/30"), how would I find the 
next possible /25 address? It is not the most straightforward thing to do, so 
think it would be a great enhancement to the ipaddress library.

I think this can be achieved by adding in a new method to the BaseNetwork 
class, the method could be defined like "next_prefix(next_prefix=None)".  
Calling this method would return an IPv4/v6 address that is the closest 
possible match with the new prefix (defined as next_prefix).

Example calls:
v4 = IPv4Network("10.10.0.72/30")
next_network = v4.next_subnet(next_prefix=25)
# Output: next_network = IPv4Network("10.10.0.128/25")

v4 = IPv4Network("10.10.0.72/30")
next_network = v4.next_subnet(next_prefix=30)
# Output: next_network = IPv4Network("10.10.0.76/30")

v4 = IPv4Network("10.10.0.72/30")
next_network = v4.next_subnet() # if next_prefix is not defined it will use the 
existing prefix of /30, so this call is exactly the same as the previous
# Output: next_network = IPv4Network("10.10.0.76/30")

v6 = IPv6Network("2001:db8::::::/112")
next_network = v6.next_subnet()
# Output: next_network = IPv6Network("2001:db8:::::aaab:0/112")

v6 = IPv6Network("2001:db8::::::/112")
next_network = v6.next_subnet(next_prefix=64)
# Output: next_network = IPv6Network("2001:db8::aaab::/64")

I am going to be working on this and plan to raise a PR soon.  This is my first 
time contributing to Python, so I appreciate your help / comments / suggestions 
/ guidance as I go along.

--
components: Library (Lib)
messages: 384623
nosy: fasial.mahmood94
priority: normal
severity: normal
status: open
title: ipaddress - add ability to get next closet subnet of any prefix size
type: enhancement
versions: Python 3.10

___
Python tracker 

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



[issue42846] Using _multibytecodec module on Windows, test_threading/embed get failure

2021-01-07 Thread STINNER Victor


STINNER Victor  added the comment:

> 1) python -m test --verbose test_threading
> 2) python -m test --verbose test_embed

I ran manually these two tests with cp932 ANSI code page: they now pass with my 
fix.

I also added a regression test to test_multibytecodec.py.

Thanks for your quick bug report neonene! It's now fixed.

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



[issue42846] Using _multibytecodec module on Windows, test_threading/embed get failure

2021-01-07 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 07f2cee93f1b619650403981c455f47bfed8d818 by Victor Stinner in 
branch 'master':
bpo-42846: Convert CJK codec extensions to multiphase init (GH-24157)
https://github.com/python/cpython/commit/07f2cee93f1b619650403981c455f47bfed8d818


--

___
Python tracker 

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



[issue42846] Using _multibytecodec module on Windows, test_threading/embed get failure

2021-01-07 Thread STINNER Victor


STINNER Victor  added the comment:

Ah, if you don't want to change the ANSI code page to cp932 (Japanese language) 
just to reproduce the issue, you can just set the stdio encoding:
-
C:\> set PYTHONIOENCODING=cp932
C:\> python t.py|more
sys.stdout.encoding='cp1250'

TypeError: codec is unexpected type
(...)
-

--

___
Python tracker 

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



[issue42846] Using _multibytecodec module on Windows, test_threading/embed get failure

2021-01-07 Thread STINNER Victor


STINNER Victor  added the comment:

Simpler way to reproduce the issue with t.py script:
---
import test.support
import sys

import _testcapi

print(f"{sys.stdout.encoding=}", file=sys.stderr)

with test.support.SuppressCrashReport():
_testcapi.run_in_subinterp("pass")
---

By default, UTF-8 is used, everything is fine:
-
C:\> python t.py
sys.stdout.encoding='utf-8'
-

Disable _WindowsConsoleIO with PYTHONLEGACYWINDOWSSTDIO env var, we get the 
issue:
-
C:\> set PYTHONLEGACYWINDOWSSTDIO=1

C:\> python t.py
Running Debug|x64 interpreter...
sys.stdout.encoding='cp932'
TypeError: codec is unexpected type
Fatal Python error: (...)
-

Or redirect the output into a program or a file to disable _WindowsConsoleIO to 
also reproduce the issue:
-
C:\> python t.py|more
sys.stdout.encoding='cp932'
TypeError: codec is unexpected type
(...)
-

--

___
Python tracker 

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



[issue42846] Using _multibytecodec module on Windows, test_threading/embed get failure

2021-01-07 Thread STINNER Victor


STINNER Victor  added the comment:

Attached PR 24157 should fix the issue.

> FAIL: test_daemon_threads_fatal_error 
> (test.test_threading.SubinterpThreadingTests)

This test runs code in a subinterpreter which is run in a subprocess. The 
problem is not in the code run in the subinterpreter, but the creation of 
sys.stdout in the subprocess.

The test creates a subprocess and redirects its stdout and stderr. In this 
case, Python doesn't create a _io._WindowsConsoleIO for sys.stdout.buffer.raw, 
but a regular _io.FileIO object. When the raw I/O is a _WindowsConsoleIO 
instance, create_stdio() of Python/pylifecycle.c forces the usage of the UTF-8 
encoding. But for FileIO, it keeps the locale encoding.

If the locale encoding is "cp932", a CJK multicodec is used. In the main 
interpreter, it's fine. In a subinterpreter, we hit the bug of the _codecs_jp 
which doesn't use the new multi-phase initialization API.

--

___
Python tracker 

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



[issue42846] Using _multibytecodec module on Windows, test_threading/embed get failure

2021-01-07 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +22985
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24157

___
Python tracker 

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



[issue42725] PEP 563: Should the behavior change for yield/yield from's

2021-01-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Does not walrus affect the meaning of variable? And await affects the meaning 
of generator expression.

--

___
Python tracker 

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



[issue42846] Using _multibytecodec module on Windows, test_threading/embed get failure

2021-01-07 Thread STINNER Victor


STINNER Victor  added the comment:

I'm working on a fix.

--

___
Python tracker 

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



[issue42860] Incompatible types in Python grammar

2021-01-07 Thread Lysandros Nikolaou


Lysandros Nikolaou  added the comment:

This is now fixed, Tobias!

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



[issue42860] Incompatible types in Python grammar

2021-01-07 Thread miss-islington


miss-islington  added the comment:


New changeset 07dcd86ceed0bd88d1e96dcf53b1de2fea024385 by Lysandros Nikolaou in 
branch 'master':
bpo-42860: Remove type error from grammar (GH-24156)
https://github.com/python/cpython/commit/07dcd86ceed0bd88d1e96dcf53b1de2fea024385


--
nosy: +miss-islington

___
Python tracker 

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



[issue42846] Using _multibytecodec module on Windows, test_threading/embed get failure

2021-01-07 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

It should be sufficient to convert cjkcodecs.h to multi-phase init then? From 
what I can see, the support modules are state less, right?

--

___
Python tracker 

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



[issue42837] Symbol table incorrectly identifies code as a generator, when 'yield' occurs in an annotation

2021-01-07 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

Well even though I still don't understand 'how this issue is different than 
issue42725', I don't think you actually fix the symbol table;
see this one: https://bugs.python.org/msg383659

Annotations still have side effects on the symbol table (even though they 
shouldn't have). and I already had a fix but decided not to go for it until 
issue42737 is resolved since it would make the language inconsistent. Just FYI.

--

___
Python tracker 

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



[issue42846] Using _multibytecodec module on Windows, test_threading/embed get failure

2021-01-07 Thread STINNER Victor


STINNER Victor  added the comment:

It took me a while to understand it, the _multibytecodec module itself is fine. 
The issue comes from the _codecs_jp module which uses the legacy module API:

codec = _codecs_jp.getcodec('cp932')

--

___
Python tracker 

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



[issue42846] Using _multibytecodec module on Windows, test_threading/embed get failure

2021-01-07 Thread STINNER Victor


STINNER Victor  added the comment:

I can reproduce the issue on Windows configured in Japanese language: ANSI code 
page cp932.

I managed to reproduce the bug on Linux with attached bug.py

--
Added file: https://bugs.python.org/file49727/bug.py

___
Python tracker 

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



[issue42837] Symbol table incorrectly identifies code as a generator, when 'yield' occurs in an annotation

2021-01-07 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 

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



[issue42860] Incompatible types in Python grammar

2021-01-07 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


--
keywords: +patch
pull_requests: +22984
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24156

___
Python tracker 

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



[issue42860] Incompatible types in Python grammar

2021-01-07 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


--
nosy: +lys.nikolaou

___
Python tracker 

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



[issue42859] smtplib: recipe for certifying message delivery

2021-01-07 Thread Dmitry Goldenberg


Dmitry Goldenberg  added the comment:

Yes, it's a question which could lend itself well to a documentation issue.

I've looked at things like:
https://stackoverflow.com/questions/54047021/python-smtplib-how-to-use-disposition-notification-to
https://stackoverflow.com/questions/40369645/detect-bounced-emails-in-python-smtplib

But I'm not seeing a generic approach which would let me prove messages got to 
the destination. It seems Disposition-Notification-To is not always available.

--

___
Python tracker 

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



[issue42851] Subclassing Enum with ipaddress.IPv4Network/IPv6Network raises TypeError.

2021-01-07 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 9ab4dd452287169f08a8cf4d4c68c2139f8de714 by Ethan Furman in 
branch '3.9':
[3.9] bpo-42851: [Enum] remove brittle __init_subclass__ support (GH-24154) 
(GH-24155)
https://github.com/python/cpython/commit/9ab4dd452287169f08a8cf4d4c68c2139f8de714


--

___
Python tracker 

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



[issue42846] Using _multibytecodec module on Windows, test_threading/embed get failure

2021-01-07 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

I'm unable to reproduce this on Windows 10 (amd64). What's your exact locale 
setting? Are you compiling with HEAD at 
0b858cdd5d114f0890b11b6c4d6559d0ceb468ab?

--

___
Python tracker 

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



[issue42850] Process hangs when calling urllib.request in a multiprocessing.Process with import of sounddevice package

2021-01-07 Thread Guido van Rossum

Guido van Rossum  added the comment:

I would assume it’s some interaction between threads and fork. Have you asked 
the authors of sound device about this?

--
nosy: +gvanrossum

___
Python tracker 

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



[issue42851] Subclassing Enum with ipaddress.IPv4Network/IPv6Network raises TypeError.

2021-01-07 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +22983
pull_request: https://github.com/python/cpython/pull/24155

___
Python tracker 

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



[issue42851] Subclassing Enum with ipaddress.IPv4Network/IPv6Network raises TypeError.

2021-01-07 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset a581a868d97f649aedf868a1d27865a10925c73a by Ethan Furman in 
branch 'master':
bpo-42851: [Enum] remove brittle __init_subclass__ support (GH-24154)
https://github.com/python/cpython/commit/a581a868d97f649aedf868a1d27865a10925c73a


--

___
Python tracker 

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



[issue42857] Fails to construct paths lead to "python is likely shutting down"

2021-01-07 Thread Guido van Rossum

Guido van Rossum  added the comment:

You are doing something very evil during finalization here. There’s nothing 
that can be done reasonably.

--
nosy: +gvanrossum
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue42858] Incorrect return value for os.system() in recognizing import error

2021-01-07 Thread Guido van Rossum


Change by Guido van Rossum :


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



[issue42860] Incompatible types in Python grammar

2021-01-07 Thread Tobias Kohn


New submission from Tobias Kohn :

There seems to be a small type error in the Python grammar in the rule 
`invalid_parameters`:
```
invalid_parameters:
| param_no_default* (slash_with_default | param_with_default+) 
param_no_default
```
While the `slash_with_default` returns a single element, the 
`param_with_default` returns a list/sequence.

--
messages: 384603
nosy: tobias.kohn
priority: normal
severity: normal
status: open
title: Incompatible types in Python grammar
versions: Python 3.9

___
Python tracker 

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



[issue42725] PEP 563: Should the behavior change for yield/yield from's

2021-01-07 Thread Guido van Rossum

Guido van Rossum  added the comment:

I wouldn’t have thought you’d need a PEP for this but if you want to write one 
that sounds like the right thing.

Re: async and walrus: I think those are different, their presence doesn’t 
affect the meaning of the function like yield. We can’t hope to prevent side 
effects syntactically.

--

___
Python tracker 

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



[issue42859] smtplib: recipe for certifying message delivery

2021-01-07 Thread Guido van Rossum


Guido van Rossum  added the comment:

This looks more like a question than an issue.  Have you tried stackoverflow or 
a user forum?

--
nosy: +gvanrossum

___
Python tracker 

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



[issue42851] Subclassing Enum with ipaddress.IPv4Network/IPv6Network raises TypeError.

2021-01-07 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch
pull_requests: +22982
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24154

___
Python tracker 

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



[issue42859] smtplib: recipe for certifying message delivery

2021-01-07 Thread Dmitry Goldenberg


New submission from Dmitry Goldenberg :

Is there a reliable way to certify (ensure, track) the delivery of an email 
message when using smtplib?

For example:
Disposition-Notification-To message header which enables the e-mail reader of 
the recipient to send confirmation e-mail when the recipient opens the message 
for the first time. That e-mail reader program must support this functionality.

Return-Receipt-To message header which enables the e-mail server of the 
recipient to send confirmation e-mail when the original e-mail gets received by 
that server. However, most newer e-mail servers do not support 
Return-Receipt-To header.

Are these message headers at all reliable?

The request is to enhance the documentation to provide an example of how to 
track a message delivery. Conversely, if it's plain not possible, the request 
is to state that explicitly in the docs.

--
assignee: docs@python
components: Documentation
messages: 384600
nosy: dgoldenberg123, docs@python
priority: normal
severity: normal
status: open
title: smtplib: recipe for certifying message delivery
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue42811] Update docs for importlib.util.resolve_name() to use __spec__.parent instead of __package__

2021-01-07 Thread Brett Cannon


Brett Cannon  added the comment:


New changeset ca8e96d1edbeb536f58da91e607082463398fce1 by Miss Islington (bot) 
in branch '3.8':
bpo-42811: Update importlib.utils.resolve_name() docs to use __spec__.parent 
(GH-24100) (GH-24144)
https://github.com/python/cpython/commit/ca8e96d1edbeb536f58da91e607082463398fce1


--

___
Python tracker 

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



[issue42811] Update docs for importlib.util.resolve_name() to use __spec__.parent instead of __package__

2021-01-07 Thread miss-islington


miss-islington  added the comment:


New changeset 8c3914aef47e6e5a31b48a0b1f165ec3f4dc4c98 by Yair Frid in branch 
'3.9':
[3.9] bpo-42811: Update importlib.utils.resolve_name() docs to use 
__spec__.parent (GH-24100) (GH-24149)
https://github.com/python/cpython/commit/8c3914aef47e6e5a31b48a0b1f165ec3f4dc4c98


--

___
Python tracker 

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



[issue42855] pathlib.exists on Windows raises an exception on URL like/bad input

2021-01-07 Thread Eryk Sun


Eryk Sun  added the comment:

An alternative would be to add a "strict" parameter that defaults to False. In 
non-strict mode, map all OSError exceptions to a False return value. In strict 
mode, use _ignore_error(e) to determine whether to return False or propagate 
the exception. The question then is whether to add ERROR_INVALID_NAME (123) to 
_IGNORED_WINERRORS since the error means the name can never exist. On the other 
hand, ERROR_ACCESS_DENIED due to a permission error would be propagated in 
strict mode -- because the path's existence is unknown.

--

___
Python tracker 

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



[issue42513] Socket.recv hangs

2021-01-07 Thread Barney Stratford


Barney Stratford  added the comment:

Sure. So, I'm using STOMP to connect to a messaging server. STOMP uses 
heartbeats to detect and close failed connections. The problem was that if the 
connection fails before the protocol has set up its heartbeats then there's 
nothing to stop the whole thing hanging. I had a timeout on the 
socket.create_connection, thinking this would protect against this edge-case, 
but it wasn't sufficient.

STOMP is such a simple protocol that it's often worth writing your own code to 
handle it. Indeed, this is actively encouraged. My own STOMP code is about 250 
lines in a single source file, compared to nearly 3500 lines in 13 files for 
stomp.py. I very much prefer to simplify things as much as possible, and 
smaller is almost always better in my view. Simplify!

So, I kept seeing this very occasional hang-up in my code, and probing it with 
gdb showed that the execution was always stuck inside the poll. Of course it 
was, as that's where it sits to wait for something to happen. Then I was lead 
astray by finding that website, so I saddled up to save the world, as one does 
in such situations.

--

___
Python tracker 

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



[issue42855] pathlib.exists on Windows raises an exception on URL like/bad input

2021-01-07 Thread Steve Dower


Steve Dower  added the comment:

Yeah, I think saying "return True if it provably exists and False if existence 
cannot be proven (and never raise)" is a good general rule for 
boolean-returning functions.

This definitely raises some edge cases where we can infer from certain error 
codes that a path exists, but I don't think it obliges us to prioritise fixing 
those in order to handle more obvious cases.

--

___
Python tracker 

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



[issue42513] Socket.recv hangs

2021-01-07 Thread Jakub Stasiak


Jakub Stasiak  added the comment:

If the edge-case is vaguely socket/file descriptor-related and not 
application-specific or otherwise secret do you mind sharing what is it? (I'm 
just curious)

--

___
Python tracker 

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



[issue42513] Socket.recv hangs

2021-01-07 Thread Barney Stratford


Barney Stratford  added the comment:

Instrumented code shows that the poll is in fact working completely correctly, 
and I've run into a documented edge-case in an unrelated area. Hence, closing 
the bug report and cancelling the pull request.

--
resolution:  -> not a bug
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



[issue41837] Upgrade installers to OpenSSL 1.1.1i

2021-01-07 Thread Christian Heimes


Christian Heimes  added the comment:

They are impacted. However 3.7.9 and 3.6.8 were the last releases with binaries 
for Windows and macOS. All subsequent releases are source-only releases. Since 
we don't release binaries for 3.6 and 3.7 any more, we typically don't update 
them.

--

___
Python tracker 

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



[issue42851] Subclassing Enum with ipaddress.IPv4Network/IPv6Network raises TypeError.

2021-01-07 Thread Ethan Furman


Ethan Furman  added the comment:

That would be due to some changes to try and get `Enum` and `__init_subclass__` 
to work together.

I'll revert those changes.  Thank you for the report.

--
assignee:  -> ethan.furman
priority: normal -> high

___
Python tracker 

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



[issue42783] asyncio.sleep(0) idiom is not documented

2021-01-07 Thread Ken Jin


Change by Ken Jin :


--
nosy: +kj
nosy_count: 5.0 -> 6.0
pull_requests: +22981
stage: backport needed -> patch review
pull_request: https://github.com/python/cpython/pull/24153

___
Python tracker 

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



[issue41837] Upgrade installers to OpenSSL 1.1.1i

2021-01-07 Thread Sebastian Voigt


Sebastian Voigt  added the comment:

The fix has only be done for 3.8, 3.9 and 3.10. Are 3.7 and 3.6 are not 
impacted?

--
nosy: +squear

___
Python tracker 

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



[issue42725] PEP 563: Should the behavior change for yield/yield from's

2021-01-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Should not "await" and "async for" (in comprehesions) and ":=" be forbidden too?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue42852] pprint fails in transformming non-breaking space

2021-01-07 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution: fixed -> not a bug

___
Python tracker 

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



[issue42852] pprint fails in transformming non-breaking space

2021-01-07 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue42858] Incorrect return value for os.system() in recognizing import error

2021-01-07 Thread STINNER Victor


STINNER Victor  added the comment:

See also https://docs.python.org/dev/library/sys.html#sys.unraisablehook

--
nosy: +vstinner

___
Python tracker 

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



[issue19683] test_minidom has many empty tests

2021-01-07 Thread karl


Change by karl :


--
pull_requests: +22980
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/24152

___
Python tracker 

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



[issue42858] Incorrect return value for os.system() in recognizing import error

2021-01-07 Thread Christian Heimes


Christian Heimes  added the comment:

The exceptions are ignored (Exception ignored in) on shutdown and therefore 
don't cause the interpreter to fail with an error code. Unraisable exceptions 
typically occur when the interpreter is mostly shut down and garbage 
collection, import or atexit hook is triggered as a side-effect.

--
nosy: +christian.heimes

___
Python tracker 

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



[issue42513] Socket.recv hangs

2021-01-07 Thread Barney Stratford


Barney Stratford  added the comment:

The instrumented code froze today, so I'm finally able to probe the bug. 
Despite what that website said, it's looking like checking the return fron the 
poll syscall isn't the problem here. I'm probably going to close this bug 
report as not a bug, but want to check fully before I do so.

--

___
Python tracker 

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



[issue42855] pathlib.exists on Windows raises an exception on URL like/bad input

2021-01-07 Thread Paul Moore


Paul Moore  added the comment:

So I guess the key question then is whether Path.exists() should trap 
exceptions and interpret them as "does not exist" (on all platforms, although 
it looks like the null character case in Unix has now been fixed). Which 
doesn't seem unreasonable, I guess.

--

___
Python tracker 

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



[issue42855] pathlib.exists on Windows raises an exception on URL like/bad input

2021-01-07 Thread Eryk Sun


Eryk Sun  added the comment:

> "http:" isn't a valid drive letter, I'd imagine.

It's not a valid DOS drive, but that's not the problem. "http://w.org; is 
parsed as a relative path. The double slashes are replaced by a single 
backslash, and the Windows API tries to open the path relative to a handle for 
the current working directory. 

The issue is handling a path component named "http:". Some filesystems such as 
FAT32 reserve ":" as an invalid name character. Others such as NTFS and ReFS 
reserve ":" as the stream delimiter [1], and "http:" is not a valid stream 
name. I'm on the fence about how to handle names that the OS rejects as invalid 
in a boolean context (e.g. exists, isfile, etc). In one sense, returning False 
is reasonable because an invalid name cannot exist. But on the other hand, 
asking whether something that's invalid exists is a nonsense question that 
warrants an exception. That said, the issue has already been decided multiple 
times in favor of returning False, so at this point that's a pattern that 
should be consistently supported by the standard library.

Note that a filesystem may allow ":" as name character, such as the VirtualBox 
shared-folder filesystem redirector. But the latter brings up yet another 
twist. Adding a redirector into the device stack, and thus including the MUP 
(multiple UNC provider) device, brings along more path-parsing baggage. In this 
case a component name with ":" in it fails as bad syntax, which gets mapped to 
WinAPI ERROR_BAD_PATHNAME (161), and thus C ENOENT, and ultimately 
FileNotFoundError in Python. This is the case regardless of the filesystem. For 
example, let's use the SMB redirector to set the "//localhost/C$" share for the 
"C:" drive as the working directory:

>>> os.chdir('//localhost/C$')
>>> os.stat('http://w.org')
Traceback (most recent call last):
  File "", line 1, in 
FileNotFoundError: [WinError 161] The specified path is invalid: 
'http://w.org'

>>> Path('http://w.org').exists()
False

---

[1] https://docs.microsoft.com/en-us/windows/win32/fileio/file-streams

--
nosy: +eryksun

___
Python tracker 

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



[issue42852] pprint fails in transformming non-breaking space

2021-01-07 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

By the way, there is no need to use the u'' prefix on strings in Python 3.

Unfortunately, I think this is a case where pprint doesn't meet your 
expectations. pprint is designed to print the repr of a string, while regular 
print prints the human-visible str:

>>> print(repr('\240 hello'))
'\xa0 hello'
>>> print('\240 hello')
  hello

Its not just non-breaking space, it also includes ASCII characters:


>>> print(repr('\01 hello'))
'\x01 hello'
>>> print('\01 hello')
 hello
>>> pprint.pprint('\01 hello')
'\x01 hello'


So this is intentional behaviour, not a bug. If you want to change the 
behaviour, it will probably require a re-design of the way strings are printed 
by the pprint module.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue42858] Incorrect return value for os.system() in recognizing import error

2021-01-07 Thread Xinmeng Xia


Change by Xinmeng Xia :


--
type:  -> compile error

___
Python tracker 

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



[issue42856] ensurepip: add configure --with-wheel-pkg-dir=PATH to get wheel packages from a system directory

2021-01-07 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +22979
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24151

___
Python tracker 

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



[issue42858] Incorrect return value for os.system() in recognizing import error

2021-01-07 Thread Xinmeng Xia


New submission from Xinmeng Xia :

Running attached "test_zipfile.py" on Python 3.10 will lead to the following 
error messages:

Exception ignored in: 
Traceback (most recent call last):
  File "/usr/local/python310/lib/python3.10/test/support/os_helper.py", line 
401, in temp_dir
  File "/usr/local/python310/lib/python3.10/test/support/os_helper.py", line 
358, in rmtree
  File "/usr/local/python310/lib/python3.10/test/support/os_helper.py", line 
322, in _rmtree
ImportError: sys.meta_path is None, Python is likely shutting down
Exception ignored in: 
Traceback (most recent call last):
  File "/usr/local/python310/lib/python3.10/test/support/os_helper.py", line 
401, in temp_dir
  File "/usr/local/python310/lib/python3.10/test/support/os_helper.py", line 
358, in rmtree
  File "/usr/local/python310/lib/python3.10/test/support/os_helper.py", line 
322, in _rmtree
ImportError: sys.meta_path is None, Python is likely shutting down


However, if we run this program with os.system, the return value is 0 instead 
of 256. 0 represent no fails in this running! This is obviously incorrect.

Reproduce:
=
import os
scode = os.system('python310  test_zipfile.py')
print("The system code of this execution is:", scode)
=

The expected output: "The system code of this execution is: 256"
The actual output: "The system code of this execution is: 0"

Version info:
>>python310 -V
Python 3.10.0a2
>>uname -v
16.04.1-Ubuntu SMP Fri Sep 13 09:56:18 UTC 2019

--
components: Library (Lib)
files: test_zipfile.py
messages: 384582
nosy: xxm
priority: normal
severity: normal
status: open
title: Incorrect return value for os.system() in recognizing import error
versions: Python 3.10
Added file: https://bugs.python.org/file49726/test_zipfile.py

___
Python tracker 

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



[issue42856] ensurepip: add configure --with-wheel-pkg-dir=PATH to get wheel packages from a system directory

2021-01-07 Thread Christian Heimes


Change by Christian Heimes :


--
nosy: +christian.heimes, dstufft, ncoghlan, pradyunsg

___
Python tracker 

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



[issue42857] Fails to construct paths lead to "python is likely shutting down"

2021-01-07 Thread Xinmeng Xia


New submission from Xinmeng Xia :

The attached file "test_zipfile.py" is from test directory in cPython. We 
delete irrelevant code. Running this code on Python 3.10 will lead to the 
following error messages.

Exception ignored in: 
Traceback (most recent call last):
  File "/usr/local/python310/lib/python3.10/test/support/os_helper.py", line 
401, in temp_dir
  File "/usr/local/python310/lib/python3.10/test/support/os_helper.py", line 
358, in rmtree
  File "/usr/local/python310/lib/python3.10/test/support/os_helper.py", line 
322, in _rmtree
ImportError: sys.meta_path is None, Python is likely shutting down
Exception ignored in: 
Traceback (most recent call last):
  File "/usr/local/python310/lib/python3.10/test/support/os_helper.py", line 
401, in temp_dir
  File "/usr/local/python310/lib/python3.10/test/support/os_helper.py", line 
358, in rmtree
  File "/usr/local/python310/lib/python3.10/test/support/os_helper.py", line 
322, in _rmtree
ImportError: sys.meta_path is None, Python is likely shutting down

The expected output should be something like" ImportError: No module named XXX" 
 rather than "Python is likely shutting down"

--
components: Interpreter Core
files: test_zipfile.py
messages: 384581
nosy: xxm
priority: normal
severity: normal
status: open
title: Fails to construct paths lead to "python is likely shutting down"
type: crash
versions: Python 3.10
Added file: https://bugs.python.org/file49725/test_zipfile.py

___
Python tracker 

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



[issue42725] PEP 563: Should the behavior change for yield/yield from's

2021-01-07 Thread Mark Shannon


Mark Shannon  added the comment:

What's the process for making a decision on whether to make 'yield' in an 
annotation a syntax error?

As a language change it should have a PEP, IMO.
The PEP will be short, and shouldn't need a long-winded acceptance process.
I just think that a PEP is more visible to the community than the bug tracker.

I'm happy to write the PEP.

--
nosy: +larry

___
Python tracker 

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



[issue42856] ensurepip: add configure --with-wheel-pkg-dir=PATH to get wheel packages from a system directory

2021-01-07 Thread Miro Hrončok

Miro Hrončok  added the comment:

For simplicity, I would avoid mixing wheels from 2 different directories.

--
nosy: +hroncok

___
Python tracker 

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



[issue42856] ensurepip: add configure --with-wheel-pkg-dir=PATH to get wheel packages from a system directory

2021-01-07 Thread STINNER Victor


STINNER Victor  added the comment:

> If used, ensurepip will only use wheel packages from this directory.

An alternative is to find packages in all directories and pick the most recent 
version.

Example with a specified directory *and* ensurepip._bundled is available:

* wheel package directory: 

  * pip 20.2.2
  * setuptools 49.1.3
  * wheel 0.34.2

* ensurepip._bundled

  * pip 20.2.3
  * setuptools 47.1.0

Most recent versions:

* pip 20.2.3 from ensurepip._bundled
* setuptools 49.1.3 from the wheel package directory

Problem: I'm not sure that pip is fully compatible with any setuptools version.

--

___
Python tracker 

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



[issue42856] ensurepip: add configure --with-wheel-pkg-dir=PATH to get wheel packages from a system directory

2021-01-07 Thread STINNER Victor

New submission from STINNER Victor :

The Fedora packaging policy recommends to "unbundle" bundled dependencies.

"Fedora packages SHOULD make every effort to avoid having multiple, separate, 
upstream projects bundled together in a single package."
https://docs.fedoraproject.org/en-US/packaging-guidelines/#bundling

The main motivation is to ease updates when fix serious vulnerabilities (less 
packaging work).

The ensurepip package contains bundled wheel packages of setuptools and pip:

$ ls Lib/ensurepip/_bundled/
pip-20.2.3-py2.py3-none-any.whl
setuptools-47.1.0-py3-none-any.whl

The Fedora python3 package doesn't contain the ensurepip._bundled package:

$ python3
Python 3.9.1 (default, Dec  8 2020, 00:00:00) 
>>> import ensurepip._bundled
ModuleNotFoundError: No module named 'ensurepip._bundled'

Instead, a separated RPM package python-pip-wheel provides wheel packages in 
/usr/share/python-wheels/ directory:

$ ls /usr/share/python-wheels/
pip-20.2.2-py2.py3-none-any.whl*
setuptools-49.1.3-py3-none-any.whl*
wheel-0.34.2-py2.py3-none-any.whl*

Fedora has a downstream patch on ensurepip (written by Miro Hrončok) to always 
use /usr/share/python-wheels/:

https://src.fedoraproject.org/rpms/python3.10/blob/master/f/00189-use-rpm-wheels.patch

Fedora has packages of 9 CPython versions: 2.6, 2.7, 3.4, 3.5, 3.6, 3.7, 3.8, 
3.9, 3.10.

https://developer.fedoraproject.org/tech/languages/python/multiple-pythons.html

Having a separated package for wheel packages allows us to upgrade a single 
package (python-pip-wheel) for setuptools/pip bugfix or security vulnerability.

--

I propose to add a new --with-wheel-pkg-dir=PATH option to the ./configure 
script. If used, ensurepip will only use wheel packages from this directory. 
Otherwise, the existing code is unchanged. In short, the behavior is unchanged, 
unless the option is used explicitly.

If a directory is specified but wheel packages are missing, ensurepip fails.

If the directory contains multiple wheel packages of different versions, the 
most recent version is used of each package.

Note: In practice, the Fedora package only provides a single wheel package of 
each Python module. But I propose to make the Python upstream code as generic 
as possible.

I'm working on a pull request to implement this.

Downstream Fedora issue: https://bugzilla.redhat.com/show_bug.cgi?id=1874803

--

Fedora (Miro) already contributed to ensurepip to make ensurepip less dependent 
on pip internals:

commit 88f82b2b9ea3514359cb6e3218121f75334063ac
Author: Miro Hrončok 
Date:   Tue Mar 10 22:16:28 2020 +0100

bpo-38662: ensurepip invokes pip via runpy (GH-18901)

The ensurepip module now invokes pip via the runpy module.
Hence it is no longer tightly coupled with the internal API of the bundled
pip version, allowing easier updates to a newer pip version both
internally and for distributors.

This way, any changes to the internal pip API won't mean ensurepip needs to 
be
changed as well. Also, distributors can update their pip wheels independent 
on
CPython release schedule.

Co-Authored-By: Pradyun Gedam 
Co-Authored-By: Miro Hrončok 

This change was already related to Fedora downstream change to get wheel 
packages from a different directory. Fedora can use a different pip version 
(older or more recent) than ensurepip._bundled.

--
components: Library (Lib)
messages: 384577
nosy: vstinner
priority: normal
severity: normal
status: open
title: ensurepip: add configure --with-wheel-pkg-dir=PATH to get wheel packages 
from a system directory
versions: Python 3.10

___
Python tracker 

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



[issue19683] test_minidom has many empty tests

2021-01-07 Thread karl


karl  added the comment:

Ah no. They ARE used

through defproperty and minicompat.py

get = getattr(klass, ("_get_" + name))

--

___
Python tracker 

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



[issue19683] test_minidom has many empty tests

2021-01-07 Thread karl

karl  added the comment:

These methods are not used anywhere in the code. 

https://github.com/python/cpython/blob/5c30145afb6053998e3518befff638d207047f00/Lib/xml/dom/minidom.py#L71-L80

What was the purpose when they were created… hmm maybe blame would give clue. 
Ah they were added a long time ago

https://github.com/python/cpython/commit/73678dac48e5858e40cba6d526970cba7e7c769c#diff-365c30899ded02b18a2d8f92de47af6ca213eefe7883064c8723598da600ea42R83-R88

but never used? or was it in the spirit to reserve the keyword for future use?
https://developer.mozilla.org/en-US/docs/Web/API/Node/firstChild

--

___
Python tracker 

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



[issue42823] Incorrect frame.f_lineno when frame.f_trace is set

2021-01-07 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +22978
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/24150

___
Python tracker 

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



[issue42848] asyncio produces an unexpected traceback with recursive __getattribute__

2021-01-07 Thread Irit Katriel


Irit Katriel  added the comment:

Yes I'll have a look.

--

___
Python tracker 

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



[issue42811] Update docs for importlib.util.resolve_name() to use __spec__.parent instead of __package__

2021-01-07 Thread Yair Frid


Change by Yair Frid :


--
pull_requests: +22977
pull_request: https://github.com/python/cpython/pull/24149

___
Python tracker 

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



[issue42855] pathlib.exists on Windows raises an exception on URL like/bad input

2021-01-07 Thread Dominic Davis-Foster


Dominic Davis-Foster  added the comment:

Paul's example with the embedded null no longer works on Python 3.8 as 
Path.exists returns False on ValueError (added in gh-7695)

Path.exists already ignores some Windows-specific errors, so I don't see why it 
shouldn't also ignore invalid paths which can't exist.

--
nosy: +domdfcoding2

___
Python tracker 

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



[issue42855] pathlib.exists on Windows raises an exception on URL like/bad input

2021-01-07 Thread Paul Moore


Paul Moore  added the comment:

"http:" isn't a valid drive letter, I'd imagine.

--

___
Python tracker 

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



[issue42855] pathlib.exists on Windows raises an exception on URL like/bad input

2021-01-07 Thread gaborjbernat


gaborjbernat  added the comment:

How come the link is invalid on Windows but valid on UNIX?

--

___
Python tracker 

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



[issue42855] pathlib.exists on Windows raises an exception on URL like/bad input

2021-01-07 Thread Paul Moore

Paul Moore  added the comment:

It's an invalid filename so it raises an exception.

You can get the same on Unix by using an invalid filename (embedded null):

>>> from pathlib import Path
>>> Path("/usr/\0").exists()
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib64/python3.7/pathlib.py", line 1356, in exists
    self.stat()
  File "/usr/lib64/python3.7/pathlib.py", line 1178, in stat
    return self._accessor.stat(self)
ValueError: embedded null byte

You need to be prepared for exceptions if you aren't sure you have a valid 
path. One thing that might be useful, I guess, is a `Path.is_valid()` function. 
But I don't know if all platforms have a way of asking the OS "is this a valid 
pathname?" So catching the exception is probably best.

--

___
Python tracker 

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



[issue42855] pathlib.exists on Windows raises an exception on URL like/bad input

2021-01-07 Thread gaborjbernat

New submission from gaborjbernat :

❯ py -c "from pathlib import Path; Path('http://w.org').exists()"
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python39\lib\pathlib.py", line 1407, in exists
self.stat()
  File "C:\Python39\lib\pathlib.py", line 1221, in stat
return self._accessor.stat(self)
OSError: [WinError 123] The filename, directory name, or volume label syntax is 
incorrect: 'http:\\w.org'

The above code returns correctly False on UNIX systems.

--
components: Windows
messages: 384569
nosy: gaborjbernat, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: pathlib.exists on Windows raises an exception on URL like/bad input
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue42852] pprint fails in transformming non-breaking space

2021-01-07 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



[issue42035] [C API] PyType_GetSlot cannot get tp_name

2021-01-07 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



[issue42854] OpenSSL 1.1.1: use SSL_write_ex() and SSL_read_ex()

2021-01-07 Thread Christian Heimes


Christian Heimes  added the comment:

As of version 3.3.1, LibreSSL does not have SSL_write_ex() and SSL_read_ex(). 
The read and write functions are limited to int.

--

___
Python tracker 

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



[issue42854] OpenSSL 1.1.1: use SSL_write_ex() and SSL_read_ex()

2021-01-07 Thread Christian Heimes


New submission from Christian Heimes :

SSL_read() and SSL_write() are limited to int. The new SSL_write_ex() and 
SSL_read_ex() APIs support size_t just like read(2) and recv(2). Also see 
bpo-42853.

int SSL_write_ex(SSL *s, const void *buf, size_t num, size_t *written);
int SSL_read_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes);

Both functions return 1 for success or 0 for failure.

--
assignee: christian.heimes
components: SSL
messages: 384567
nosy: christian.heimes
priority: normal
severity: normal
status: open
title: OpenSSL 1.1.1: use SSL_write_ex() and SSL_read_ex()
type: enhancement
versions: Python 3.10

___
Python tracker 

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



[issue42853] `OverflowError: signed integer is greater than maximum` in ssl.py for files larger than 2GB

2021-01-07 Thread Christian Heimes


Christian Heimes  added the comment:

I cannot lift the overflow restriction until we drop support for OpenSSL 1.0.2. 
The function SSL_write() and SSL_read() are limited to signed 32bit int. 
OpenSSL 1.1.1 has new SSL_write_ex() and SSL_read_ex() functions that support 
size_t. Even size_t limits the maximum value to unsigned 32bit (~4GB) on 32bit 
systems.

--

___
Python tracker 

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



[issue42853] `OverflowError: signed integer is greater than maximum` in ssl.py for files larger than 2GB

2021-01-07 Thread Christian Heimes


Change by Christian Heimes :


--
assignee: christian.heimes -> methane
components: +Library (Lib) -SSL
nosy: +methane

___
Python tracker 

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



[issue42853] `OverflowError: signed integer is greater than maximum` in ssl.py for files larger than 2GB

2021-01-07 Thread Andrew MacDonald


New submission from Andrew MacDonald :

When attempting to read a large file (> 2GB) over HTTPS the read fails with 
"OverflowError: signed integer is greater than maximum".

This occurs with Python >=3.8 and I've been able to reproduce the problem with 
the below snippet of code on Linux, Mac OS X, and Windows (the remote file can 
be any HTTPS hosted file larger than 2GB, e.g. an empty file generated with `dd 
if=/dev/zero of=2g.img bs=1 count=0 seek=2G` will also do the job.).

```
import http.client
connection = http.client.HTTPSConnection("mirror.aarnet.edu.au")
connection.request("GET", 
"/pub/centos/8/isos/x86_64/CentOS-8.3.2011-x86_64-dvd1.iso")
response = connection.getresponse()
data = response.read()
```

Doing a git bisect it looks like this is the result of a change in commit 
d6bf6f2d0c83f0c64ce86e7b9340278627798090 
(https://github.com/python/cpython/commit/d6bf6f2d0c83f0c64ce86e7b9340278627798090).
 Looking over the associated issue and commit message it seems like this was 
not an intended outcome for the change.

--
assignee: christian.heimes
components: SSL
messages: 384565
nosy: amacd31, christian.heimes
priority: normal
severity: normal
status: open
title: `OverflowError: signed integer is greater than maximum` in ssl.py for 
files larger than 2GB
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9

___
Python tracker 

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



  1   2   >