[issue45082] ctypes: Deprecate c_buffer() alias to create_string_buffer()

2021-09-02 Thread Inada Naoki


Inada Naoki  added the comment:

I'm +0 to this.
Since this alias is not a big maintenance burden, I think we can use 
deprecation period longer than minimum 2 releases.

In sdist files of the top5000 pypi packages, I found 18 packages using it 
including false positive (e.g. mypi just have it in pyi file).

```
$ rg -z -w c_buffer *.gz *.zip *.bz2 *.tgz
Binary file Django-3.2.6.tar.gz matches (found "\u{0}" byte around offset 14)
Binary file Wand-0.6.7.tar.gz matches (found "\u{0}" byte around offset 14)
Binary file av-8.0.3.tar.gz matches (found "\u{0}" byte around offset 9)
Binary file eth-hash-0.3.1.tar.gz matches (found "\u{0}" byte around offset 14)
Binary file eth-account-0.5.5.tar.gz matches (found "\u{0}" byte around offset 
14)
Binary file eth_abi-2.1.1.tar.gz matches (found "\u{0}" byte around offset 14)
Binary file eth-utils-1.10.0.tar.gz matches (found "\u{0}" byte around offset 
14)
Binary file grpcio-1.39.0.tar.gz matches (found "\u{0}" byte around offset 14)
Binary file grpcio-tools-1.39.0.tar.gz matches (found "\u{0}" byte around 
offset 20)
Binary file hexbytes-0.2.2.tar.gz matches (found "\u{0}" byte around offset 14)
Binary file jedi-0.18.0.tar.gz matches (found "\u{0}" byte around offset 14)
Binary file lxml-4.6.3.tar.gz matches (found "\u{0}" byte around offset 14)
Binary file mypy-0.910.tar.gz matches (found "\u{0}" byte around offset 11)
Binary file os_sys-2.1.4.tar.gz matches (found "\u{0}" byte around offset 13)
Binary file playsound-1.3.0.tar.gz matches (found "\u{0}" byte around offset 14)
Binary file pyarrow-5.0.0.tar.gz matches (found "\u{0}" byte around offset 14)
Binary file pylint-2.10.2.tar.gz matches (found "\u{0}" byte around offset 14)
Binary file pytype-2021.8.24.tar.gz matches (found "\u{0}" byte around offset 
17)
```

--
nosy: +methane

___
Python tracker 

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



[issue39816] More descriptive error message than "too many values to unpack"

2021-09-02 Thread Dávid Nemeskey

Dávid Nemeskey  added the comment:

+1. When starting out, I always got confused about this message ("too many 
values to unpack? Does that mean my function returned too many items, which 
could not be unpacked into the expected number? Oh no, the opposite...").

Also, please note that the stack trace usually shows the offending line (e.g. 
x, y, z = fn(...)), so it is easy to see how many values are _expected_. It 
would be even more helpful to (also) show how many we _got_.

--
nosy: +nemeskeyd

___
Python tracker 

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



[issue45080] functools._HashedSeq implements __hash__ but not __eq__

2021-09-02 Thread Leopold Talirz


Leopold Talirz  added the comment:

Thanks a lot for the clarification, I get it now (I think).

> 2. _HashedSeq is only used as a key in a dictionary. When you look up a key 
> in dictionary, it compares hashes first. __eq__ is only called when hashes 
> match.

I was looking at the docs [1] and [2] and didn't come across this.
For me, this explanation of how __hash__ and __eq__ are used in the LRU cache 
would have been helpful to read in [1], but of course there is a tradeoff in 
how long to make docstrings.
If it is already explained somewhere else in the docs, linking to that place 
from [1] could be useful.

[1] https://docs.python.org/3/library/functools.html#functools.lru_cache
[2] https://docs.python.org/3/reference/datamodel.html#object.__hash__

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



[issue33426] [doc] Behavior of os.path.join does not match documentation

2021-09-02 Thread Rainald Koch


Rainald Koch  added the comment:

Minimal changes that would largely reduce the likelihood of being 
misunderstood: Remove "intelligently" or replace "following" by "added after".

--
nosy: +Rainald Koch

___
Python tracker 

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



[issue45061] [C API] Detect refcount bugs on True/False in C extensions

2021-09-02 Thread Christian Tismer


Christian Tismer  added the comment:

> Apart None, True and False, do you know other objects which must not be 
> deleted?

Yes, what I can think of is the immutable empty tuple singleton
which is such a candidate to be forgotten.

--

___
Python tracker 

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



[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-02 Thread Yurii Karabas


Change by Yurii Karabas <1998uri...@gmail.com>:


--
keywords: +patch
nosy: +uriyyo
nosy_count: 4.0 -> 5.0
pull_requests: +26562
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/28121

___
Python tracker 

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



[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2021-09-02 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset d589a7e7eb56196c05337d37417479375878b127 by Victor Stinner in 
branch 'main':
bpo-40360: Deprecate the lib2to3 package (GH-28116)
https://github.com/python/cpython/commit/d589a7e7eb56196c05337d37417479375878b127


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue22764] object lifetime fragility in unittest tests

2021-09-02 Thread Irit Katriel


Change by Irit Katriel :


--
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2021-09-02 Thread Łukasz Langa

Change by Łukasz Langa :


--
pull_requests: +26563
pull_request: https://github.com/python/cpython/pull/28122

___
Python tracker 

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



[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2021-09-02 Thread Łukasz Langa

Łukasz Langa  added the comment:

> We can add to the 3.10 docs that it is deprecated without any code change.

This was already the case:
https://docs.python.org/3/library/2to3.html#module-lib2to3

The wording was a bit clumsy so I rephrased in GH-28122.

--

___
Python tracker 

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



[issue45085] Remove the binhex module, binhex4 and hexbin4 standards

2021-09-02 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset a8066087054417885db0a2dbdce2ddb2ac498247 by Victor Stinner in 
branch 'main':
bpo-45085: Remove the binhex module (GH-28117)
https://github.com/python/cpython/commit/a8066087054417885db0a2dbdce2ddb2ac498247


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue35190] doc: collections.abc.Sequence cannot be used to test whether a class provides a particular interface

2021-09-02 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy
title: collections.abc.Sequence cannot be used to test whether a class provides 
a particular interface (doc issue) -> doc: collections.abc.Sequence cannot be 
used to test whether a class provides a particular interface
versions: +Python 3.10, Python 3.11, Python 3.9 -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



[issue23864] doc: issubclass without registration only works for "one-trick pony" collections ABCs.

2021-09-02 Thread Irit Katriel


Irit Katriel  added the comment:

See also issue35190.

--
keywords: +easy -patch
nosy: +iritkatriel
title: issubclass without registration only works for "one-trick pony" 
collections ABCs. -> doc: issubclass without registration only works for 
"one-trick pony" collections ABCs.
type:  -> behavior
versions: +Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue45085] Remove the binhex module, binhex4 and hexbin4 standards

2021-09-02 Thread Łukasz Langa

Łukasz Langa  added the comment:

Agreed with Victor. I'd go with the "traditional" flow of 
PendingDeprecationWarning in 3.9, DeprecationWarning in 3.10, and removal in 
3.11; but since we kept DeprecationWarning for two releases, it's pretty much 
the same and fine to remove it now.

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



[issue32766] 4.7.7. Function Annotations

2021-09-02 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Mistaken notion in tutorial

___
Python tracker 

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



[issue42255] webbrowser.MacOSX is unused, untested and undocumented

2021-09-02 Thread Łukasz Langa

Łukasz Langa  added the comment:

Dong-hee Na, you can't remove it in 3.12 per PEP 387:

> Unless it is going through the deprecation process below, the behavior of an 
> API must not change in an incompatible fashion between any two consecutive 
> releases. Python's yearly release process (PEP 602) means that the 
> deprecation period must last at least two years.

and:

> Wait for the warning to appear in at least two minor Python versions of the 
> same major version.

--
nosy: +lukasz.langa

___
Python tracker 

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



[issue41367] Popen Timeout raised on 3.6 but not on 3.8

2021-09-02 Thread Irit Katriel


Irit Katriel  added the comment:

3.6 is no longer maintained, so even if there was a bug in 3.6 that was fixed 
in 3.8 we aren't going to be able to do anything about it.

If nobody objects I will close this issue soon.

--
nosy: +iritkatriel
resolution:  -> out of date
status: open -> pending

___
Python tracker 

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



[issue35693] test_httpservers fails

2021-09-02 Thread Irit Katriel


Irit Katriel  added the comment:

Closing as 3.7 is no longer maintained and this problem was not reproduced in 
3.8.

--
nosy: +iritkatriel
resolution:  -> out of date
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



[issue44226] Threads shutting down in Py 2.7 but not in Py 3.69 while making SSH connection using Paramiko module

2021-09-02 Thread Irit Katriel


Irit Katriel  added the comment:

Closing again. In addition to what Eric said, both 2.7 and 3.6 are no longer 
maintained so you will need to reproduce the issue on a current version (>= 
3.8) for any of us to investigate it.

--
nosy: +iritkatriel
resolution: remind -> third party
status: open -> closed

___
Python tracker 

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



[issue37330] open(): remove 'U' mode, deprecated since Python 3.3

2021-09-02 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 19ba2122ac7313ac29207360cfa864a275b9489e by Victor Stinner in 
branch 'main':
bpo-37330: open() no longer accept 'U' in file mode (GH-28118)
https://github.com/python/cpython/commit/19ba2122ac7313ac29207360cfa864a275b9489e


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue45056] compiler: Unnecessary None in co_consts

2021-09-02 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 55c4a92fc1abfe388335071f1d64b3addfa5793f by Inada Naoki in branch 
'main':
bpo-45056: Remove trailing unused constants from co_consts (GH-28109)
https://github.com/python/cpython/commit/55c4a92fc1abfe388335071f1d64b3addfa5793f


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue39241] Popen of python3.6 hangs on os.read(errpipe_read, 50000)

2021-09-02 Thread Irit Katriel


Irit Katriel  added the comment:

I'm closing this because 

1. both 2.7 and 3.6 are no longer maintained
2. This is not an actual bug report (we don't know what the hanging code was 
doing) so there is no chance of reproducing it.

If you are having problems with this in a current version (>= 3.8) please 
create a new issue with a reproducible example of failing code.

If you need debugging assistance, python-list might be a more appropriate place 
than the bug tracker to ask for that.

--
nosy: +iritkatriel
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



[issue37330] open(): remove 'U' mode, deprecated since Python 3.3

2021-09-02 Thread STINNER Victor


STINNER Victor  added the comment:

Let's see how it goes. In the worst case, we have time before Python 3.11 final 
to revert it one more time.

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

___
Python tracker 

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



[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-02 Thread Ken Jin


Change by Ken Jin :


--
nosy: +kj, lukasz.langa, serhiy.storchaka

___
Python tracker 

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



[issue34561] Replace list sorting merge_collapse()?

2021-09-02 Thread Laurent Lyaudet


Laurent Lyaudet  added the comment:

Thanks for the patch Tim.
If I find a rival that stands against power sort, I'll tell you.

--

___
Python tracker 

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



[issue45083] Need to use the exception class qualname when rendering exception (in C code)

2021-09-02 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



[issue45067] Failed to build _curses on CentOS 7

2021-09-02 Thread Charalampos Stratakis


Charalampos Stratakis  added the comment:

You should use -lpaneltw instead of -lpanelw.

See also: https://bugs.python.org/issue41981

--
nosy: +cstratak

___
Python tracker 

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



[issue45019] Freezing modules has manual steps but could be automated.

2021-09-02 Thread Łukasz Langa

Change by Łukasz Langa :


--
nosy: +lukasz.langa
nosy_count: 3.0 -> 4.0
pull_requests: +26565
pull_request: https://github.com/python/cpython/pull/28125

___
Python tracker 

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



[issue45056] compiler: Unnecessary None in co_consts

2021-09-02 Thread Łukasz Langa

Change by Łukasz Langa :


--
pull_requests: +26564
pull_request: https://github.com/python/cpython/pull/28125

___
Python tracker 

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



[issue45086] f-string unmatched ']'

2021-09-02 Thread Greg Kuhn


New submission from Greg Kuhn :

Hi All, 
Is the below a bug? Shouldn't the interpreter be complaining about a curly 
brace?

$ python
Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> num = 10
>>> f'[{num]'
  File "", line 1
SyntaxError: f-string: unmatched ']'
>>>

--
messages: 400920
nosy: Greg Kuhn
priority: normal
severity: normal
status: open
title: f-string unmatched ']'
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



[issue43613] gzip.compress and gzip.decompress are sub-optimally implemented.

2021-09-02 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset ea23e7820f02840368569db8082bd0ca4d59b62a by Ruben Vorderman in 
branch 'main':
bpo-43613: Faster implementation of gzip.compress and gzip.decompress (GH-27941)
https://github.com/python/cpython/commit/ea23e7820f02840368569db8082bd0ca4d59b62a


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue43612] zlib.compress should have a wbits argument

2021-09-02 Thread Łukasz Langa

Łukasz Langa  added the comment:

Thanks for your contribution, Ruben! ✨ 🍰 ✨

--
nosy: +lukasz.langa
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



[issue43612] zlib.compress should have a wbits argument

2021-09-02 Thread Łukasz Langa

Change by Łukasz Langa :


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



[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2021-09-02 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset f0b63d5b56a6324f5f86807d9548c7b38aa2a8f7 by Łukasz Langa in 
branch 'main':
bpo-40360: [doc] Rephrase deprecation note about lib2to3 (GH-28122)
https://github.com/python/cpython/commit/f0b63d5b56a6324f5f86807d9548c7b38aa2a8f7


--
message_count: 45.0 -> 46.0
pull_requests: +26566
pull_request: https://github.com/python/cpython/pull/28127

___
Python tracker 

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



[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2021-09-02 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26566
pull_request: https://github.com/python/cpython/pull/28127

___
Python tracker 

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



[issue44748] argparse: a bool indicating if arg was encountered

2021-09-02 Thread wodny


Change by wodny :


--
nosy: +wodny85

___
Python tracker 

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



[issue45086] f-string unmatched ']'

2021-09-02 Thread Eric V. Smith


Eric V. Smith  added the comment:

I think the error is short for "I found a ']' without a matching '['".

--
nosy: +eric.smith

___
Python tracker 

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



[issue45024] Cannot extend collections ABCs with protocol

2021-09-02 Thread Ken Jin


Ken Jin  added the comment:

I suspect this may be intentional. See related issues 
https://bugs.python.org/issue35190 and https://bugs.python.org/issue23864.

Copying verbatim from what Ivan said in the first issue:

"
The separation may look arbitrary, but the idea is quite simple. Only those 
classes with few methods support structural checks. Those classes have few 
independent abstract methods (or even just one method), while in classes with 
large APIs like `Sequence`, the methods are not logically independent, so you 
can't say a class is 100% a `Sequence` even if types/signatures of all methods 
are correct, because e.g. `__contains__()` and `index()` should behave in 
agreement with `__getitem__()`.
"

--

___
Python tracker 

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



[issue45082] ctypes: Deprecate c_buffer() alias to create_string_buffer()

2021-09-02 Thread Łukasz Langa

Łukasz Langa  added the comment:

-0 I'm not sure it's worth the hassle to remove this. I'd just delete the silly 
comment that this is supposedly deprecated since at least 2006.

I still get 32,978 results looking at Github Search like this:

https://github.com/search?q=c_buffer+-filename%3Atest_stringptr.py+language%3APython+language%3APython&type=Code

Sure, there's some duplication there, it's not case-sensitive, and some of the 
c_buffer names might not even be ctypes. But the first few pages are all 
sensibly looking ctypes results.

--
nosy: +lukasz.langa

___
Python tracker 

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



[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2021-09-02 Thread miss-islington


miss-islington  added the comment:


New changeset 559af7434668e2950c08389515a52eba697ef6af by Miss Islington (bot) 
in branch '3.10':
bpo-40360: [doc] Rephrase deprecation note about lib2to3 (GH-28122)
https://github.com/python/cpython/commit/559af7434668e2950c08389515a52eba697ef6af


--

___
Python tracker 

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



[issue45082] ctypes: Deprecate c_buffer() alias to create_string_buffer()

2021-09-02 Thread STINNER Victor


STINNER Victor  added the comment:

> Since this alias is not a big maintenance burden, I think we can use 
> deprecation period longer than minimum 2 releases.

Ok. I modified my PR to only deprecate the alias without planning to remove it. 
Someone else can decide in at least 2 releases when it will be reasonable to 
remove the function.

--

___
Python tracker 

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



[issue23493] optimize sort_keys in json module by using operator.itemgetter()

2021-09-02 Thread Mickaël Schoentgen

Mickaël Schoentgen  added the comment:

I am wondering why the change was not backported to 3.6 and 3.7?
It introduces different behavior.

For instance, I need to keep duplicate keys from JSON data (because it is 
allowed by the RFC and it is a missing feature for tools such like HTTPie).

Have a look at repro-sorting.py.

On Python 3.6 and 3.7, the output is not sorted:

{
"dps": {
"1630064726": 5.0,
"1630064726": 3.0,
"1630064726": 6.0
}
}

Starting with Python 3.8, the output is sorted as expected:

{
"dps": {
"1630064726": 3.0,
"1630064726": 5.0,
"1630064726": 6.0
}
}

I could open pull requests for both 3.6 and 3.7 branches, if you think it is 
worth and allowed by the current maintenance status.

--
nosy: +Tiger-222
Added file: https://bugs.python.org/file50256/repro-sorting.py

___
Python tracker 

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



[issue39573] [C API] Make PyObject an opaque structure in the limited C API

2021-09-02 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +26567
pull_request: https://github.com/python/cpython/pull/28128

___
Python tracker 

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



[issue45086] f-string unmatched ']'

2021-09-02 Thread Greg Kuhn


Greg Kuhn  added the comment:

But doesn't the square bracket have no relevance here?
It's not within a curly bracketed string so shouldn't be treated specially.

I would have expected the error to be: SyntaxError: f-string: unmatched '}'.

Unless I need to go back and reread pep498...

--

___
Python tracker 

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



[issue45082] ctypes: Deprecate c_buffer() alias to create_string_buffer()

2021-09-02 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +26568
pull_request: https://github.com/python/cpython/pull/28129

___
Python tracker 

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



[issue45082] ctypes: Deprecate c_buffer() alias to create_string_buffer()

2021-09-02 Thread STINNER Victor


STINNER Victor  added the comment:

> -0 I'm not sure it's worth the hassle to remove this. I'd just delete the 
> silly comment that this is supposedly deprecated since at least 2006.

Ok, I created PR 28129 for that.

--

___
Python tracker 

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



[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2021-09-02 Thread STINNER Victor


STINNER Victor  added the comment:

I close the issue: lib2to3 is now deprecated in Python 3.11. I propose to open 
a new issue in Python 3.13 or newer to remove it.

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



[issue45079] 3.8.11 and 3.8.12 missing Windows artifacts, only tarballs - build system failed?

2021-09-02 Thread Steve Dower


Steve Dower  added the comment:

As the human "build bot" in question, yes, I do get tired :)

--

___
Python tracker 

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



[issue23493] optimize sort_keys in json module by using operator.itemgetter()

2021-09-02 Thread STINNER Victor


STINNER Victor  added the comment:

> I am wondering why the change was not backported to 3.6 and 3.7?

These branches no longer accept optimizations or bugfixes, only security fixes:
https://devguide.python.org/#status-of-python-branches

--

___
Python tracker 

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



[issue45055] Fresh build on Windows fails the first time for zlib.c

2021-09-02 Thread Steve Dower


Steve Dower  added the comment:

I use git worktree as well (it's great for backporting - I have all the release 
branches checked out all the time), but it likely means that you are regularly 
downloading and extracting these files.

So whatever app is keeping the file handle open is probably doing it reliably 
for one of the files, which is why you'll hit it each time. Once it's been 
copied into place, you won't see it again. And once we have the retry logic in 
the script then you won't see it the first time either.

This should be an easy project, though not trivial to test.

--
keywords: +easy

___
Python tracker 

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



[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-02 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 0635e201beaf52373f776ff32702795e38f43ae3 by Yurii Karabas in 
branch 'main':
bpo-45081: Fix __init__ method generation when inheriting from Protocol 
(GH-28121)
https://github.com/python/cpython/commit/0635e201beaf52373f776ff32702795e38f43ae3


--

___
Python tracker 

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



[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-02 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26570
pull_request: https://github.com/python/cpython/pull/28132

___
Python tracker 

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



[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-02 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 8.0 -> 9.0
pull_requests: +26569
pull_request: https://github.com/python/cpython/pull/28131

___
Python tracker 

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



[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2021-09-02 Thread Łukasz Langa

Łukasz Langa  added the comment:

The "pending" deprecation status of lib2to3 in 3.9 and 3.10 is no worse than a 
vanilla deprecation in terms of visibility. It will appear just the same when 
run with pytest or `-X dev`.

However, upgrading the deprecation between 3.10.0rc1 and 3.10.0rc2 really was 
too late. So we'll have it deprecated fully in 3.11 and removed in 3.13. One 
more year doesn't hurt us much but might be helpful for library maintainers to 
have more time to move off of the included lib2to3.

Invoking `2to3` also generates the warning so I guess this can be closed:

$ ./python.exe Tools/scripts/2to3
/private/tmp/cpy2/Tools/scripts/2to3:3: DeprecationWarning: lib2to3 package is 
deprecated and may not be able to parse Python 3.10+
  from lib2to3.main import main
At least one file or directory argument required.
Use --help to show usage.

Thanks for the patches, Gregory, Carl, and Victor! ✨ 🍰 ✨  

Now we just have to remember to actually remove the damn thing in 3.13 😂

--

___
Python tracker 

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



[issue45079] 3.8.11 and 3.8.12 missing Windows artifacts, only tarballs - build system failed?

2021-09-02 Thread Arcadiy Ivanov


Arcadiy Ivanov  added the comment:

Wow, the artifacts are built and posted by hand???

--

___
Python tracker 

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



[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-02 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 98eb40828af97760badfa7b8ff84bd4f7a079839 by Miss Islington (bot) 
in branch '3.9':
bpo-45081: Fix __init__ method generation when inheriting from Protocol 
(GH-28121) (GH-28132)
https://github.com/python/cpython/commit/98eb40828af97760badfa7b8ff84bd4f7a079839


--

___
Python tracker 

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



[issue45082] ctypes: Deprecate c_buffer() alias to create_string_buffer()

2021-09-02 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset a1e15a7a604e6f44cdaf4e106339df62eac5dc9f by Victor Stinner in 
branch 'main':
bpo-45082: Cleanup ctypes.c_buffer alias (GH-28129)
https://github.com/python/cpython/commit/a1e15a7a604e6f44cdaf4e106339df62eac5dc9f


--

___
Python tracker 

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



[issue45082] ctypes: Deprecate c_buffer() alias to create_string_buffer()

2021-09-02 Thread Łukasz Langa

Łukasz Langa  added the comment:

Thanks, Victor! ✨ 🍰 ✨

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



[issue45086] f-string unmatched ']'

2021-09-02 Thread Eric V. Smith


Eric V. Smith  added the comment:

I think it's basically this error:

>>> num]
  File "", line 1
num]
   ^
SyntaxError: unmatched ']'

Although I'd have to look at it more to see why that's the error it chose to 
display, instead of the curly brace.

--

___
Python tracker 

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



[issue45079] 3.8.11 and 3.8.12 missing Windows artifacts, only tarballs - build system failed?

2021-09-02 Thread Steve Dower


Steve Dower  added the comment:

The build for Windows is mostly automated, but it's triggered and monitored by 
hand. The build steps are all in the source repo, and the builds themselves are 
public at https://dev.azure.com/Python/cpython/_build?definitionId=21, but I'm 
the only core dev with access to the code signing certificate, so the only one 
who can trigger an official Windows release.

More importantly though is that we stop validating all the dependencies (e.g. 
OpenSSL) against security-fix only releases. These are optional dependencies 
from the POV of CPython, but required for a binary release. Maintaining support 
for them isn't free, so dropping the binary releases means we can focus on our 
active releases, rather than on regularly reintegrating other people's 
projects. Otherwise we'd have to do a new release every time 
OpenSSL/libffi/Tk/Tcl/Sqlite3/etc. fixed a security issue. *That's* the cost we 
avoid by not releasing binaries, even though the cost of the build itself is 
pretty low these days.

--

___
Python tracker 

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



[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-02 Thread Julian Fortune


Change by Julian Fortune :


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



[issue45079] 3.8.11 and 3.8.12 missing Windows artifacts, only tarballs - build system failed?

2021-09-02 Thread Arcadiy Ivanov


Arcadiy Ivanov  added the comment:

Seems like integrating third party dependencies would be covered by integration 
tests as part of the automation. But if they are not available I understand it 
would be expensive, yes.

--

___
Python tracker 

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



[issue45027] Allow basicConfig to configure any logger, not just root

2021-09-02 Thread Vinay Sajip


Vinay Sajip  added the comment:

Thanks, but ...

> I observe that many Python users tend to use basicConfig() even when they 
> would be better served by configuring only the logger(s) needed for their own 
> app/library.

First of all, library developers should not be configuring loggers at all, 
other than adding a NullHandler to their top-level logger.

Secondly, it is fine to configure the root logger and then log to any other 
logger. The default mechanisms mean that handlers added to the root logger are 
used by loggers which are anywhere in the logger hierarchy. So users that are 
using basicConfig() but other loggers than the root logger may be using the 
system as designed.

Thirdly, logging.config.dictConfig() allows usage of a dictionary to configure 
multiple loggers, handlers etc. all at once, for use cases which are more 
demanding than basicConfig(). It doesn't make sense to do what you're 
proposing, since it appears to offer a different way of configuring other 
loggers than the root logger, when dictConfig() already offers that.

So, I am minded to not agree to this change, and would prefer that the PR and 
this issue be closed.

--
nosy: +vinay.sajip

___
Python tracker 

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



[issue44489] _handle_existing_loggers should respect loggers that were manually disabled

2021-09-02 Thread Vinay Sajip


Vinay Sajip  added the comment:

Closing, as no further feedback received on this issue. You can reopen if you 
have an answer to my question.

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



[issue44689] ctypes.util.find_library() does not find macOS 11+ system libraries when built on older macOS systems

2021-09-02 Thread Gregory Szorc


Gregory Szorc  added the comment:

I cannot reproduce this on an 11.5 Intel MacBook Pro using an 11.5 SDK 
targeting x86_64 10.9.

However, I can reproduce on a similarly configured M1 using the same OS and SDK 
but cross-compiling to single arch x86_64.

The issue here may reside in how configure handles cross-compiling for Apple. 
The current logic in configure is a bit opinionated about how things should 
work and this patch may have tickled things into not working.

My opinion is that configure should support various cross-compiling scenarios 
like this (including building non-fat x86_64 only binaries from an arm64 
machine). However, it is clear from the implementation and comments in this 
issue and elsewhere that the CPython core devs want to limit which exact 
cross-compiling configurations are supported on Apple.

If the core developers say various cross-compiling scenarios aren't supported 
build configuration any more, I'll accept that and work around the limitation 
on my end. However, do note there is a significant possibility that Apple stops 
selling Intel machines for various product models in a few weeks. I suspect 
various people will want to continue their practice of building x86_64 only 
binaries for the indefinite future. Regardless of when the ARM only transition 
occurs, arbitrary restrictions like not supporting Apple arm64 -> x86_64 
cross-compiling will disappoint a growing cohort of users over time. I would 
encourage investing in less opinionated configure logic to support Apple 
cross-compiling. I could potentially contribute patches in this area, since 
I've already taught python-build-standalone to cross-compile more robustly 
(including to targets like iOS).

--

___
Python tracker 

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



[issue45087] Confusing error message when trying split bytes.

2021-09-02 Thread Alex Zaslavskis


New submission from Alex Zaslavskis :

If we will try to split bytes we will got quite strange error in console. 

Traceback (most recent call last):
  File "C:/Users/ProAdmin/Desktop/bug_in_python.py", line 6, in 
byte_message.split(",")
TypeError: a bytes-like object is required, not 'str'

The problem here is that object should be string and in if I convert it to 
string the error is going. So that mean that there are error in mistake . 
Correct variant should be :
Traceback (most recent call last):
  File "C:/Users/ProAdmin/Desktop/bug_in_python.py", line 6, in 
byte_message.split(",")
TypeError:  str is required, not a bytes-like object


message = 'Python is fun'
byte_message = bytes(message, 'utf-8')
print(byte_message)
#byte_message.split(",") causes error
str(byte_message).split(",") # works

--
components: Argument Clinic
files: bug_in_python.py
messages: 400948
nosy: larry, sahsariga111
priority: normal
severity: normal
status: open
title: Confusing error message when trying split bytes.
type: compile error
versions: Python 3.9
Added file: https://bugs.python.org/file50257/bug_in_python.py

___
Python tracker 

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



[issue45087] Confusing error message when trying split bytes.

2021-09-02 Thread Alex Zaslavskis


Change by Alex Zaslavskis :


--
type: compile error -> behavior

___
Python tracker 

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



[issue45087] Confusing error message when trying split bytes.

2021-09-02 Thread Alex Zaslavskis


Change by Alex Zaslavskis :


Added file: https://bugs.python.org/file50258/bug_in_python.py

___
Python tracker 

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



[issue45087] Confusing error message when trying split bytes.

2021-09-02 Thread Alex Zaslavskis


Change by Alex Zaslavskis :


Removed file: https://bugs.python.org/file50257/bug_in_python.py

___
Python tracker 

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



[issue44689] ctypes.util.find_library() does not find macOS 11+ system libraries when built on older macOS systems

2021-09-02 Thread Ned Deily


Ned Deily  added the comment:

Thanks for the updates!

>If the core developers say various cross-compiling scenarios aren't supported 
>build configuration any more, I'll accept that and work around the limitation 
>on my end. However, do note there is a significant possibility that Apple 
>stops selling Intel machines for various product models in a few weeks. I 
>suspect various people will want to continue their practice of building x86_64 
>only binaries for the indefinite future.

I think you make very good points. I also think that we all agree that we do 
need to work towards better supporting the coming primarily non-Intel Mac 
world. I would rather put it that there are cross-compiling scenarios that were 
never supported before (but also not necessarily fully documented as such) but 
may have worked coincidentally some of the time; moving forward, we need to 
identify the important scenarios and make sure we fully support them. We're not 
there yet but I have some ideas on how to do that which I will try to get 
written down soon.

--

___
Python tracker 

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



[issue45087] Confusing error message when trying split bytes.

2021-09-02 Thread Eric V. Smith


Eric V. Smith  added the comment:

This is working as designed. The error is telling you that the argument to 
bytes.split() must be a string:

>>> b''.split(',')
Traceback (most recent call last):
  File "", line 1, in 
TypeError: a bytes-like object is required, not 'str'

>>> b''.split(b',')
[b'']

Same for str.split():

>>> ''.split(b',')
Traceback (most recent call last):
  File "", line 1, in 
TypeError: must be str or None, not bytes

>>> ''.split(',')
['']

--
components:  -Argument Clinic
nosy: +eric.smith -larry

___
Python tracker 

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



[issue45088] Coroutines & async generators disagree on the iteration protocol semantics

2021-09-02 Thread Yury Selivanov


New submission from Yury Selivanov :

See this script:

  https://gist.github.com/1st1/eccc32991dc2798f3fa0b4050ae2461d

Somehow an identity async function alters the behavior of manual iteration 
though the wrapped nested generator.

This is a very subtle bug and I'm not even sure if this is a bug or not. 
Opening the issue so that I don't forget about this and debug sometime later.

--
components: Interpreter Core
messages: 400951
nosy: lukasz.langa, pablogsal, yselivanov
priority: normal
severity: normal
stage: needs patch
status: open
title: Coroutines & async generators disagree on the iteration protocol 
semantics
type: behavior
versions: Python 3.10, Python 3.11

___
Python tracker 

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



[issue26375] Python 2.7.10 and 3.4.4 hang on imaplib.IMAP4_SSL()

2021-09-02 Thread Irit Katriel


Irit Katriel  added the comment:

Michal, is still issue still relevant?

The url you mention no longer exists so I can't see if it's still reproducible:


% nslookup imap.home.pl
Server: 192.168.1.254
Address:192.168.1.254#53

** server can't find imap.home.pl: NXDOMAIN

--
nosy: +iritkatriel
status: open -> pending

___
Python tracker 

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



[issue45024] Cannot extend collections ABCs with protocol

2021-09-02 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The docs need to clarify which ABCs can satisfy isinstance() based solely on 
hasattr() logic and which ABCs require registration or direct subclassing.

The docs should also explain why the more complex ABCs can't reliably be 
recognized based on the presence of desired method names.  

One of the original motivating reasons for the ABCs was that the presence of 
__getitem__ was insufficient for determining whether a class was intended to be 
a Mapping or a Sequence.  Accordingly, those classes have to subclass from an 
ABC or register with the ABC in order to declare intent.

--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python, rhettinger

___
Python tracker 

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



[issue37694] Crash when calling zipimport.zipimporter.__new__().()

2021-09-02 Thread Irit Katriel


Irit Katriel  added the comment:

Closing as 2.7 and 3.6 are no longer maintained, and you say the crash was gone 
in 3.7+. 


On 3.11 it indeed doesn't crash:

>>> zipimport.zipimporter.__new__(zipimport.zipimporter).find_module('')
:158: DeprecationWarning: zipimporter.find_module() is 
deprecated and slated for removal in Python 3.12; use find_spec() instead
:122: DeprecationWarning: zipimporter.find_loader() is 
deprecated and slated for removal in Python 3.12; use find_spec() instead
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 161, in find_module
  File "", line 125, in find_loader
  File "", line 372, in _get_module_info
  File "", line 359, in _get_module_path
AttributeError: 'zipimporter' object has no attribute 'prefix'

--
nosy: +iritkatriel
resolution:  -> out of date
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



[issue45089] [sqlite3] the trace callback does not raise exceptions on error

2021-09-02 Thread Erlend E. Aasland

New submission from Erlend E. Aasland :

Currently, two calls can raise exceptions in the _trace_callback() in 
Modules/_sqlite/connection.c:

  1. PyUnicode_DecodeUTF8() can raise an exception
  2. PyObject_CallOneArg() — calling the user callback — can raise an exception

Currently, we either PyErr_Print() the traceback, or we PyErr_Clear() it. In 
either case; we clear the current exception. The other SQLite callbacks pass 
some kind of return value back to SQLite to indicate failure (which is normally 
then passed to _pysqlite_seterror() via sqlite3_step() or sqlite3_finalize(), 
but the trace callback does not pass errors back to SQLite; we're unable to 
detect if the trace callback fails.

--
components: Extension Modules
files: reproducer.py
messages: 400955
nosy: erlendaasland
priority: normal
severity: normal
status: open
title: [sqlite3] the trace callback does not raise exceptions on error
versions: Python 3.11
Added file: https://bugs.python.org/file50259/reproducer.py

___
Python tracker 

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



[issue44091] traceback & inspect modules should verify that the .py source file matches the one that the running process is using

2021-09-02 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

FWIW I don't remember the context that led me to just file the issue this year. 
 The most serious frequent instances of this I remember happening were all many 
years ago when a less capable software distribution mechanism was in use.

A scenario where I would imagine it today aside from things like what Irit 
mentioned with the developer workflow:

People using an OS distro's Python interpreter (and even OS distro supplied 
Python packages instead of pip in a virtualenv) in order to run their own 
potentially long running code.

The OS distro does not know about their running processes as they haven't 
created OS packages with startup/restart/shutdown and dependency relationships 
expressed.  So the OS updating Python packages does not trigger a restart of 
their software after updating a dependency out from underneath it.

I know this happens, but I don't know how often it actually bites anyone.  And 
there are workarounds if deemed serious (tie in with the OS package management).

I personally wouldn't prioritize work on this issue unless it fits in naturally 
with other work going on to plumb the information through.  Or without an 
ability to demonstrate a compelling frequently encountered user-confusion 
scenario.  It's a "nice to have" more than a "need".

--

___
Python tracker 

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



[issue44748] argparse: a bool indicating if arg was encountered

2021-09-02 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> With a config file loaded as part of the program, 
> overwrite the values loaded from the config file 
> if the argument was encountered in the argument vector.

It seems to me that default values can already be used for this purpose:

from argparse import ArgumentParser

config = {'w': 5, 'x': 10, 'y': False, 'z': True}

missing = object()
p = ArgumentParser()
p.add_argument('-x', type=int, default=missing)
p.add_argument('-y', action='store_true', default=missing)
ns = p.parse_args()

# update config for specified values
for parameter, value in vars(ns).items():
if value is not missing:
config[parameter] = value

print(config)

--

___
Python tracker 

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



[issue44748] argparse: a bool indicating if arg was encountered

2021-09-02 Thread Thermi


Thermi  added the comment:

Raymond, then you can't show the defaults in the help message.

--

___
Python tracker 

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



[issue23864] doc: issubclass without registration only works for "one-trick pony" collections ABCs.

2021-09-02 Thread Guido van Rossum


Guido van Rossum  added the comment:

Maybe issue45024 is also connected? (It also seems to relate to hasattr() 
logic.)

--

___
Python tracker 

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



[issue45089] [sqlite3] the trace callback does not raise exceptions on error

2021-09-02 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

___
Python tracker 

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



[issue45087] Confusing error message when trying split bytes.

2021-09-02 Thread Alex Zaslavskis


Alex Zaslavskis  added the comment:

I am not really sure that it is working as it should be. Even with your example 
it gives : 
TypeError: a bytes-like object is required, not 'str'
The problem is why error message says that  bytes-like is  required , when the 
string is required.

--

___
Python tracker 

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



[issue45087] Confusing error message when trying split bytes.

2021-09-02 Thread Alex Zaslavskis


Alex Zaslavskis  added the comment:

''.split(',') # works as it should be 
b''.split(',') # gives strange error message.

TypeError: a bytes-like object is required, not 'str'

The problem here is that message is saying that for fix error you should use 
bytes-like object that not a true. In reality the string or None is required .

--

___
Python tracker 

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



[issue45087] Confusing error message when trying split bytes.

2021-09-02 Thread Alex Zaslavskis


Alex Zaslavskis  added the comment:

Moreover according Python docs : This exception may be raised by user code to 
indicate that an attempted operation on an object is not supported. But also 
the Python interpreter gives that  a bytes-like object is required, not 'str' 
that I am already passing , so it says that all fine. But the question is why 
then TypeError happens .

--

___
Python tracker 

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



[issue45087] Confusing error message when trying split bytes.

2021-09-02 Thread Eric V. Smith


Eric V. Smith  added the comment:

You said: 
"""
b''.split(',') # gives strange error message.

TypeError: a bytes-like object is required, not 'str'
"""

It is not a strange error message. You passed in a str (the ','), and you 
should have passed in bytes.

--

___
Python tracker 

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



[issue45087] Confusing error message when trying split bytes.

2021-09-02 Thread Alex Zaslavskis


Alex Zaslavskis  added the comment:

Thanks that really works. 
So as I understand that b''.split() != ''.split()

--
resolution:  -> not a bug

___
Python tracker 

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



[issue45087] Confusing error message when trying split bytes.

2021-09-02 Thread Alex Zaslavskis


Alex Zaslavskis  added the comment:

What about adding alert message for beginners that can stuck with that in docs? 
To warn others , is that good idea you think. Or it is redundant ?

--

___
Python tracker 

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



[issue45090] Add pairwise to What's New in Python 3.10; mark it as new in itertools docs

2021-09-02 Thread Luciano Ramalho


New submission from Luciano Ramalho :

Thanks for adding `itertools.pairwise()`!

Let's make it easier to find by mentioning it in "What's New in Python 3.10" 
and also marking it as "New in Python 3.10" in the `itertools` module 
documentation.

--
assignee: docs@python
components: Documentation
messages: 400966
nosy: docs@python, ramalho
priority: normal
severity: normal
status: open
title: Add pairwise to What's New in Python 3.10; mark it as new in itertools 
docs
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



[issue44188] ThreadPoolExecutor unbalanced semaphore count

2021-09-02 Thread Tin Tvrtković

Tin Tvrtković  added the comment:

I was trying to instrument one of our executors to expose some metrics, so I 
tried using the value of the semaphore as the number of idle threads and I 
noticed it was way too large. If this was fixed getting these metrics would be 
easier.

--
nosy: +tinchester

___
Python tracker 

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



[issue44748] argparse: a bool indicating if arg was encountered

2021-09-02 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> then you can't show the defaults in the help message.

1) The --help option doesn't normally show defaults.

2) Why would you show defaults in help, if you're going to ignore them in favor 
the values in config whenever they aren't specified.  If ignored or overridden, 
they aren't actually default values.

3) Why not dynamically configure the argparse default values with data from 
config?

config = {'w': 5, 'x': 10, 'y': False, 'z': True}

p = ArgumentParser()
p.add_argument('-x', type=int, default=config['x'])
p.add_argument('-y', action='store_true', default=config['y'])
ns = p.parse_args(['-h'])

--

___
Python tracker 

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



[issue44748] argparse: a bool indicating if arg was encountered

2021-09-02 Thread Thermi


Thermi  added the comment:

1) True. That'd mean such functionality would not be usable by such a 
workaround though.

2) ANY setting has a default value. The output in the --help message has to, if 
any defaults at all are shown, be the same as the actual default values. 
Storing the default values as part of the argparse.ArgumentParser configuration 
prevents duplication of the default value declaration in the config file 
reader, and the argument parser.

What I request is the reverse of what you wrote. I want the order of priority 
to fall back to the defaults, if no value is specified in the config file. And 
if an argument is passed via argv, then that value should take precedence over 
what is set in the config file. This is in the first message in this issue.

3) Two different places to touch when you want to add a new option:
1) Default config declared in program code
2) argparse.ArgumentParser configuration in code.

--

___
Python tracker 

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



[issue31528] Let ConfigParser parse systemd units

2021-09-02 Thread Cooper Lees


Change by Cooper Lees :


--
nosy: +cooperlees

___
Python tracker 

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



[issue45087] Confusing error message when trying split bytes.

2021-09-02 Thread Eric V. Smith


Eric V. Smith  added the comment:

I (and many others) think the error message is fine the way it is. Also, it's 
hard for the error to be more specific about the method it's being called on. 
But if you have some concrete suggestions that can be implemented, you can add 
them to this issue.

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



[issue44980] Clean up tests that return a value that isn't None

2021-09-02 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
nosy: +kj
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> enhancement

___
Python tracker 

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



[issue44748] argparse: a bool indicating if arg was encountered

2021-09-02 Thread paul j3


paul j3  added the comment:

Another way to play with the defaults is to use argparse.SUPPRESS.  With such a 
default, the argument does not appear in the namespace, unless provided by the 
user.

In [2]: p = argparse.ArgumentParser()
   ...: p.add_argument('--foo', default=argparse.SUPPRESS, help='foo help')
   ...: p.add_argument('--bar', default='default')
   ...: p.add_argument('--baz');
In [3]: args = p.parse_args([])
In [4]: args
Out[4]: Namespace(bar='default', baz=None)

Such a namespace can be used to update an existing dict (such as from a config 
file), changing only keys provided by user (and ones where SUPPRESS does not 
make sense, such as store_true and positionals).

In [5]: adict = {'foo':'xxx', 'bar':'yyy', 'baz':'zzz'}
In [6]: adict.update(vars(args))
In [7]: adict
Out[7]: {'foo': 'xxx', 'bar': 'default', 'baz': None}

User provided value:

In [8]: args = p.parse_args(['--foo','foo','--baz','baz'])
In [9]: args
Out[9]: Namespace(bar='default', baz='baz', foo='foo')

In this code sample I used Ipython.  That IDE uses (or at least did some years 
ago) a custom integration of config and argparse.  System default config 
file(s) set a large number of parameters.  Users are encouraged to write their 
own profile configs (using provided templates).  On starting a session, the 
config is loaded, and used to populate a parser, with arguments, helps and 
defaults.  Thus values are set or reset upto 3 times - default, profile and 
commandline.

I for example, usually start an ipython session with an alias

alias inumpy3='ipython3 --pylab qt --nosep --term-title 
--InteractiveShellApp.pylab_import_all=False 
--TerminalInteractiveShell.xmode=Plain'

Regarding this bug/issue, if someone can come up with a clever tweak that 
satisfies Thermi, is potentially useful to others, and is clearly backward 
compatible, great.  

But if this issue requires a less-than-ideal-compatible patch, or greater 
integration of config and argparse, then it needs to be developed as a separate 
project and tested on PyPi. Also search PyPi; someone may have already done the 
work.

--

___
Python tracker 

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



[issue44986] Date formats in help messages of argparse

2021-09-02 Thread paul j3


Change by paul j3 :


--
nosy: +paul.j3

___
Python tracker 

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



[issue44587] argparse BooleanOptionalAction displays default=SUPPRESS unlike other action types

2021-09-02 Thread paul j3


Change by paul j3 :


--
nosy: +paul.j3

___
Python tracker 

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



[issue45091] inspect.Parameter.__str__ does not include subscripted types in annotations

2021-09-02 Thread Antonio Caceres


New submission from Antonio Caceres :

The __str__ method of the inspect.Parameter class in the standard library's 
inspect module does not include subscripted types in annotations.

For example, consider the function foo(a: list[int]).
When I run str(inspect.signature(foo)), I would expect the returned string to 
be '(a: list[int])', but instead the string is '(a: list)'.

(I have tested this on Python 3.9.7, but the code I believe is the problem is 
on the branches for versions 3.9-3.11.) 

>From a first glance at the source code, the problem is in the 
>inspect.formatannotation function. If the annotation is a type, the 
>formatannotation uses the __qualname__ attribute of the annotation instead of 
>its __repr__ attribute. Indeed, list[int].__qualname__ == 'list' and 
>repr(list[int]) == 'list[int]'. This problem was probably code that should 
>have been changed, but never was, after PEP 585.

The only workarounds I have found is to implement an alternative string method 
that accepts inspect.Signature or subclass inspect.Parameter and override the 
__str__ method.

--
components: Library (Lib)
messages: 400972
nosy: antonio-caceres
priority: normal
severity: normal
status: open
title: inspect.Parameter.__str__ does not include subscripted types in 
annotations
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue44748] argparse: a bool indicating if arg was encountered

2021-09-02 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> I want the order of priority to fall back to the defaults,
> if no value is specified in the config file. And if an argument
> is passed via argv, then that value should take precedence 
> over what is set in the config file.

from collections import ChainMap
from argparse import ArgumentParser

parser = ArgumentParser()
missing = object()
for arg in 'abcde':
parser.add_argument(f'-{arg}', default=missing)
system_defaults = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5}
config_file = {'a': 6, 'c': 7, 'e': 8}
command_line = vars(parser.parse_args('-a 8 -b 9'.split()))
command_line = {k: v for k, v in command_line.items() if v is not missing}
combined = ChainMap(command_line, config_file, system_defaults)
print(dict(combined))

> This is in the first message in this issue.

The feature request is clear.  What problem you're trying to solve isn't clear. 
 What you're looking for is likely some permutation of the above code or 
setting a argument default to a value in the ChainMap.  I think you're ignoring 
that we already have ways to set default values to anything that is needed and 
we already have ways to tell is an argument was not encountered (but not both 
at the same time).

[Paul J3]
> So unless someone comes up with a really clever idea, 
> this is bigger request than it first impressions suggest.

I recommend rejecting this feature request.  The module is not obliged to be 
all things to all people.  Most variations of the problem already have a 
solution.  We should leave it at that.  Extending the namespace with extra 
boolean arguments would just open a can of worms that would make most users 
worse off, likely breaking any code that expects the namespace to contain 
exactly what it already contains.

--

___
Python tracker 

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



[issue45088] Coroutines & async generators disagree on the iteration protocol semantics

2021-09-02 Thread Yury Selivanov


Change by Yury Selivanov :


--
nosy: +gvanrossum

___
Python tracker 

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



  1   2   >