[issue39394] re: DeprecationWarning for `flag not at the start of expression` is cutoff too early

2022-03-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue47066] Convert a warning about flags not at the start of the regular expression into error

2022-03-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 92a6abf72e7a8274f96edbb5297119d4ff055be7 by Serhiy Storchaka in 
branch 'main':
bpo-47066: Convert a warning about flags not at the start of the regular 
expression into error (GH-31994)
https://github.com/python/cpython/commit/92a6abf72e7a8274f96edbb5297119d4ff055be7


--

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



[issue47066] Convert a warning about flags not at the start of the regular expression into error

2022-03-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue39394] re: DeprecationWarning for `flag not at the start of expression` is cutoff too early

2022-03-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 4142961b9f5ad3bf93976a6a7162f8049e354018 by Serhiy Storchaka in 
branch 'main':
bpo-39394: Improve warning message in the re module (GH-31988)
https://github.com/python/cpython/commit/4142961b9f5ad3bf93976a6a7162f8049e354018


--

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



[issue47066] Convert a warning about flags not at the start of the regular expression into error

2022-03-19 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

This warning was introduced in 3.6. The reason is that in most other regular 
expression implementations global inline flags in the middle of the expression 
have different semantic: they affect only the part of the expression after the 
flag. But in Python they affect the whole expression. It caused confusion and 
was a source of bugs.

After 5 releases it is a time to convert this warning into error. In future we 
can allow global inline flags in the middle of the expression with different 
semantic. It is safer if one or more intermediate versions will raise an error.

--
components: Library (Lib), Regular Expressions
messages: 415544
nosy: ezio.melotti, mrabarnett, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Convert a warning about flags not at the start of the regular expression 
into error
type: behavior
versions: Python 3.11

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



[issue39394] re: DeprecationWarning for `flag not at the start of expression` is cutoff too early

2022-03-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This warning was introduced in 3.6. It is a time to convert it into an error. 
RE error messages contain position.

But I understand that very few users will use 3.11 in nearest future, so I am 
going to add a position to warning message and backport this change. It is not 
a bugfix in strong meaning, but I think it is safe to backport it.

--
versions: +Python 3.10, Python 3.11 -Python 3.7, Python 3.8

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



[issue39394] re: DeprecationWarning for `flag not at the start of expression` is cutoff too early

2022-03-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46410] TypeError when parsing regexp with unicode named character sequence escape

2022-03-19 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

>>> import unicodedata
>>> unicodedata.lookup('KEYCAP NUMBER SIGN')
'#️'
>>> print(ascii(unicodedata.lookup('KEYCAP NUMBER SIGN')))
'#\ufe0f\u20e3'

Support of Unicode Named Character Sequences in the unicodeescape codec and in 
the RE parser would be a new feature.

--
components: +Interpreter Core, Unicode
nosy: +serhiy.storchaka, vstinner
type: behavior -> enhancement
versions: +Python 3.11 -Python 3.10

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



[issue433030] SRE: Atomic Grouping (?>...) is not supported

2022-03-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +mrabarnett
priority: low -> normal

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



[issue47031] math.nan should note that NANs do not compare equal to anything

2022-03-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

We cannot guarantee that NAN never equal to anything, because we can create an 
object equal to it. For example mock.ANY.

--
nosy: +serhiy.storchaka

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



[issue433030] SRE: Atomic Grouping (?>...) is not supported

2022-03-18 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +30072
pull_request: https://github.com/python/cpython/pull/31982

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



[issue40296] help(list[int]) fails

2022-03-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset a5b7678a67ac99edd50822827b772e7d9afc8e64 by Serhiy Storchaka in 
branch '3.10':
[3.10] bpo-40296: Fix supporting generic aliases in pydoc (GH-30253). (GH-31976)
https://github.com/python/cpython/commit/a5b7678a67ac99edd50822827b772e7d9afc8e64


--

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



[issue44405] add program passed as string to dis module.

2022-03-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Neither of tokenize, ast or symtable modules support passing the source string 
as argument. If add this feature in the dis module, we will need to add it in 
all other modules with similar CLI. I do not think it is practical. You always 
can pass the source string via stdin. And you do not even need to pass 
/dev/stdin as argument, stdin is the default.

I usually use it with rlwrap. It allows to use some editing and history.

rlwrap ./python -m dis

I propose to close this issue and open a new issue for documenting the CLI of 
the dis module.

--

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



[issue14156] argparse.FileType for '-' doesn't work for a mode of 'rb'

2022-03-18 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue14156] argparse.FileType for '-' doesn't work for a mode of 'rb'

2022-03-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 4d2099f455229b10f88846dbe9fe6debbee55356 by Serhiy Storchaka in 
branch '3.9':
[3.9] bpo-14156: Make argparse.FileType work correctly for binary file modes 
when argument is '-' (GH-13165) (GH-31979)
https://github.com/python/cpython/commit/4d2099f455229b10f88846dbe9fe6debbee55356


--

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



[issue14156] argparse.FileType for '-' doesn't work for a mode of 'rb'

2022-03-18 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +30069
pull_request: https://github.com/python/cpython/pull/31979

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



[issue40296] help(list[int]) fails

2022-03-18 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +30066
pull_request: https://github.com/python/cpython/pull/31976

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



[issue47042] Fix test_html_doc in test_pydoc

2022-03-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is 3.11 only issue.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions:  -Python 3.10, Python 3.9

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



[issue40296] help(list[int]) fails

2022-03-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset cd44afc573e2e2de8d7e5a9119c347373066cd10 by Serhiy Storchaka in 
branch 'main':
bpo-40296: Fix supporting generic aliases in pydoc (GH-30253)
https://github.com/python/cpython/commit/cd44afc573e2e2de8d7e5a9119c347373066cd10


--

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



[issue46996] Drop support of Tcl/Tk older than 8.5.12

2022-03-17 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
status: closed -> open

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



[issue47042] Fix test_html_doc in test_pydoc

2022-03-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset a5d246066b5352a7d72e70ec0acb643e7c0861fa by Serhiy Storchaka in 
branch 'main':
bpo-47042: Fix testing the HTML output in test_pydoc (GH-31959)
https://github.com/python/cpython/commit/a5d246066b5352a7d72e70ec0acb643e7c0861fa


--

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



[issue46996] Drop support of Tcl/Tk older than 8.5.12

2022-03-17 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +30051
pull_request: https://github.com/python/cpython/pull/31962

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



[issue46996] Drop support of Tcl/Tk older than 8.5.12

2022-03-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

After PR 31839 has been merged you cannot build the _tkinter module with Tcl/Tk 
older than 8.5.12. If you will still try to run IDLE on such incomplete build, 
an import error during importing tkinter will be translated to IDLE error:

$ ./python -m idlelib
** IDLE can't import Tkinter.
Your Python may not be configured for Tk. **

IDLE might someday require 8.6 if it start using some 8.6 features 
non-optionally.

--

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



[issue46382] dataclass(slots=True) does not account for slots in base classes

2022-03-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Sorry, the previous message was written via a phone because of blackout, so the 
formatting is a tine bit messy.

__slotnames__ is set in copyreg._slotnames(). If you want to keep a list of all 
slots you should save it in __slotnames__, either using copyreg._slotnames() 
directly or by duplicating its code.

But as for the original issue, I do not think that the current behavior is 
incorrect. At least it is consistent with the behavior of regular classes.

--

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



[issue46382] dataclass(slots=True) does not account for slots in base classes

2022-03-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

>
> It is not set automatically. It is set in object.__reduce__ by calling
> some helper function from the copyreg module.

--

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



[issue46382] dataclass(slots=True) does not account for slots in base classes

2022-03-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

__slotnames__ is used for storing all slot names.

New object.__getstate__() proposed in issue26579 may have some relation to this 
discussion.

--
nosy: +serhiy.storchaka

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



[issue46996] Drop support of Tcl/Tk older than 8.5.12

2022-03-17 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46996] Drop support of Tcl/Tk older than 8.5.12

2022-03-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset c2e3c06139e9468efb32629d147d99a1672d9e19 by Serhiy Storchaka in 
branch 'main':
bpo-46996: Remove support of Tcl/Tk < 8.5.12 (GH-31839)
https://github.com/python/cpython/commit/c2e3c06139e9468efb32629d147d99a1672d9e19


--

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



[issue40296] help(list[int]) fails

2022-03-17 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
dependencies: +Fix test_html_doc in test_pydoc

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



[issue47042] Fix test_html_doc in test_pydoc

2022-03-17 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue47042] Fix test_html_doc in test_pydoc

2022-03-17 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

Due to missed splitlines() in test_pydoc the HTML output was not tested 
correctly. Instead of testing that the actual output contains every *line* from 
the expected output it tested that the actual output contains every *character* 
from the expected output. The test would pass with any actual output which 
contains all Latin letters and some punctuation.

The following PR fixes this bug and makes the test even more strict. Now it 
tests that the actual output contains the same lines as the expected output, in 
the same order, ignoring indentation and empty lines.

--
components: Tests
messages: 415396
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Fix test_html_doc in test_pydoc
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

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



[issue46996] Drop support of Tcl/Tk older than 8.5.12

2022-03-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

8.5.12 will be 10 years old at the time of releasing 3.11.

We can relax the requirements for 8.5.x, so the code can be build with older 
versions, but some tests will fail because we removed workarounds for 
differences in behavior in older versions from tests.

The LTS distributions can also provide their own patches which relax the 
requirements.

--

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



[issue46981] Empty typing.Tuple

2022-03-17 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46981] Empty typing.Tuple

2022-03-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 15df8f8d89a0e563bdd15e4cd6734298736a5a1d by Serhiy Storchaka in 
branch 'main':
bpo-46981: Remove typing._TypingEmpty (GH-31836)
https://github.com/python/cpython/commit/15df8f8d89a0e563bdd15e4cd6734298736a5a1d


--

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



[issue45979] Fix Tkinter tests with old Tk

2022-03-16 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset dbbe4d2d0075fa0e95b069fb4780d79aae3514c7 by Serhiy Storchaka in 
branch 'main':
bpo-45979: Fix Tkinter tests with old Tk (>= 8.5.12) (GH-31938)
https://github.com/python/cpython/commit/dbbe4d2d0075fa0e95b069fb4780d79aae3514c7


--

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



[issue30080] Add the --duplicate option for timeit

2022-03-16 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

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



[issue45979] Fix Tkinter tests with old Tk

2022-03-16 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +30029
pull_request: https://github.com/python/cpython/pull/31938

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



[issue45979] Fix Tkinter tests with old Tk

2022-03-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is a great idea. I have opened issue46996 for this.

--

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



[issue46996] Drop support of Tcl/Tk older than 8.5.12

2022-03-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
components: +Tkinter
nosy: +christian.heimes, epaine, erlendaasland

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



[issue37907] speed-up PyLong_As*() for large longs

2022-03-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +mark.dickinson

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



[issue46996] Drop support of Tcl/Tk older than 8.5.12

2022-03-12 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46996] Drop support of Tcl/Tk older than 8.5.12

2022-03-12 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

In issue45979 E. Paine suggested to drop support of Tcl/Tk older than 8.5.12 
(8.5.12 was released on 2012-07-27 and 8.6.0 on 2012-12-20). Tkinter tests 
contain workarounds and special cases for older versions of Tcl/Tk, many of 
them can be removed. Also some Python and C code of tkinter can be simplified.

--
components: Library (Lib), Tests
messages: 414999
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Drop support of Tcl/Tk older than 8.5.12
type: enhancement
versions: Python 3.11

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



[issue44796] Add __parameters__ and __getitem__ in TypeVar and ParamSpec

2022-03-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

PR 31143 simplified some code without changing the common API:

 Objects/genericaliasobject.c | 46 
++
 1 file changed, 14 insertions(+), 32 deletions(-)
 Lib/_collections_abc.py | 63 
+--
 1 file changed, 9 insertions(+), 54 deletions(-)

PR 27511 will simplify it even more:

 Objects/genericaliasobject.c | 60 
++--
 1 file changed, 18 insertions(+), 42 deletions(-)

(Lib/typing.py will be simplified too, even if this does not reduce the number 
of lines).

--

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



[issue46981] Empty typing.Tuple

2022-03-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

If for repr(Tuple[()]), it is no longer needed.

--

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



[issue46981] Empty typing.Tuple

2022-03-12 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue43224] Add support for PEP 646

2022-03-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +29925
pull_request: https://github.com/python/cpython/pull/31828

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



[issue43224] Add support for PEP 646

2022-03-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 5b1b9eacb92dd47d10793a8868246df6ea477ed6 by Serhiy Storchaka in 
branch 'main':
bpo-43224: Implement substitution of unpacked TypeVarTuple (GH-31800)
https://github.com/python/cpython/commit/5b1b9eacb92dd47d10793a8868246df6ea477ed6


--

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



[issue46581] _typevar_types and _paramspec_tvars are missing from _GenericAlias.copy_with

2022-03-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46581] _typevar_types and _paramspec_tvars are missing from _GenericAlias.copy_with

2022-03-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 3bc801960655ea265599805eac24173164b511a6 by Matt Bogosian in 
branch '3.10':
[3.10] bpo-46581: Propagate private vars via _GenericAlias.copy_with (GH-31061) 
(GH-31821)
https://github.com/python/cpython/commit/3bc801960655ea265599805eac24173164b511a6


--

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



[issue44796] Add __parameters__ and __getitem__ in TypeVar and ParamSpec

2022-03-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset b6a5d8590c4bfe4553d796b36af03bda8c0d5af5 by Serhiy Storchaka in 
branch 'main':
bpo-44796: Unify TypeVar and ParamSpec substitution (GH-31143)
https://github.com/python/cpython/commit/b6a5d8590c4bfe4553d796b36af03bda8c0d5af5


--

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



[issue35677] Do not automount in stat() by default

2022-03-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Glad to see that this old inconsistency was fixed.

But seems that if we will add support for statx() we will need to set 
AT_NO_AUTOMOUNT by default.

--
resolution:  -> out of date
stage: patch review -> resolved
status: open -> closed

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



[issue46982] Error in the experts list

2022-03-11 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

After adding experts for typing module, I get an error when try to submit 
changes:

   Error: property nosy: 'JelleZijlstra' is not a user.

I think there is a typo in the experts list.

--
messages: 414893
nosy: gvanrossum, kj, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Error in the experts list

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



[issue46981] Empty typing.Tuple

2022-03-11 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

There are two empty typing.Tuple. They have the same repr but are not equal.

>>> from typing import *
>>> t1 = Tuple[()]
>>> t2 = t1.copy_with(())
>>> t1
typing.Tuple[()]
>>> t2
typing.Tuple[()]
>>> t1 == t2
False
>>> t1.__args__
((),)
>>> t2.__args__
()

The only differences is that one has empty __args__, while other has __args__ 
containing an empty tuple. There is a code purposed to make __args__ containing 
an empty tuple in this case. What is the purpose?

It is not pure theoretical question. This affects unpacked TypeVarTuple 
substitution. With natural implementation Tuple[Unpack[Ts]][()] is not equal to 
Tuple[()] and I still have not figured which and where code should be added to 
handle this special case. It would be easier if such special case did not exist.

Built-in tuple does not have a special case:

>>> tuple[()].__args__
()

--
components: Library (Lib)
messages: 414892
nosy: gvanrossum, kj, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Empty typing.Tuple

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



[issue43224] Add support for PEP 646

2022-03-10 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka
nosy_count: 8.0 -> 9.0
pull_requests: +29901
pull_request: https://github.com/python/cpython/pull/31800

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



[issue45767] Fix types for dev_t processing in posix module

2022-03-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

PR 31794 supports NODEV and checks for integer overflows.

--

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



[issue45767] Fix types for dev_t processing in posix module

2022-03-10 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +29898
pull_request: https://github.com/python/cpython/pull/31794

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



[issue46581] _typevar_types and _paramspec_tvars are missing from _GenericAlias.copy_with

2022-03-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 32bf3597922ac3f613989582afa2bff43bea8a2f by Matt Bogosian in 
branch 'main':
bpo-46581: Propagate private vars via _GenericAlias.copy_with (GH-31061)
https://github.com/python/cpython/commit/32bf3597922ac3f613989582afa2bff43bea8a2f


--
nosy: +serhiy.storchaka

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



[issue40280] Consider supporting emscripten/webassembly as a build target

2022-03-10 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy:  -serhiy.storchaka

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



[issue46972] Documentation: Reference says AssertionError is raised by `assert`, but not all AssertionErrors are.

2022-03-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I concur with Eric. The existing documentation looks pretty clear to me. Any 
exception can be raised explicitly, no need to repeat this.

And unittest.TestCase methods do not raise AssertionError. They raise 
TestCase.failureException, which by default is set to AssertionError. It is 
specified in the corresponding module documentation.

--
nosy: +serhiy.storchaka
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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



[issue43923] Can't create generic NamedTuple as of py3.9

2022-03-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What about mix-ins or abstract base classes?

class VecMixin:
def length(self):
return math.hypot(*self)

class Vec2D(NamedTuple, VecMixin):
x: float
y: float

class Vec3D(NamedTuple, VecMixin):
x: float
y: float
z: float

Currently you need to use the following trick to get a similar result:

class Vec2D(NamedTuple):
x: float
y: float

class Vec2D(Vec2D, VecMixin):
pass

--

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



[issue25927] add dir_fd for mkstemp, and also maybe to all tempfile.*

2022-03-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There are two ways of supporting an open file descriptor to a directory:

1. Accept a file descriptor as the dir argument.
2. Add a new parameter dir_fd; dir will then be a path relative to dir_fd.

The original proposition is option 2. PR 31785 implements option 1. I am going 
to play with the code, implement option 2, and see what is simpler and what is 
more convenient.

Any thoughts or suggestions?

--

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



[issue25927] add dir_fd for mkstemp, and also maybe to all tempfile.*

2022-03-09 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +29890
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/31785

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



[issue46245] Add support for dir_fd in shutil.rmtree()

2022-03-09 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46245] Add support for dir_fd in shutil.rmtree()

2022-03-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 02fbaf4887deaf0207a5805d3736e0124a694c14 by Serhiy Storchaka in 
branch 'main':
bpo-46245: Add optional parameter dir_fd in shutil.rmtree() (GH-30365)
https://github.com/python/cpython/commit/02fbaf4887deaf0207a5805d3736e0124a694c14


--

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



[issue43923] Can't create generic NamedTuple as of py3.9

2022-03-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

PR 31781 is a simple PR which enables multiple inheritance with NamedTuple. As 
a side effect, it adds support of generic NamedTuple.

I am not sure that all details work as expected. It is easy to limit multiple 
inheritance only for Generic if needed.

--

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



[issue43923] Can't create generic NamedTuple as of py3.9

2022-03-09 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +29887
pull_request: https://github.com/python/cpython/pull/31781

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



[issue46953] use FASTCALL for __import__ builtin

2022-03-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What is the advantage of not touching a stable code?

It was never a performance critical part of the code. This is why it avoided 
multiple previous optimizations. It is still use PyArg_ParseTupleAndKeywords().

Of course now, when optimization is provided by Argument Clinic and its code is 
stable enough, we can do this. But performance was never a concern here.

--

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



[issue46953] use FASTCALL for __import__ builtin

2022-03-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The recommended way is to use importlib.import_module().

--

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



[issue23325] Turn SIG_DFL and SIG_IGN into functions

2022-03-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Agree. There were too many changes in this code, and making SIG_DFL and SIG_IGN 
functions exposes some issues with sharing objects between interpreters. It is 
easier to keep them integers for now.

--

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



[issue44439] stdlib wrongly uses len() for bytes-like object

2022-03-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 36dd7396fcd26d8bf9919d536d05d7000becbe5b by Ma Lin in branch 
'main':
bpo-44439: _ZipWriteFile.write() handle buffer protocol correctly (GH-29468)
https://github.com/python/cpython/commit/36dd7396fcd26d8bf9919d536d05d7000becbe5b


--

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



[issue46947] unicodedata.name gives ValueError for control characters

2022-03-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This is a duplicate of issue18234.

--
nosy: +serhiy.storchaka
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Unicodedata module should provide access to codepoint aliases

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



[issue46953] use FASTCALL for __import__ builtin

2022-03-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

__import__() usually is not called directly, and in common case (when it is not 
overridden) the overhead of the call is avoided completely in the import 
statement.

And in non-trivial case, it would only save 80 microseconds if you import 1000 
modules. I don't think there are many programs which import more than 1000 
modules.

--
nosy: +serhiy.storchaka

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



[issue43292] xml.ElementTree iterparse filehandle left open

2022-03-07 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
components: +Library (Lib)
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
superseder: Add the close method for ElementTree.iterparse() object -> 
versions: +Python 3.10, Python 3.11

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



[issue43292] xml.ElementTree iterparse filehandle left open

2022-03-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 852d9b77abefcad2bb8d203e3ab9f2ca49ab305f by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-43292: Fix file leak in `ET.iterparse()` when not exhausted 
(GH-31696) (GH-31720)
https://github.com/python/cpython/commit/852d9b77abefcad2bb8d203e3ab9f2ca49ab305f


--

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



[issue46341] duplicate paragraphs - asyncio Coroutines and Tasks file

2022-03-07 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> duplicate
stage: needs patch -> resolved
status: open -> closed
superseder:  -> Fix incorrect use of directives in asyncio documentation

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



[issue43292] xml.ElementTree iterparse filehandle left open

2022-03-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 496c428de3318c9c5770937491b71dc3d3f18a6a by Jacob Walls in branch 
'main':
bpo-43292: Fix file leak in `ET.iterparse()` when not exhausted (GH-31696)
https://github.com/python/cpython/commit/496c428de3318c9c5770937491b71dc3d3f18a6a


--
nosy: +serhiy.storchaka

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



[issue14156] argparse.FileType for '-' doesn't work for a mode of 'rb'

2022-03-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset eafec26ae5327bb23b6dace2650b074c3327dfa0 by MojoVampire in branch 
'main':
bpo-14156: Make argparse.FileType work correctly for binary file modes when 
argument is '-' (GH-13165)
https://github.com/python/cpython/commit/eafec26ae5327bb23b6dace2650b074c3327dfa0


--

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



[issue46928] type.__qualname__ ignores module name in tp_name for static types

2022-03-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What do you expect?

The full qualified name of the object is __module__ + '.' + __qualname__.

--
nosy: +serhiy.storchaka

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



[issue46927] Improve error message for subscripting non-generic types

2022-03-05 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46927] Improve error message for subscripting non-generic types

2022-03-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset ab9301a28fa431d7a32163126fc96de3b2ce6107 by Serhiy Storchaka in 
branch 'main':
bpo-46927: Include the type's name in the error message for subscripting 
non-generic types (GH-31694)
https://github.com/python/cpython/commit/ab9301a28fa431d7a32163126fc96de3b2ce6107


--

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



[issue46927] Improve error message for subscripting non-generic types

2022-03-05 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46927] Improve error message for subscripting non-generic types

2022-03-05 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +gvanrossum, kj

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



[issue46927] Improve error message for subscripting non-generic types

2022-03-05 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

Currently, if you try to subscript a non-generic type you will get an error:

>>> int[str]
Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'type' object is not subscriptable

Yes, 'type' objects are usually not subscriptable, but list[str] works, and it 
is not clear from the error message for what type it is failed.

The following PR changes an error message:

>>> int[str]
Traceback (most recent call last):
  File "", line 1, in 
TypeError: type 'int' is not subscriptable

--
components: Interpreter Core
messages: 414573
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Improve error message for subscripting non-generic types
type: enhancement
versions: Python 3.11

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



[issue44863] Allow TypedDict to inherit from Generics

2022-03-05 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

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



[issue43923] Can't create generic NamedTuple as of py3.9

2022-03-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Please don't revert all changes. It will not make it working right in any case. 
See issue44863 for more correct approach.

--

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



[issue46864] Deprecate ob_shash in BytesObject

2022-02-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think it is a legacy of Python 2. Attributes and variable names are Unicode 
strings in Python 3, so the main reason of this optimization is no longer 
relevant.

But some programs can still work with encoded bytes instead of strings. In 
particular os.environ and os.environb are implemented as dict of bytes on 
non-Windows.

--
nosy: +serhiy.storchaka

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



[issue46866] bytes class extension with slices

2022-02-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Yes, it is consistent with all of builtin types. If you want to return a 
different type, override __getitem__().

--
nosy: +serhiy.storchaka
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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



[issue38415] @asynccontextmanager decorated functions are not callable like @contextmanager

2022-02-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset b57dbe5d1be925b99f16fe5893e339f92fc05888 by Thomas Grainger in 
branch 'main':
bpo-38415: Remove redundant AsyncContextDecorator.__call__ override from 
_AsyncGeneratorContextManager (GH-30233)
https://github.com/python/cpython/commit/b57dbe5d1be925b99f16fe5893e339f92fc05888


--
nosy: +serhiy.storchaka

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



[issue46865] *() Invalid Syntax: iterable unpacking of empty tuple

2022-02-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See the grammar. 
https://docs.python.org/3/reference/expressions.html#conditional-expressions


conditional_expression ::=  or_test ["if" or_test "else" expression]
expression ::=  conditional_expression | lambda_expr

`*()` is not an expression. It is either a starred_item (which can be a part of 
starred_list or a starred_expression), or a positional_item or a 
starred_and_keywords which are parts of an argument_list. None of them are 
expressions.

`foo(*(stri,) if stri else x)` is interpreted as `foo(*((stri,) if stri else 
x))` if x is an expression. But `*()` is not an expression, thus a syntax error.

--

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



[issue46865] *() Invalid Syntax: iterable unpacking of empty tuple

2022-02-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is an invalid syntax. Write foo(*((stri,) if stri else ())).

--
nosy: +serhiy.storchaka
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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



[issue46820] SyntaxError on `1not in...`

2022-02-25 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue42766] urllib.request.HTTPPasswordMgr uses commonprefix instead of commonpath

2022-02-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Sorry I did not notice this issue. It is now solved in issue46756.

In any case thank you for the report and the PR.

--
nosy: +serhiy.storchaka
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> Incorrect authorization check in urllib.request

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



[issue46756] Incorrect authorization check in urllib.request

2022-02-25 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +lukasz.langa, ned.deily, pablogsal
priority: high -> release blocker

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



[issue46756] Incorrect authorization check in urllib.request

2022-02-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset e2e72567a1c94c548868f6ee5329363e6036057a by Serhiy Storchaka in 
branch 'main':
bpo-46756: Fix authorization check in urllib.request (GH-31353)
https://github.com/python/cpython/commit/e2e72567a1c94c548868f6ee5329363e6036057a


--

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



[issue46756] Incorrect authorization check in urllib.request

2022-02-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Yes, it is the same. I should search before writing a patch.

But for some reasons I prefer my solution over the one proposed in issue42766: 
The code is clearer and more strict, tests use public API instead of a private 
method.

--

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



[issue46820] SyntaxError on `1not in...`

2022-02-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 98c3bea4d1c7335135e60946d0ec8cd5031fb6c0 by Serhiy Storchaka in 
branch 'main':
bpo-46820: Refactor tests for ambiguous end of numerical literal (GH-31494)
https://github.com/python/cpython/commit/98c3bea4d1c7335135e60946d0ec8cd5031fb6c0


--

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



[issue45390] asyncio.Task doesn't propagate CancelledError() exception correctly.

2022-02-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Also Future.result() and Future.exception() can raise a CancelledError. So a 
CancelledError raised in a task may not contain a message passed to 
Task.cancel().

import asyncio
import random

async def main():
fut = asyncio.Future()
fut.cancel()
async def job():
if random.random() < 0.5:
await asyncio.sleep(2)
fut.result()
await asyncio.sleep(5)
task = asyncio.create_task(job())
await asyncio.sleep(1)
task.cancel("cancel task")
await task

asyncio.run(main())

You need to catch a CancelledError raised in a coroutine and re-raise a new 
CancelledError with the specified cancel message if the task was cancelled.

--

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



[issue46829] Confusing CancelError message if multiple cancellations are scheduled

2022-02-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

For reference, the msg parameter of Task.cancel() was added in issue31033.

It seems that the initial use case was for debugging. I do not see how it 
differs from the following example:

r = random.random()
if r < 0.5:
x = 0
else:
x = 0
1/x

In the traceback we see the line where an error occurred but we do not see a 
line which lead to this error.

--

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



[issue46622] Add an async variant of lru_cache for coroutines.

2022-02-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

async_lru_cache() and async_cached_property() can be written using that 
decorator. The implementation of async_lru_cache() is complicated because the 
interface of lru_cache() is complicated. But it is simpler than using 
_lru_cache_wrapper().

def async_lru_cache(maxsize=128, typed=False):
if callable(maxsize) and isinstance(typed, bool):
user_function, maxsize = maxsize, 128
return lru_cache(maxsize, typed)(reawaitable(user_function))

def decorating_function(user_function):
return lru_cache(maxsize, typed)(reawaitable(user_function))

return decorating_function

def async_cached_property(user_function):
return cached_property(reawaitable(user_function))

--

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



[issue46622] Add an async variant of lru_cache for coroutines.

2022-02-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think that it would be simpler to add a decorator which wraps the result of 
an asynchronous function into an object which can be awaited more than once:

def reawaitable(func):
@wraps(func)
def wrapper(*args, **kwargs):
return CachedAwaitable(func(*args, **kwargs))
return wrapper

It can be combined with lru_cache and cached_property any third-party caching 
decorator. No access to internals of the cache is needed.

@lru_cache()
@reawaitable
async def coro(...):
...

@cached_property
@reawaitable
async def prop(self):
...

--

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



<    1   2   3   4   5   6   7   8   9   10   >