[issue46721] Optimize set.issuperset() for non-set argument

2022-04-06 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
dependencies:  -Use-after-free by mutating set during set operations
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

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



[issue47211] Remove re.template() and re.TEMPLATE

2022-04-06 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue47227] Suppress expression chaining for RE parsing errors

2022-04-06 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue43464] set intersections should short-circuit

2022-04-06 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue26579] Support pickling slots in subclasses of common classes

2022-04-06 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue26579] Support pickling slots in subclasses of common classes

2022-04-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 884eba3c76916889fd6bff3b37b8552bfb4f9566 by Serhiy Storchaka in 
branch 'main':
bpo-26579: Add object.__getstate__(). (GH-2821)
https://github.com/python/cpython/commit/884eba3c76916889fd6bff3b37b8552bfb4f9566


--

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



[issue46721] Optimize set.issuperset() for non-set argument

2022-04-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset a69a4a917c436579c2c4112081ea86a70f1f05d3 by Serhiy Storchaka in 
branch 'main':
bpo-46721: Optimize set.issuperset() for non-set arguments (GH-31280)
https://github.com/python/cpython/commit/a69a4a917c436579c2c4112081ea86a70f1f05d3


--

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



[issue43464] set intersections should short-circuit

2022-04-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 31cd25f4e17cd68487dc76c1b2ec162a646818c2 by Serhiy Storchaka in 
branch 'main':
bpo-43464: Optimize set.intersection() for non-set arguments (GH-31316)
https://github.com/python/cpython/commit/31cd25f4e17cd68487dc76c1b2ec162a646818c2


--

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



[issue47227] Suppress expression chaining for RE parsing errors

2022-04-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 50872dbadcba1f52867b6f76050cd7b5d0aa1e18 by Serhiy Storchaka in 
branch 'main':
bpo-47227: Suppress expression chaining for more RE parsing errors (GH-32333)
https://github.com/python/cpython/commit/50872dbadcba1f52867b6f76050cd7b5d0aa1e18


--

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



[issue47211] Remove re.template() and re.TEMPLATE

2022-04-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset b09184bf05b07b77c5ecfedd4daa846be3cbf0a9 by Serhiy Storchaka in 
branch 'main':
bpo-47211: Remove function re.template() and flag re.TEMPLATE (GH-32300)
https://github.com/python/cpython/commit/b09184bf05b07b77c5ecfedd4daa846be3cbf0a9


--

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



[issue47227] Suppress expression chaining for RE parsing errors

2022-04-05 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue47227] Suppress expression chaining for RE parsing errors

2022-04-05 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

The EAFP principle is widely used in the regular expressions parsing code. 
Exceptions like KeyError, IndexError, ValueError or OverflowError raised during 
parsing are converted into a helpful re.error. Expression chaining is usually 
suppressed in such cases to hide unrelated implementation details, but not in 
all cases. The following PR adds more "from None" in "raise" statements inside 
"except" blocks.

--
components: Library (Lib), Regular Expressions
messages: 416774
nosy: ezio.melotti, mrabarnett, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Suppress expression chaining for RE parsing errors
type: enhancement
versions: Python 3.11

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



[issue47152] Reorganize the re module sources

2022-04-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See issue47211 for removing re.TEMPLATE.

--

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



[issue47152] Reorganize the re module sources

2022-04-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> Match.regs is an undocumented attribute, it seems it has existed since 1991. 
Can it be removed?

It was kept for compatibility with the pre-SRE implementation of the re module. 
It was an implementation detail in the original Python code, but I am sure that 
somebody still uses it. I am sure some code still use it. If we are going to 
remove it, it needs to be deprecated first.

--

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



[issue47211] Remove re.template() and re.TEMPLATE

2022-04-04 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue47152] Reorganize the re module sources

2022-04-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset ff2cf1d7d5fb25224f3ff2e0c678d36f78e1f3cb by Serhiy Storchaka in 
branch 'main':
bpo-47152: Remove unused import in re (GH-32298)
https://github.com/python/cpython/commit/ff2cf1d7d5fb25224f3ff2e0c678d36f78e1f3cb


--

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



[issue47211] Remove re.template() and re.TEMPLATE

2022-04-04 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

They were added in 436c3d58a2570f3b599e59b4071f944f774ec441 (between 1.6a2 and 
2.0), but the purpose is not known. See also 
https://mail.python.org/archives/list/python-...@python.org/message/DVSQGM5LO4TK63C63H6KQ6XBTBQGFLEN/.
 The feature was not fully implemented, and it was disabled short time later in 
29c4ba9ada44d62988c62c85c8046985f10a1c85. Currently the only effect of this 
flag is that repetition operators (+, *, ?, {}) do not work. A comment was 
added in 3562f1176403653ebfbef6275d449ad42d1b843a:

SRE_FLAG_TEMPLATE = 1 # template mode (disable backtracking)

It's all. I guess it could have some relation to possessive repetition 
operators, except that it is a global flag.

I think it should be removed without deprecation because it never really worked 
and never was documented.

--
components: Library (Lib), Regular Expressions
messages: 416658
nosy: ezio.melotti, mrabarnett, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Remove re.template() and re.TEMPLATE
type: enhancement
versions: Python 3.11

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



[issue47152] Reorganize the re module sources

2022-04-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 1578f06c1c69fbbb942b90bfbacd512784b599fa by Serhiy Storchaka in 
branch 'main':
bpo-47152: Move sources of the _sre module into a subdirectory (GH-32290)
https://github.com/python/cpython/commit/1578f06c1c69fbbb942b90bfbacd512784b599fa


--

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



[issue47152] Reorganize the re module sources

2022-04-04 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +30357
pull_request: https://github.com/python/cpython/pull/32298

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



[issue47190] Integrating tkinter and asyncio event loops

2022-04-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is a duplicate of issue27546.

--
nosy: +serhiy.storchaka

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



[issue47152] Reorganize the re module sources

2022-04-03 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +30351
pull_request: https://github.com/python/cpython/pull/32290

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



[issue39064] ValueError in zipfile.ZipFile

2022-04-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Try to create a normal ZIP file (it can be empty), then try to set some byte to 
FF (or a pair of bytes to , or 4 consequent bytes to , until you 
get the exactly same error). Then you can just add the binary dump of that file 
in tests.

--
nosy: +serhiy.storchaka

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



[issue23689] Memory leak in Modules/sre_lib.h

2022-04-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thank you Ma Lin for all your work.

The fix changes interfaces of some internal functions which can be used in 
third-party code, and the bug occurs only in special circumstances, so it is 
not practical to backport it.

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

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



[issue23689] Memory leak in Modules/sre_lib.h

2022-04-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 6e3eee5c11b539e9aab39cff783acf57838c355a by Ma Lin in branch 
'main':
bpo-23689: re module, fix memory leak when a match is terminated by a signal or 
memory allocation failure (GH-32283)
https://github.com/python/cpython/commit/6e3eee5c11b539e9aab39cff783acf57838c355a


--

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



[issue47152] Reorganize the re module sources

2022-04-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There are two very different classes with similar names: _sre.SRE_Scanner and 
re.Scanner. The former is used to implement the Pattern.finditer() method, but 
it could be used in other cases. The latter is an experimental implementation 
of generalized lexer using the former class. Both are undocumented. It is 
difficult to document Pattern.scanner() and _sre.SRE_Scanner because the class 
name contains implementation-specific prefix, and without it it would conflict 
with re.Scanner.

But let leave it all to a separate issue.

The original discussion about TEMPLATE was lost. Initially it only affected 
repetition operators, but now using them with TEMPLATE is error.

--

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



[issue47152] Reorganize the re module sources

2022-04-02 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> Is the "import _locale" still used in re/__init__.py? It cannot see any 
> reference to it in the code and test_re still if it's removed.

It is true.

> *Maybe* it's time to consider that re.template() and re.Scanner are no longer 
> experimental? Maybe change their status to alpha or beta? :-D

First we need to find original discussions for these features (it may be not 
easy) and decide whether we want to finish them or remove.

> In `Modules` folder, there are _sre.c/sre.h/sre_constants.h/sre_lib.h files. 
> Will them be put into a folder?

It is step 2.

> would it be possible to expose `parse_template` -- or at least some way to 
> validate that a regex replacement string is correct prior to executing the 
> replacement?

Maybe, in some form. Currently you can precompile a pattern, but for a 
replacement string you rely on a LRU cache. It is slower, and limited by the 
fixed size of the cache. I think it would be worth to add a function for 
compiling a replacement string. sub() etc should accept both string and a 
precompiled template object. It is a separate issue.

--

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



[issue47152] Reorganize the re module sources

2022-04-02 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 1be3260a90f16aae334d993aecf7b70426f98013 by Serhiy Storchaka in 
branch 'main':
bpo-47152: Convert the re module into a package (GH-32177)
https://github.com/python/cpython/commit/1be3260a90f16aae334d993aecf7b70426f98013


--

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



[issue47152] Reorganize the re module sources

2022-04-01 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Modules with old names are kept (deprecated). The questions are:

1. Should we keep the sre_ prefix in new submodules? Should we prefix them with 
underscores?
2. Should we keep only non-underscored names in the sre_* modules or undescored 
names too?

--

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



[issue47163] "unterminated subpattern" in valid regex if re.VERBOSE is used

2022-03-30 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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



[issue47163] "unterminated subpattern" in valid regex if re.VERBOSE is used

2022-03-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

"#" in VERBOSE mode starts a comment and skips to the end of the line. Escape 
it: "\#".

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

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



[issue47152] Reorganize the re module sources

2022-03-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It turns out that pip uses sre_constants in its copy of pyparsing. The problem 
is already fixed in the upstream of pyparsing and soon should be fixed in pip. 
We still need to keep sre_constants and maybe other sre_* modules, but 
deprecate them.

> Could the sre_parse and sre_constants modules be kept with public names (i.e. 
> without the leading underscore) but within the re namespace?

It is a good idea which will allow to minimize breakage in short term. You can 
write "from re import sre_parse", and it would work in old and new versions 
because sre_parse and sre_compile were imported in the re module. This trick 
does not work with sre_constants, you still need try/except.

But the code that depends on these modules is fragile and can be broken by 
other ways.

> Please don't merge too close to the 3.11 beta1 release date, I'll submit PRs 
> after this merged.

I am going to implement step 2 only after merging your changes for issue23689.

--

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



[issue26120] pydoc: move __future__ imports out of the DATA block

2022-03-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> Yet one bug: PR 30888 only changed the text output. But there is also the 
> html output generator.

Sorry, I was wrong. The changed code is common for all generators. Perhaps I 
tested with wrong version.

--

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



[issue47152] Reorganize the re module sources

2022-03-29 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue23689] Memory leak in Modules/sre_lib.h

2022-03-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This looks promising. Please, go ahead! You are free to add any fields to any 
opcodes. It may break some third-party code which generates compiled patterns 
from a sequence of opcodes, it the stability of this interface was not 
promised. And they will be broken in any case due to reorganizing of internal 
code (issue47152).

--

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



[issue47152] Reorganize the re module sources

2022-03-29 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

I proposed it several years ago on the Python-Dev mailing list and that change 
was approved in general. The reorganization was deferred because there were 
several known bugs in the RE engine (fixes for which could potentially be 
backported) and there were not merged patches waiting for review. Now the patch 
for atomic groups was merged and bugs was fixed (thanks to Ma Lin).

Both the C code and the Python code for the re module are distributed on few 
files, which lie down in directories Modules and Lib. It makes difficult to 
work with all related files because they are intermixed with source files of 
different modules.

The following changes are planned:

1. Convert the re module into a package. Make sre_* modules its submodules.
2. Move C sources for the _sre module into a separate directory.
3. Extract the code for generating definitions of C constants from definitions 
of Python constants into a separate script and add it in the Tools/scripts 
directory (there are precedences: generate_token.py, etc).

--
components: Library (Lib), Regular Expressions
messages: 416268
nosy: ezio.melotti, gvanrossum, malin, mrabarnett, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Reorganize the re module sources
versions: Python 3.11

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



[issue9134] sre bug: lastmark_save/restore

2022-03-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Fixed in issue35859 together with other bugs, but the fix was only applied to 
3.11, because that bug is old and the old behavior matches the behavior in some 
other engines (Perl and Java).

--
resolution:  -> out of date
stage: needs patch -> resolved
status: open -> closed
versions: +Python 3.11 -Python 2.7, Python 3.7, Python 3.8

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



[issue26120] pydoc: move __future__ imports out of the DATA block

2022-03-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Yet one bug: PR 30888 only changed the text output. But there is also the html 
output generator.

--

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



[issue26120] pydoc: move __future__ imports out of the DATA block

2022-03-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I am sorry that I did not test the changes manually, but it seems that 
__future__ annotations are now disappeared from the pydoc output for the 
__future__ module help.

$ ./python -m pydoc __future__

It is now difficult to get a list of available features from the help.

They should be kept in the DATA section for the __future__ module.

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

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



[issue35859] Capture behavior depends on the order of an alternation

2022-03-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Since the old behavior in many cases matches the behavior of Perl and Java 
(which are considered bugs, but still), it was decided to not backport the fix 
to avoid possible breakage in bugfix releases.

Thank you Ma Lin for your contribution.

--
components: +Library (Lib)
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.11 -Python 2.7, Python 3.7, Python 3.8

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



[issue35859] Capture behavior depends on the order of an alternation

2022-03-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 35699721a3391175d20e9ef03d434675b496 by Ma Lin in branch 
'main':
bpo-35859: Fix a few long-standing bugs in re engine (GH-12427)
https://github.com/python/cpython/commit/35699721a3391175d20e9ef03d434675b496


--

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



[issue26120] pydoc: move __future__ imports out of the DATA block

2022-03-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Module objects are not shown in the help unless they are submodules of the 
specified module, even if they are imported with the star import. With this 
precedence I think it is okay to exclude the __future__ annotations as well.

--

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



[issue26120] pydoc: move __future__ imports out of the DATA block

2022-03-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I once proposed to exclude modules from the star import by default, but this 
proposition was rejected. You can try, maybe your proposition will be more 
acceptable.

--

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



[issue47079] Integral.denominator shouldn't return an int

2022-03-27 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> not a bug
stage: patch review -> resolved
status: open -> closed

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



[issue43323] UnicodeEncodeError: surrogates not allowed when parsing invalid charset

2022-03-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I fixed all suspicious places for which I found reproducers in PR 32137.

--

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



[issue43323] UnicodeEncodeError: surrogates not allowed when parsing invalid charset

2022-03-27 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue43323] UnicodeEncodeError: surrogates not allowed when parsing invalid charset

2022-03-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Sorry, I was puzzled by the exception type and missed details in a long 
traceback (I have issues with reading large texts). Thank you for your detailed 
report.

The simple fix is to add UnicodeEncodeError to "except LookupError". But there 
may be other places where we can get a similar error. They should be fixed too.

Alternatively we can do something when we get an invalid charset from the 
parsed data. I am not the email package expert, so I do not know what would be 
better in that context.

--
components: +Library (Lib)
versions: +Python 3.11 -Python 3.8

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



[issue47079] Integral.denominator shouldn't return an int

2022-03-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It does not satisfy your assumptions in msg416056. So you have either correct 
your assumptions, or change the implementation of __add__, or change the 
implementation of denominator in your code.

--

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



[issue47133] enhance unittest to show test name and docstring on one line

2022-03-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This is already the third (at least) issue asking for such feature. Many people 
have problems with the current output. I would prefer to have a full qualified 
name of the test which I can copy by a double click and insert in a command 
that reruns specified tests. And full path to the test's source which I can 
copy to run in editor. pytest output looks more user-friendly to me.

But it may break other's test output parsers so we perhaps need an option for 
this. Options for unittest and libregrtest. I am not sure that it is a task for 
an average new contributor.

--

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



[issue47128] Enhance Argument Clinic's NoneType return converter to give `void`

2022-03-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is simpler and faster to return NULL than call PyErr_Occurred(). There is a 
special macro PY_RETURN_NONE, so there is no problem with returning None either.

I do not think it would make the code better.

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

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



[issue47133] enhance unittest to show test name and docstring on one line

2022-03-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Issue14265, issue46126.

--
nosy: +serhiy.storchaka

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



[issue43323] UnicodeEncodeError: surrogates not allowed when parsing invalid charset

2022-03-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is interesting that you get an UnicodeEncodeError when try to decode. Could 
the charser name contain non-ascii characters?

--
nosy: +serhiy.storchaka

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



[issue26120] pydoc: move __future__ imports out of the DATA block

2022-03-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I am positive about this idea, but we must also think about the possible 
negative consequences. For example, the future annotations will be included in 
the star-import by default and can override some global names. The fact that 
some names not visible in the module help can override global names can be 
confusing.

I think it should be discussed with a wider auditory.

--
nosy: +serhiy.storchaka

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



[issue47128] Enhance Argument Clinic's NoneType return converter to give `void`

2022-03-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The function should return different values for success and error. Functions 
which do not do this have bad design.

--
nosy: +serhiy.storchaka

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



[issue47079] Integral.denominator shouldn't return an int

2022-03-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Integral.__add__ is an abstract method, so it is a problem of your 
implementation.

--

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



[issue47079] Integral.denominator shouldn't return an int

2022-03-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The module documentation should not contain all historical reasons of every 
design decision. If you are interesting why something was done in one way or 
another, do your research.

One of reasons is that type(self) not always have a constructor with compatible 
interface. So it may work for your integer-like type, but in general case.

--

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



[issue32642] add support for path-like objects in sys.path

2022-03-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

pkgutil just skips non-string elements in sys.path.

for dir in search_path:
if not isinstance(dir, str):
continue

--

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



[issue32642] add support for path-like objects in sys.path

2022-03-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think you are trying to solve a wrong problem.

> This wasn't obvious because Path objects appear as strings in normal debug 
> output, etc.

How is it?

>>> pathlib.Path('/usr/lib')
PosixPath('/usr/lib')
>>> [pathlib.Path('/usr/lib')]
[PosixPath('/usr/lib')]

I think the problem is with the debug output. Always use repr() for it, 
otherwise you will trick yourself.

> but the corresponding imports weren't working as they should

It would be easier to catch if it was never working with non-string. I think we 
should deprecate any non-string elements in sys.path.

As I shown above some code only works correctly with strings anyway.

--

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



[issue47079] Integral.denominator shouldn't return an int

2022-03-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There is no "why". There is a fact that there is no such constrain. Adding a 
new constrain may break existing code. If you want to add a constrain, add it 
in you code.

If you are interesting "why", try to search old archives for the history of 
creating that module. Maybe you will find something. Maybe you will need to dip 
deeper, in discussions about abstract classes and protocols.

--

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



[issue47079] Integral.denominator shouldn't return an int

2022-03-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There is no such constrain. And no default implementation in this module 
depends on the constructor. It is important, the constructor is not the part of 
interfaces.

If you want to return the same type in denominator, just override it in your 
class.

--

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



[issue47121] math.isfinite() can raise exception when called on a number

2022-03-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Most (but not all) functions in the math module implicitly convert its 
arguments to float. Here we can get an OverflowError. Do we want to add a note 
to every function that does it? Or add a general note at the top of the file 
and add exclusion notes to functions which do not convert arguments to float?

BTW, there is a general note: "Except when explicitly
noted otherwise, all return values are floats."

--
nosy: +serhiy.storchaka

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



[issue47079] Integral.denominator shouldn't return an int

2022-03-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

How would it work for bool or IntEnum?

--
nosy: +lemburg, mark.dickinson, stutzbach

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



[issue32642] add support for path-like objects in sys.path

2022-03-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Are there any problems with converting a Path to string before adding it to 
sys.path? You do this one time, and any users of sys.path will not need to 
bother about conversion. It is better even for performance.

Otherwise we will need to revise and update every code that uses sys.path, and 
many bugs will left in third-party code for years. For example, in unittest the 
code

if not top_level_dir in sys.path:
sys.path.insert(0, top_level_dir)

should be replaced with more cumbersome

for path in sys.path:
if os.fsdecode(path) == top_level_dir:
break
else:
sys.path.insert(0, top_level_dir)

In multiprocessing the code

sys_path=sys.path.copy()
try:
i = sys_path.index('')
except ValueError:
pass
else:
sys_path[i] = process.ORIGINAL_DIR

should be replaced with

sys_path=sys.path.copy()
for i, path in enumerate(sys_path):
if os.fsdecode(path) == '':
sys_path[i] = process.ORIGINAL_DIR
break

It is just two examples. I did not review the whole stdlib, and there should be 
more third-party code.

--
nosy: +serhiy.storchaka

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



[issue47119] test_freeze_simple_script in test_tools fails

2022-03-25 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

$ ./python -X frozen_modules=off -m test -vuall test_tools -m 
test_freeze_simple_script
...
==
ERROR: test_freeze_simple_script (test.test_tools.test_freeze.TestFreeze)
--
Traceback (most recent call last):
  File "/home/serhiy/py/cpython/Lib/contextlib.py", line 155, in __exit__
self.gen.throw(typ, value, traceback)
^
  File "/home/serhiy/py/cpython/Lib/test/support/os_helper.py", line 396, in 
temp_dir
yield path
^^
  File "/home/serhiy/py/cpython/Lib/test/test_tools/test_freeze.py", line 27, 
in test_freeze_simple_script
outdir, scriptfile, python = helper.prepare(script, outdir)
 ^^
  File "/home/serhiy/py/cpython/Tools/freeze/test/freeze.py", line 134, in 
prepare
copy_source_tree(srcdir, SRCDIR)

  File "/home/serhiy/py/cpython/Tools/freeze/test/freeze.py", line 83, in 
copy_source_tree
shutil.copytree(oldroot, newroot)
^
  File "/home/serhiy/py/cpython/Lib/shutil.py", line 558, in copytree
return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
   ^^^
  File "/home/serhiy/py/cpython/Lib/shutil.py", line 514, in _copytree
raise Error(errors)
^^^
shutil.Error: [('/home/serhiy/py/cpython/tmp/y', 
'/tmp/tmp1swfh4ik/cpython/tmp/y', "[Errno 2] No such file or directory: 
'/home/serhiy/py/cpython/tmp/y'"), ('/home/serhiy/py/cpython/link', 
'/tmp/tmp1swfh4ik/cpython/link', "[Errno 2] No such file or directory: 
'/home/serhiy/py/cpython/link'"), 
('/home/serhiy/py/cpython/Tools/unicode/python-mappings/CP932.TXT', 
'/tmp/tmp1swfh4ik/cpython/Tools/unicode/python-mappings/CP932.TXT', "[Errno 5] 
Input/output error: 
'/home/serhiy/py/cpython/Tools/unicode/python-mappings/CP932.TXT' -> 
'/tmp/tmp1swfh4ik/cpython/Tools/unicode/python-mappings/CP932.TXT'"), 
('/home/serhiy/py/cpython/Tools/unicode/python-mappings-/CP949.TXT', 
'/tmp/tmp1swfh4ik/cpython/Tools/unicode/python-mappings-/CP949.TXT', "[Errno 5] 
Input/output error: 
'/home/serhiy/py/cpython/Tools/unicode/python-mappings-/CP949.TXT' -> 
'/tmp/tmp1swfh4ik/cpython/Tools/unicode/python-mappings-/CP949.TXT'"), 
('/home/serhiy/py/cpython/Python/y', '/tmp/tmp1swfh4ik/cpython/Python/y', 
"[Errno 2] No 
 such file or directory: '/home/serhiy/py/cpython/Python/y'"), 
('/home/serhiy/py/cpython/dl', '/tmp/tmp1swfh4ik/cpython/dl', "[Errno 2] No 
such file or directory: '/home/serhiy/py/cpython/dl'"), 
('/home/serhiy/py/cpython/issue36694/out.pickle', 
'/tmp/tmp1swfh4ik/cpython/issue36694/out.pickle', "[Errno 5] Input/output 
error: '/home/serhiy/py/cpython/issue36694/out.pickle' -> 
'/tmp/tmp1swfh4ik/cpython/issue36694/out.pickle'")]

--

--
components: Demos and Tools, Tests
messages: 416001
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: test_freeze_simple_script in test_tools fails
type: behavior
versions: Python 3.11

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



[issue47118] test_run_keeps_context in test_asyncio fails

2022-03-25 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

$ ./python -m test -vuall test_asyncio
...
==
FAIL: test_run_keeps_context (test.test_asyncio.test_runners.RunnerTests)
--
Traceback (most recent call last):
  File "/home/serhiy/py/cpython/Lib/test/test_asyncio/test_runners.py", line 
299, in test_run_keeps_context
self.assertEqual({cvar: 2}, dict(runner.run(get_context(

AssertionError: {: 2} != {: 2, : 2}
?  ^

+ {: 2,
?  ^

+  : Context(prec=28, 
rounding=ROUND_HALF_EVEN, Emin=-99, Emax=99, capitals=1, clamp=0, 
flags=[], traps=[InvalidOperation, DivisionByZero, Overflow])}

--


When run the test separately it passes successfully.

--
components: Tests, asyncio
messages: 416000
nosy: asvetlov, serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: test_run_keeps_context in test_asyncio fails
type: behavior
versions: Python 3.11

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



[issue44493] Missing terminated NUL in the length of sockaddr_un

2022-03-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I am not the socket programming expert. It just happened that I fixed some bugs 
here. But according to the manpage 
https://man7.org/linux/man-pages/man7/unix.7.html the address length should 
include the terminating NUL: offsetof(struct sockaddr_un, sun_path) + 
strlen(sun_path) + 1. So the fix is correct.

--

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



[issue44493] Missing terminated NUL in the length of sockaddr_un

2022-03-24 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +christian.heimes

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



[issue40465] Deprecate the optional *random* argument to random.shuffle()

2022-03-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 12c0012cf97d21bc637056983ede0eaf4c0d9c33 by Tomáš Hrnčiar in 
branch 'main':
bpo-40465: Document random module changes in 3.11 What's new (#31818)
https://github.com/python/cpython/commit/12c0012cf97d21bc637056983ede0eaf4c0d9c33


--

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



[issue22608] test_socket fails with sem_init: Too many open files

2022-03-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Note that it is a FreeBSD-only issue. We need to test on FreeBSD (ulimit -n can 
be used for this) to check whether it was fixed in issue45212.

--
status: pending -> open

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



[issue42885] Optimize re.search() for \A (and maybe ^)

2022-03-22 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue42885] Optimize re.search() for \A (and maybe ^)

2022-03-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 492d4109f4d953c478cb48f17aa32adbb912623b by Serhiy Storchaka in 
branch 'main':
bpo-42885: Optimize search for regular expressions starting with "\A" or "^" 
(GH-32021)
https://github.com/python/cpython/commit/492d4109f4d953c478cb48f17aa32adbb912623b


--

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



[issue47081] Replace "qualifiers" with "quantifiers" in the re module documentation

2022-03-22 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue28080] Allow reading member names with bogus encodings in zipfile

2022-03-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset a25a985535ccbb7df8caddc0017550ff4eae5855 by Serhiy Storchaka in 
branch 'main':
bpo-28080: Add support for the fallback encoding in ZIP files (GH-32007)
https://github.com/python/cpython/commit/a25a985535ccbb7df8caddc0017550ff4eae5855


--

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



[issue47081] Replace "qualifiers" with "quantifiers" in the re module documentation

2022-03-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset c6cd3cc93c40363ce704d34a70e6fb73ea1d97a3 by Serhiy Storchaka in 
branch 'main':
bpo-47081: Replace "qualifiers" with "quantifiers" in the re module 
documentation (GH-32028)
https://github.com/python/cpython/commit/c6cd3cc93c40363ce704d34a70e6fb73ea1d97a3


--

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



[issue47006] PEP 646: Decide on substitution behavior

2022-03-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> 1. Some edge case seems to be that if *tuple[...] is involved on either side 
> we will never simplify. Or perhaps a better rule is that *tuple[...] is never 
> simplified away (but fixed items before and after it may be).

I do not understand this. Do you forbid simplifying of tuple[*Ts, float][str, 
*tuple[int, ...]] to tuple[str, *tuple[int, ...], float]?

I think that the rule should be that *tuple[X, ...] cannot split between 
different variables. Or that it cannot substitute a TypeVar. A more strong 
variant of rule 4.

> 5. ... but we cannot flag it as an error either.

I think that it will better to flag it as an error now. Later, after all code 
be merged and all edge cases be handled we can return here and reconsider this.

There are workarounds for this.

* You should not use Generic[*Ts] if you require at least one item, but 
Generic[*Ts, T].
* Instead of `def foo(*args: *Ts)` use `def foo(*args: *tuple[*Ts, T])`.

These tricks are common in functional programming.

The rest of the rules match my implementations more or less.

--

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



[issue47006] PEP 646: Decide on substitution behavior

2022-03-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> Alias = C[T, *Ts]
> Alias2 = Alias[*tuple[int, ...]]
> # Alias2 should be C[int, *tuple[int, ...]]

tuple[int, ...] includes also an empty tuple, and in this case there is no 
value for T.

> Oh, also interesting - I didn't know about this one either. Could you give an 
> example?

If __origin__, __parameters__, __args__ are a mess, it will definitely break a 
code which use them.


> We actually deliberately chose not to unpack concrete tuple types - see the 
> description of https://github.com/python/cpython/pull/30398, under the 
> heading 'Starred tuple types'. (If you see another way around it, though, let 
> me know.)

You assumed that *tuple[str, bool] in def foo(*args: *tuple[str, bool]) should 
give foo.__annotations__['args'] = tuple[str, bool], but it should rather give 
(str, bool). No confusion with tuple[str, bool].

And one of PEP 646 options is to implement star-syntax only in subscription, 
not in var-parameter type annotations.

> I'm also not sure about this one; disallowing unpacked TypeVarTuples in 
> argument lists to generic aliases completely (if I've understood right?)

No, it will only be disallowed in substitution of a VarType. Tuple[T][*Ts] -- 
error. Tuple[*Ts][*Ts2] -- ok.

I propose to implement simple and strict rules, and later add support of new 
cases where it makes sense.

--

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



[issue47006] PEP 646: Decide on substitution behavior

2022-03-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The first case will be practically fixed by GH 32030 after chenging the grammar 
to allow unpacking in index tuple: A[*B].

Two other cases will be fixed by GH 32031. It does not require any C code.

In the last case no error is raised because some error checks are skipped if 
any of Generic arguments is a TypeVarTuple. We just need to add such checks. 
This is Python-only code too.

Note that the alternative proposition is even more lenient to errors.

--

___
Python tracker 
<https://bugs.python.org/issue47006>
___
___
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-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +30120
pull_request: https://github.com/python/cpython/pull/32031

___
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-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +30119
pull_request: https://github.com/python/cpython/pull/32030

___
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



[issue47081] Replace "qualifiers" with "quantifiers" in the re module documentation

2022-03-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue47081] Replace "qualifiers" with "quantifiers" in the re module documentation

2022-03-21 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

In the Web you can find that two terms are used for repetition operators (+, *, 
?, and variants): "quantifiers" and "qualifiers". "Quantifiers" is much more 
common, it is used in Wikipedia and main on-line documentation resources. But 
"qualifiers" is consistently used in the re module code documentation.

It looks to me that "qualifiers" is just a reproduced typo. I propose to 
replace it with "quantifiers".

--
assignee: docs@python
components: Documentation, Regular Expressions
messages: 415686
nosy: docs@python, ezio.melotti, mrabarnett, serhiy.storchaka, tim.peters
priority: normal
severity: normal
status: open
title: Replace "qualifiers" with "quantifiers" in the re module documentation
type: enhancement
versions: Python 3.11

___
Python tracker 
<https://bugs.python.org/issue47081>
___
___
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-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 345b390ed69f36681dbc41187bc8f49cd9135b54 by Serhiy Storchaka in 
branch 'main':
bpo-433030: Add support of atomic grouping in regular expressions (GH-31982)
https://github.com/python/cpython/commit/345b390ed69f36681dbc41187bc8f49cd9135b54


--

___
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



[issue23691] re.finditer iterator is not reentrant, but doesn't protect against nested calls to __next__

2022-03-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue23691] re.finditer iterator is not reentrant, but doesn't protect against nested calls to __next__

2022-03-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 08eb754d840696914928355014c2d424131f8835 by Serhiy Storchaka in 
branch 'main':
bpo-23691: Protect the re.finditer() iterator from re-entering (GH-32012)
https://github.com/python/cpython/commit/08eb754d840696914928355014c2d424131f8835


--

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



[issue42885] Optimize re.search() for \A (and maybe ^)

2022-03-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue47080] Use atomic groups to simplify fnmatch

2022-03-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

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



[issue23691] re.finditer iterator is not reentrant, but doesn't protect against nested calls to __next__

2022-03-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.6, Python 
3.7

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



[issue23691] re.finditer iterator is not reentrant, but doesn't protect against nested calls to __next__

2022-03-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue42871] Regex compilation crashed if I change order of alternatives under quantifier

2022-03-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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



[issue42369] Reading ZipFile not thread-safe

2022-03-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue42369] Reading ZipFile not thread-safe

2022-03-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset e730ae7effe4f13b24f1b5fb1fca005709c86acb by Kevin Mehall in 
branch 'main':
bpo-42369: Fix thread safety of zipfile._SharedFile.tell (GH-26974)
https://github.com/python/cpython/commit/e730ae7effe4f13b24f1b5fb1fca005709c86acb


--

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



[issue28080] Allow reading member names with bogus encodings in zipfile

2022-03-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I experimented with this a lot. There is a problem with the append mode. We can 
read in the append mode, therefore we need an encoding. But when we close a 
ZipFile after appending, non-ASCII file names will be encoded in UTF-8 in the 
central directory. Next time when we open the archive for reading with 
different encoding we will get an error because filenames in the central 
directory and in local headers are different. We need to write non-ASCII files 
back with the specified encoding to get a self-consistent data.

Finally I left this as it was initially. We can return to the problem with the 
append module later.

The differences between PR 32007 and your patches:

* The parameter was renamed to metadata_encoding to avoid confusion with 
existing parameter of ZipFile.open() encoding. In future I am going to use it 
also for comments. The attribute and the CLI option were renamed 
correspondingly.
* --metadata-encoding can also be used with the -t option.
* "surrogateescape" no longer used. If the encoding in not suitable, you will 
get an error. Use the default and decode filenames manually in such cases. We 
can change this in future.
* Updated documentation.
* Tests were significantly rewritten. Now they test the behavior with wrong 
metadata_encoding, mixed UTF-8 and legacy encodings, and reading after append.

I was going to make more changes, but left it for future.

--
versions: +Python 3.11 -Python 3.7

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



[issue28080] Allow reading member names with bogus encodings in zipfile

2022-03-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +30095
pull_request: https://github.com/python/cpython/pull/32007

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



[issue40074] pickle module dump and load: add support for string file names

2022-03-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue47065] test_curses fails if terminal defaults to bright white text (15)

2022-03-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I am surprised. I use Konsole too, and the TERM value and the infocmp output 
are the same for me.

--
nosy: +serhiy.storchaka

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



[issue47006] PEP 646: Decide on substitution behavior

2022-03-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I am for consistent behavior. If return GenericAlias(GenericAlias(tuple, 
Unpack[Ts]), (int, str)) for tuple[*Ts][int, str], we should also return 
GenericAlias(GenericAlias(list, T), int) for list[T][int], etc. And it will 
cause multiple problems:

* A repr can be less readable.
* It will break equality comparison and hashing. Good bye caching.
* What about __origin__, __parameters__, __args__? How will they be calculated?
* It can break code which uses annotations for something. For example it can 
break dataclasses.

It may be that will need to use it as a fallback for cases like tuple[T, 
*Ts][*Ts2] (currently it is error). But I am not sure that such cases should be 
supported.

--

___
Python tracker 
<https://bugs.python.org/issue47006>
___
___
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-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 383a3bec74f0bf0c1b1bef9e0048db389c618452 by Serhiy Storchaka in 
branch 'main':
bpo-46996: IDLE: Drop workarounds for old Tk versions (GH-31962)
https://github.com/python/cpython/commit/383a3bec74f0bf0c1b1bef9e0048db389c618452


--

___
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-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
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



[issue40296] help(list[int]) fails

2022-03-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset e207d721fcea01123f0e3edb83b6decdcb5e5e63 by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-40296: Fix supporting generic aliases in pydoc (GH-30253). (GH-31976) 
(GH-31981)
https://github.com/python/cpython/commit/e207d721fcea01123f0e3edb83b6decdcb5e5e63


--

___
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



[issue45979] Fix Tkinter tests with old Tk

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/issue45979>
___
___
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 :


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

___
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



  1   2   3   4   5   6   7   8   9   10   >