[issue45531] field "mro" behaves strangely in dataclass

2021-10-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Where does dataclasses call mro()?

--

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



[issue44970] Re-examine complex pow special case handling

2021-10-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Is not it a duplicate of issue15996?

--

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



[issue45535] Enum's dir() does not contain inherited members

2021-10-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There may be a simple error (superfluous .__class__), but I am not sure.

BTW, why use mro() instead of __mro__? Most code use __mro__.

--

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



[issue45556] uuid.uuid4() fast optimization

2021-10-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

random.getrandbits() is cryptographically weaker than os.urandom().

--
nosy: +rhettinger, serhiy.storchaka

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



[issue45542] Using multiple comparison operators can cause performance issues

2021-10-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Agree with Tim.

The idea of optimizing stack manipulation operations for constants is 
interesting, but is it common enough case to justify the compiler complication?

See also rejected issue27236.

--
nosy: +serhiy.storchaka

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



[issue45311] Threading Semaphore and BoundedSemaphore release method implementation improvement

2021-10-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This code was added in bpo-10978. Raymond, what are your thoughts?

--
nosy: +rhettinger
versions: +Python 3.11 -Python 3.9

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



[issue30076] Opcode names BUILD_MAP_UNPACK_WITH_CALL and BUILD_TUPLE_UNPACK_WITH_CALL are too long

2021-10-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Sure.

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

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



[issue37295] Possible optimizations for math.comb()

2021-10-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

And with optimization of math.perm() for small arguments:

$ ./python -m pyperf timeit -s 'from math import perm' 'perm(30, 14)'
Mean +- std dev: 524 ns +- 43 ns -> 66.7 ns +- 4.6 ns: 7.85x faster

$ ./python -m pyperf timeit -s 'from math import perm' 'perm(31, 14)'
Mean +- std dev: 522 ns +- 26 ns -> 127 ns +- 6 ns: 4.09x faster

$ ./python -m pyperf timeit -s 'from math import perm' 'perm(568, 7)'
Mean +- std dev: 318 ns +- 19 ns -> 62.9 ns +- 3.7 ns: 5.05x faster

$ ./python -m pyperf timeit -s 'from math import perm' 'perm(569, 7)'
Mean +- std dev: 311 ns +- 14 ns -> 114 ns +- 7 ns: 2.73x faster

$ ./python -m pyperf timeit -s 'from math import perm' 'perm(63, 31)'
Mean +- std dev: 1.36 us +- 0.08 us -> 263 ns +- 14 ns: 5.17x faster

$ ./python -m pyperf timeit -s 'from math import perm' 'perm(111, 15)'
Mean +- std dev: 595 ns +- 27 ns -> 126 ns +- 7 ns: 4.71x faster

--
versions: +Python 3.8, Python 3.9 -Python 3.11

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



[issue45436] test_tk.test_configure_type() fails with Tcl/Tk 8.6.11

2021-10-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +27366
pull_request: https://github.com/python/cpython/pull/28986

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



[issue45436] test_tk.test_configure_type() fails with Tcl/Tk 8.6.11

2021-10-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +27365
pull_request: https://github.com/python/cpython/pull/29003

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



[issue37295] Possible optimizations for math.comb()

2021-10-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +27356
pull_request: https://github.com/python/cpython/pull/29090

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



[issue37295] Possible optimizations for math.comb()

2021-10-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Divide-and-conquer approach works pretty well for larger n.

For results slightly out of the 64-bit range:

$ ./python -m pyperf timeit -s 'from math import comb' 'comb(63, 31)'
Mean +- std dev: 2.80 us +- 0.14 us -> 388 ns +- 19 ns: 7.22x faster

$ ./python -m pyperf timeit -s 'from math import comb' 'comb(111, 15)'
Mean +- std dev: 1.24 us +- 0.06 us -> 215 ns +- 18 ns: 5.76x faster

$ ./python -m pyperf timeit -s 'from math import comb' 'comb(1450, 7)'
Mean +- std dev: 654 ns +- 45 ns -> 178 ns +- 13 ns: 3.67x faster

$ ./python -m pyperf timeit -s 'from math import comb' 'comb(3329023, 3)'
Mean +- std dev: 276 ns +- 15 ns -> 175 ns +- 11 ns: 1.58x faster


For very large n:

$ ./python -m pyperf timeit 'from math import comb' 'comb(2**100, 2**10)'
Mean +- std dev: 26.2 ms +- 1.7 ms -> 3.21 ms +- 0.20 ms: 8.16x faster

$ ./python -m pyperf timeit 'from math import comb' 'comb(2**1000, 2**10)'
Mean +- std dev: 704 ms +- 15 ms -> 103 ms +- 5 ms: 6.85x faster


And it is faster than using factorial:

$ ./python -m pyperf timeit -s 'from math import comb' 'comb(100_000, 50_000)'
Mean +- std dev: 1.61 sec +- 0.02 sec -> 177 ms +- 9 ms: 9.12x faster

$ ./python -m pyperf timeit -s 'from math import factorial as fact' 
'fact(100_000) // (fact(50_000)*fact(50_000))'
Mean +- std dev: 507 ms +- 20 ms


math.perm() can benefit from reusing the same code:

$ ./python -m pyperf timeit -s 'from math import perm' 'perm(63, 31)'
Mean +- std dev: 1.35 us +- 0.07 us -> 1.18 us +- 0.06 us: 1.15x faster

$ ./python -m pyperf timeit -s 'from math import perm' 'perm(111, 15)'
Mean +- std dev: 601 ns +- 35 ns -> 563 ns +- 28 ns: 1.07x faster

$ ./python -m pyperf timeit -s 'from math import perm' 'perm(2**100, 2**10)'
Mean +- std dev: 5.96 ms +- 0.29 ms -> 2.32 ms +- 0.12 ms: 2.57x faster

$ ./python -m pyperf timeit -s 'from math import perm' 'perm(2**1000, 2**10)'
Mean +- std dev: 486 ms +- 14 ms -> 95.7 ms +- 4.2 ms: 5.08x faster

$ ./python -m pyperf timeit -s 'from math import perm' 'perm(100_000, 50_000)'
Mean +- std dev: 639 ms +- 23 ms -> 66.6 ms +- 3.2 ms: 9.60x faster


Even in worst cases it is almost as fast as factorial:

$ ./python -m pyperf timeit -s 'from math import perm' 'perm(100_000, 100_000)'
Mean +- std dev: 2.55 sec +- 0.02 sec -> 187 ms +- 8 ms: 13.66x faster

$ ./python -m pyperf timeit -s 'from math import factorial' 'factorial(100_000)'
Mean +- std dev: 142 ms +- 7 ms

--

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



[issue45535] Enum's dir() does not contain inherited members

2021-10-20 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

For example:

>>> from enum import *
>>> class E(IntEnum):
... x = 1
... 
>>> dir(E)
['__class__', '__doc__', '__members__', '__module__', 'x']
>>> E.from_bytes

>>> E.to_bytes

>>> E.numerator

>>> E.__add__


There are methods and attributes inherited from int, but they are not shown in 
dir(). As result they are absent in help() and completion does not work for 
them.

--
components: Library (Lib)
messages: 404420
nosy: barry, eli.bendersky, ethan.furman, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Enum's dir() does not contain inherited members
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

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



[issue45531] field "mro" behaves strangely in dataclass

2021-10-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

In Enum it is just implicitly forbidden:

>>> from enum import *
>>> class A(Enum):
...   mro = 1
...   x = 2
... 
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/serhiy/py/cpython/Lib/enum.py", line 430, in __new__
raise ValueError('Invalid enum member name: {0}'.format(

ValueError: Invalid enum member name: mro

--
nosy: +serhiy.storchaka

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



[issue45459] Limited API support for Py_buffer

2021-10-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

That would be an unfair advantage. If we want people to use the limited API we 
should not make it much slower than the non-limited API.

--

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



[issue45459] Limited API support for Py_buffer

2021-10-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I do not like requirement to allocate Py_buffer on the heap. It adds an 
overhead. Common case in CPython code is:

Py_buffer view;
void *buf;
Py_ssize_t len;

PyObject_GetBuffer(obj, , PyBUF_SIMPLE);
buf = view.buf;
len = view.len;
// no other fields are used
PyBuffer_Release();

And I want to keep it as simple and efficient as it can be.

--

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



[issue45500] Rewrite test_dbm

2021-10-20 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Thanks Łukasz and Dong-hee Na.

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

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



[issue45436] test_tk.test_configure_type() failed on x86 Gentoo Non-Debug with X 3.x

2021-10-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue19459] Python does not support the GEORGIAN-PS charset

2021-10-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Possible solutions (they can be combined):

1. Add support for the GEORGIAN-PS charset and all other encodings used in libc 
(issue22679). The problem is that it is difficult to get the official 
information about these encodings.

2. Falls back to utf-8 or ascii+surrogateescape in case of unsupported locale 
encoding. But typos can slip unnoticed.

--

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



[issue45459] Limited API support for Py_buffer

2021-10-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Py_buffer is often used for handling arguments if the function supports bytes, 
bytearray and other bytes-like objects. For example bytes.partition(). Any 
additional memory allocation would add significant overhead here. bytes.join() 
creates Py_buffer for every item, it would be a deoptimization if it would need 
to allocate them all separately.

We should allow to allocate Py_buffer on stack. Currently it has too complex 
structure and we cannot guarantee its stability (although there were no changes 
for years). I propose to split Py_buffer on transparent and opaque parts and 
standardize the transparent structure. It should include: obj, buf, len, 
possible flags (to distinguish read-only from writeable) and a pointer to 
opaque data. For bytes, bytearray, BytesIO, mmap and most other classes the 
pointer to opaque data is NULL. For array and memoryview objects the opaque 
data could be embedded into the object.

--
nosy: +skrah

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



[issue37295] Possible optimizations for math.comb()

2021-10-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Microbenchmarks:

$ ./python -m pyperf timeit -s 'from math import comb' '[comb(n, k) for n in 
range(63) for k in range(n+1)]'
Mean +- std dev: 1.57 ms +- 0.07 ms -> 209 us +- 11 us: 7.53x faster

$ ./python -m pyperf timeit -s 'from math import comb' 'comb(62, 31)'
Mean +- std dev: 2.95 us +- 0.14 us -> 296 ns +- 11 ns: 9.99x faster

$ ./python -m pyperf timeit -s 'from math import comb' 'comb(110, 15)'
Mean +- std dev: 1.33 us +- 0.06 us -> 95.8 ns +- 3.1 ns: 13.86x faster

$ ./python -m pyperf timeit -s 'from math import comb' 'comb(1449, 7)'
Mean +- std dev: 689 ns +- 33 ns -> 59.0 ns +- 3.2 ns: 11.69x faster

$ ./python -m pyperf timeit -s 'from math import comb' 'comb(3329022, 3)'
Mean +- std dev: 308 ns +- 19 ns -> 57.2 ns +- 4.2 ns: 5.39x faster

Now I want to try to optimize for larger arguments. Perhaps using recursive 
formula C(n, k) = C(n, j)*C(n-j, k-j)//C(k, j) where j=k//2 could help.

--

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



[issue45452] Support crash tolerance feature for gdbm module

2021-10-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The main concern is that it is not clear how to use this feature, and if it is 
not clear, it will not be used. I am not even sure that it is Pythonic, because 
I do not know how to use it. For example, can it be used to implement 
transactions? How it works with multithreading and multiprocessing if works at 
all? Does it restore after failure automatically or needs some user's action? 
And how do user can know that some actions are required?

--

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



[issue37295] Possible optimizations for math.comb()

2021-10-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Here is more optimized PR inspired by PR 29020. It would be too long to explain 
how PR 29020 can be improved, so I write a new PR.

Basically it implements Raymond's idea #1, but supports n>62 for smaller k.

How to calculate limits:

import math
n = m = 2**64
k = 1
while True:
nmax = int(math.ceil((m * math.factorial(k-1)) ** (1/k) + (k-1)/2)) + 100
n = min(n, nmax)
while math.comb(n, k) * k >= m:
n -= 1
if n < 2*k: break
print(k, n)
k += 1

--
versions: +Python 3.11 -Python 3.8, Python 3.9

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



[issue37295] Possible optimizations for math.comb()

2021-10-18 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +27302
pull_request: https://github.com/python/cpython/pull/29030

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



[issue42222] Modernize integer test/conversion in randrange()

2021-10-18 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +27294
pull_request: https://github.com/python/cpython/pull/29021

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



[issue45229] Always use unittest for collecting tests in regrtests

2021-10-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset b3f0ceae919c1627094ff628c87184684a5cedd6 by Serhiy Storchaka in 
branch 'main':
bpo-45229: Make test_http_cookiejar discoverable (GH-29004)
https://github.com/python/cpython/commit/b3f0ceae919c1627094ff628c87184684a5cedd6


--

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



[issue45229] Always use unittest for collecting tests in regrtests

2021-10-17 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +27286
pull_request: https://github.com/python/cpython/pull/29004

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



[issue45229] Always use unittest for collecting tests in regrtests

2021-10-17 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
dependencies: +Rewrite test_dbm

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



[issue45229] Always use unittest for collecting tests in regrtests

2021-10-17 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
dependencies: +Fix test_shelve and make it discoverable

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



[issue45502] Fix test_shelve and make it discoverable

2021-10-17 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue45502] Fix test_shelve and make it discoverable

2021-10-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Also it was only tested with pickle protocols 0, 1 and 2. Now it will be tested 
with all pickle protocols.

--

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



[issue45502] Fix test_shelve and make it discoverable

2021-10-17 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

test_shelve was intended to run some tests for all underlying dbm 
implementation, but since b17acad68ea21c60dbc2088644f2934032304628 (at May 
2008) it runs them with the same implementation.

The proposed PR fixes this regression and also makes test_shelve discoverable, 
so it can be run with the unittest module.

--
components: Tests
messages: 404133
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Fix test_shelve and make it discoverable
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

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



[issue45500] Rewrite test_dbm

2021-10-17 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue45500] Rewrite test_dbm

2021-10-17 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

* Generate test classes at import time. It allows to filter them when run with 
unittest. E.g: "./python -m unittest test.test_dbm.TestCase_gnu -v".
* Create a database class in a new directory which will be removed after test. 
It guarantees that all created files and directories be removed and will not 
conflict with other dbm tests.
* Restore dbm._defaultmod after tests. Previously it was set to the last dbm 
module (dbm.dumb) which affected other tests.
* Enable the whichdb test for dbm.dumb.
* Move test_keys to the correct test class. It does not test whichdb().
* Remove some outdated code and comments.

--
components: Tests
messages: 404131
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Rewrite test_dbm
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.9

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



[issue38605] [typing] PEP 563: Postponed evaluation of annotations: enable it by default in Python 3.11

2021-10-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think it would help if we could enable some future feature globally by 
command line option or environment variable, without modifying all source 
files. It would allow users to quickly test their code base for compatibility 
with future changes. The problem currently is that nobody bothers to add "from 
__future__ import ...", so we have surprises every time when try to make it by 
default.

A tool which automatically adds or removes "from __future__ import ..." in 
files could help too.

--

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



[issue45497] Argparse: Refactor '%' interpolation to f-strings

2021-10-16 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Pure cosmetic changes are usually rejected.

--
nosy: +serhiy.storchaka

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



[issue45496] Tkinter: test_winfo_rgb failure

2021-10-16 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

And on what of them it is failed?

--

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



[issue45229] Always use unittest for collecting tests in regrtests

2021-10-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +27272
pull_request: https://github.com/python/cpython/pull/28986

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



[issue43139] test_ttk test_compound, test_tk test_type fail with Tk 8.6.11.1

2021-10-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See PR 6578. We already faced a similar problem when test_winfo_rgb was added. 
We finally found test colors which behave consistently on all tested platforms. 
But it turns out that not on all.

--

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



[issue32596] Lazy import concurrent.futures.process and thread

2021-10-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thank you Inada-san. My first intention when I seen this code was to simplify 
it, but then I have found that it was an intentional change.

It may be easy to detect such code and raise a syntax warning or error. Or get 
rid of this limitation and allow globals officially here.

--

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



[issue44977] Deprecate delegation of int to __trunc__

2021-10-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
components: +Interpreter Core
stage:  -> needs patch
title: Deprecate delegation of int to __trunc__? -> Deprecate delegation of int 
to __trunc__
versions: +Python 3.11

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



[issue45428] py_compile fails to read filenames from stdin

2021-10-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thank you for your contribution Graham.

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

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



[issue32596] Lazy import concurrent.futures.process and thread

2021-10-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What are issues with using global variable as import target?

--
nosy: +serhiy.storchaka

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



[issue45428] py_compile fails to read filenames from stdin

2021-10-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 59a633d3e2071d65aa6638da5cf767a5c1310271 by Graham Inggs in 
branch 'main':
bpo-45428: Fix reading filenames from stdin in py_compile (GH-28848)
https://github.com/python/cpython/commit/59a633d3e2071d65aa6638da5cf767a5c1310271


--
nosy: +serhiy.storchaka

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



[issue45462] Speed up re.match with pre-compiled patterns

2021-10-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

For reference, caching was introduced in 
b1aa19515ffdb84c6633ee0344196fd8bd50ade0 21 years ago, and initially it checked 
for pre-compiled patterns before looking up in the cache. But it was changed 2 
months later in 7898c3e6852565046a9b8b063d35d66777bf5176 and since then the 
cache was checked first. There was no explicit note about this in commit 
message, but I think that it was done to speed up the common case.

There were many changes in the caching mechanism, but this part of logic was 
left unchanged. Maybe if once we implement fast dispatch by the type of the 
first argument we reconsider this code.

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

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



[issue45462] Speed up re.match with pre-compiled patterns

2021-10-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

And compare it with pat.match("asdf").

If the performance is critical, use methods of pre-compiled patterns.

--

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



[issue44105] tempfile.TemporaryDirectory deleted after sleep in threads

2021-10-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue45467] Fix incremental decoder and stream reader in the "raw-unicode-escape" codec

2021-10-14 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue45472] Add public C API for partial "unicode-escape" and "raw-unicode-escape" decoding

2021-10-14 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue45472] Add public C API for partial "unicode-escape" and "raw-unicode-escape" decoding

2021-10-14 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

The proposed PR adds C API functions PyUnicode_DecodeUnicodeEscapeStateful() 
and PyUnicode_DecodeRawUnicodeEscapeStateful() for partially decoding with 
"unicode-escape" and "raw-unicode-escape" encodings. It were the only multibyte 
text codecs which did not provide such interface.

They are neccessary for correct implementation of increment decoders and stream 
 readers (see issue45461 and issue45467).

--
components: Unicode
messages: 403932
nosy: ezio.melotti, lemburg, serhiy.storchaka, vstinner
priority: normal
severity: normal
status: open
title: Add public C API for partial "unicode-escape" and "raw-unicode-escape" 
decoding
type: enhancement
versions: Python 3.11

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



[issue45467] Fix incremental decoder and stream reader in the "raw-unicode-escape" codec

2021-10-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 684860280687561f6312e206c4ccfbe4baa17e89 by Serhiy Storchaka in 
branch '3.9':
bpo-45467: Fix IncrementalDecoder and StreamReader in the "raw-unicode-escape" 
codec (GH-28944) (GH-28953)
https://github.com/python/cpython/commit/684860280687561f6312e206c4ccfbe4baa17e89


--

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



[issue45467] Fix incremental decoder and stream reader in the "raw-unicode-escape" codec

2021-10-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 4641afef661e6a22bc64194bd334b161c95edfe2 by Serhiy Storchaka in 
branch '3.10':
[3.10] bpo-45467: Fix IncrementalDecoder and StreamReader in the 
"raw-unicode-escape" codec (GH-28944) (GH-28952)
https://github.com/python/cpython/commit/4641afef661e6a22bc64194bd334b161c95edfe2


--

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



[issue45462] Speed up re.match with pre-compiled patterns

2021-10-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Calling re.math() with a pre-compiled pattern is an uncommon case. Common cases 
are calling re.math() with a string pattern and calling the math() method of a 
pre-compiled pattern.

Your change speeds up an uncommon case but slows down a common case.

--
nosy: +serhiy.storchaka

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



[issue45461] UnicodeDecodeError: 'unicodeescape' codec can't decode byte 0x5c in position 8191: \ at end of string

2021-10-14 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue45452] Support crash tolerance feature for gdbm module

2021-10-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Examples of using the new feature.

--

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



[issue45467] Fix incremental decoder and stream reader in the "raw-unicode-escape" codec

2021-10-14 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +27241
pull_request: https://github.com/python/cpython/pull/28953

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



[issue45467] Fix incremental decoder and stream reader in the "raw-unicode-escape" codec

2021-10-14 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +27240
pull_request: https://github.com/python/cpython/pull/28952

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



[issue45467] Fix incremental decoder and stream reader in the "raw-unicode-escape" codec

2021-10-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 39aa98346d5dd8ac591a7cafb467af21c53f1e5d by Serhiy Storchaka in 
branch 'main':
bpo-45467: Fix IncrementalDecoder and StreamReader in the "raw-unicode-escape" 
codec (GH-28944)
https://github.com/python/cpython/commit/39aa98346d5dd8ac591a7cafb467af21c53f1e5d


--

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



[issue45461] UnicodeDecodeError: 'unicodeescape' codec can't decode byte 0x5c in position 8191: \ at end of string

2021-10-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 7c722e32bf582108680f49983cf01eaed710ddb9 by Serhiy Storchaka in 
branch '3.9':
[3.9] bpo-45461: Fix IncrementalDecoder and StreamReader in the 
"unicode-escape" codec (GH-28939) (GH-28945)
https://github.com/python/cpython/commit/7c722e32bf582108680f49983cf01eaed710ddb9


--

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



[issue45461] UnicodeDecodeError: 'unicodeescape' codec can't decode byte 0x5c in position 8191: \ at end of string

2021-10-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 0bff4ccbfd3297b0adf690655d3e9ddb0033bc69 by Miss Islington (bot) 
in branch '3.10':
[3.10] bpo-45461: Fix IncrementalDecoder and StreamReader in the 
"unicode-escape" codec (GH-28939) (GH-28943)
https://github.com/python/cpython/commit/0bff4ccbfd3297b0adf690655d3e9ddb0033bc69


--

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



[issue45452] Support crash tolerance feature for gdbm module

2021-10-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Please show examples.

--

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



[issue45452] Support crash tolerance feature for gdbm module

2021-10-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I am interesting how these gdbm_failure_atomic() and gdbm_latest_snapshot() can 
be used in user code. Some real world examples. They look very low-level and 
requiring an additional boilerplate code to be useful if I understand it 
correctly.

--

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



[issue45452] Support crash tolerance feature for gdbm module

2021-10-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

And what's next?

--

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



[issue45452] Support crash tolerance feature for gdbm module

2021-10-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

How would it be used from Python? What are scenarios?

--

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



[issue45461] UnicodeDecodeError: 'unicodeescape' codec can't decode byte 0x5c in position 8191: \ at end of string

2021-10-14 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +27233
pull_request: https://github.com/python/cpython/pull/28945

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



[issue45467] Fix incremental decoder and stream reader in the "raw-unicode-escape" codec

2021-10-14 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue45467] Fix incremental decoder and stream reader in the "raw-unicode-escape" codec

2021-10-14 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
dependencies: +UnicodeDecodeError: 'unicodeescape' codec can't decode byte 0x5c 
in position 8191: \ at end of string

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



[issue45467] Fix incremental decoder and stream reader in the "raw-unicode-escape" codec

2021-10-14 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

Similar to 45461, but with "raw-unicode-escape".

When an incremental decoder gets a part of escape sequence (\u or 
\U) it raises an exception or return a bare "\" if it was the only part 
instead of keeping it until getting the rest. It is exposed in text files 
(io.TextIOWrapper) when reads from the underlying binary stream splits an 
escape sequence between blocks. There is similar issue with stream readers 
(codecs.StreamReader).

--
components: Unicode
messages: 403893
nosy: ezio.melotti, lemburg, serhiy.storchaka, vstinner
priority: normal
severity: normal
status: open
title: Fix incremental decoder and stream reader in the "raw-unicode-escape" 
codec
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

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



[issue45461] UnicodeDecodeError: 'unicodeescape' codec can't decode byte 0x5c in position 8191: \ at end of string

2021-10-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset c96d1546b11b4c282a7e21737cb1f5d16349656d by Serhiy Storchaka in 
branch 'main':
bpo-45461: Fix IncrementalDecoder and StreamReader in the "unicode-escape" 
codec (GH-28939)
https://github.com/python/cpython/commit/c96d1546b11b4c282a7e21737cb1f5d16349656d


--

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



[issue45461] UnicodeDecodeError: 'unicodeescape' codec can't decode byte 0x5c in position 8191: \ at end of string

2021-10-13 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue45461] UnicodeDecodeError: 'unicodeescape' codec can't decode byte 0x5c in position 8191: \ at end of string

2021-10-13 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.8

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



[issue45459] Limited API support for Py_buffer

2021-10-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

ndim is not known before calling PyObject_GetBuffer(), so we will need a new 
API which combines PyObject_GetBuffer() and PyBuffer_New().

--

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



[issue45438] inspect not capturing type annotations created by __class_getitem__

2021-10-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The cause is that isinstance(list[int], type) returns True. It can cause bugs 
in other parts of the code which test for instance of type. For example:

>>> types.resolve_bases((typing.List[int],))
(, )
>>> types.resolve_bases((list[int],))
(list[int],)

>>> types.prepare_class('A', (int,), {'metaclass': typing.Type[int]})
(typing.Type[int], {}, {})
>>> types.prepare_class('A', (int,), {'metaclass': type[int]})
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/serhiy/py/cpython/Lib/types.py", line 125, in prepare_class
meta = _calculate_meta(meta, bases)
   
  File "/home/serhiy/py/cpython/Lib/types.py", line 139, in _calculate_meta
if issubclass(base_meta, winner):
   ^
TypeError: issubclass() argument 2 cannot be a parameterized generic

>>> @functools.singledispatch
... def g(a): pass
... 
>>> @g.register
... def g2(a: typing.List[int]): pass
... 
Traceback (most recent call last):
  File "", line 2, in 
  File "/home/serhiy/py/cpython/Lib/functools.py", line 863, in register
raise TypeError(

TypeError: Invalid annotation for 'a'. typing.List[int] is not a class.
>>> @g.register(list[int])
... def g2(a): pass
... 
>>> @g.register
... def g3(a: typing.List[int]): pass
... 
Traceback (most recent call last):
  File "", line 2, in 
  File "/home/serhiy/py/cpython/Lib/functools.py", line 863, in register
raise TypeError(

TypeError: Invalid annotation for 'a'. typing.List[int] is not a class.
>>> @g.register
... def g3(a: list[int]): pass
... 

And many other examples, too many to show here.

Was it mistake to make isinstance(list[int], type) returning True?

--

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



[issue45247] [C API] Add explicit support for Cython to the C API

2021-10-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I agree with Mark. Instead of exposing internal details in low-level API we 
should add more high-level API to satisfy concrete needs. It will give us more 
freedom of changing internals in future.

--
nosy: +serhiy.storchaka

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



[issue45459] Limited API support for Py_buffer

2021-10-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

shape is a pointer to array of Py_ssize_t of size ndim. array and memoryview do 
a trick to avoid memory allocation, but _testbuffer.ndarray allocates it 
dynamically in the heap. We can add a small static buffer in Py_buffer to avoid 
additional memory allocation in common cases.

--
nosy: +serhiy.storchaka

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



[issue45458] "\W" pattern with re.ASCII flag is not equivalent to "[^a-zA-Z0-9_]"

2021-10-13 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

It works as expected:

>>> re.sub(r'\W', '', '½ a', 0, re.ASCII)
'a'

You just passed re.ASCII as the count argument, not as the flags argument.

>>> help(re.sub)
Help on function sub in module re:

sub(pattern, repl, string, count=0, flags=0)
Return the string obtained by replacing the leftmost
non-overlapping occurrences of the pattern in string by the
replacement repl.  repl can be either a string or a callable;
if a string, backslash escapes in it are processed.  If it is
a callable, it's passed the Match object and must return
a replacement string to be used.

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

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



[issue45438] inspect not capturing type annotations created by __class_getitem__

2021-10-13 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

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



[issue45452] Support crash tolerance feature for gdbm module

2021-10-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See also issue22035.

--

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



[issue45455] Fill func.__doc__ lazily

2021-10-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

BTW, I think that we spent on issue36521 much more time (especially your time, 
Inada-san) than it deserved. In normal case 3~5% would look not impressive. But 
I do not see any immediate drawbacks of making this change, and I afraid that 
if we do not make it now we will spend more time on discussing issue36521 and 
related ideas.

--

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



[issue45455] Fill func.__doc__ lazily

2021-10-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The behavior difference can be eliminated if make func_set_code() calling 
func_get_doc().

--
nosy: +serhiy.storchaka

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



[issue45456] operator 'pass' in 'if-else' linear expression

2021-10-13 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue45441] Some links in the document is changed

2021-10-12 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue23262] webbrowser module broken with Firefox 36+

2021-10-12 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue45435] delete misleading faq entry about atomic operations

2021-10-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

sort() is atomic, even if GIL is released during executing custom __lt__. It is 
guaranteed that no operations on the list in other threads can affect the 
result of sort().

I do not understand what non-atomic you see in x = L[i]. The value of x is 
determined by values of L and i at the start of the operation. GIL is not 
released during indexing L, and if it is released between indexing and 
assignment, it does not affect the result.

The FAQ answer is specially about built-in types, it is not related to types 
with overwritten __getitem__ etc.

The most questionable examples are dict operations. But even they provide some 
kind of atomacity. But you perhaps need to know internals to understand 
limitations.

We perhaps should explicitly document what non-trivial operations are atomical 
(for example list and dict copying is atomic) and whether atomacity is the part 
of the language specification or CPython implementation detail. In many places 
in the stdlib the code relies on GIL for atomacity.

--

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



[issue45441] Some links in the document is changed

2021-10-12 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :


New changeset b37dc9b3bc9575adc039c6093c643b7ae5e917e1 by 180909 in branch 
'main':
bpo-45441: Update some moved URLs in documentation (GH-28861)
https://github.com/python/cpython/commit/b37dc9b3bc9575adc039c6093c643b7ae5e917e1


--
nosy: +serhiy.storchaka

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



[issue42253] xml.dom.minidom.rst missing standalone documentation

2021-10-12 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 47a50fe16f9f074d3e6aa85e76502955ed40 by Miss Islington (bot) 
in branch '3.10':
bpo-45401: Fix a resource warning in test_logging (GH-28864) (GH-28872)
https://github.com/python/cpython/commit/47a50fe16f9f074d3e6aa85e76502955ed40


--

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



[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset faa87f7f3b60f79b9018aaef0efa5e00d82b817b by Miss Islington (bot) 
in branch '3.9':
bpo-45401: Fix a resource warning in test_logging (GH-28864) (GH-28873)
https://github.com/python/cpython/commit/faa87f7f3b60f79b9018aaef0efa5e00d82b817b


--

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



[issue42253] xml.dom.minidom.rst missing standalone documentation

2021-10-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 23528905d48ddfe74a75af2152e96c04b77bf314 by Miss Islington (bot) 
in branch '3.9':
bpo-42253: Update xml.dom.minidom.rst (GH-23126) (GH-28875)
https://github.com/python/cpython/commit/23528905d48ddfe74a75af2152e96c04b77bf314


--

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



[issue42253] xml.dom.minidom.rst missing standalone documentation

2021-10-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 3d7009e88e0ae516b10d8d3d402cc66e86fb631e by Miss Islington (bot) 
in branch '3.10':
bpo-42253: Update xml.dom.minidom.rst (GH-23126) (GH-28874)
https://github.com/python/cpython/commit/3d7009e88e0ae516b10d8d3d402cc66e86fb631e


--

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



[issue42253] xml.dom.minidom.rst missing standalone documentation

2021-10-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset c7e81fcf9548ab6a0a4828d6f2db9ece9d204826 by Jens Diemer in branch 
'main':
bpo-42253: Update xml.dom.minidom.rst (GH-23126)
https://github.com/python/cpython/commit/c7e81fcf9548ab6a0a4828d6f2db9ece9d204826


--
nosy: +serhiy.storchaka

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



[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 15188b115a2da815556053372c912a81a74be43b by Serhiy Storchaka in 
branch 'main':
bpo-45401: Fix a resource warning in test_logging (GH-28864)
https://github.com/python/cpython/commit/15188b115a2da815556053372c912a81a74be43b


--

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



[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

With tracemalloc enabled:

$ ./python -X tracemalloc -m test -v test_logging -m test_should_not_rollover
...
test_should_not_rollover (test.test_logging.TimedRotatingFileHandlerTest) ... 
/home/serhiy/py/cpython/Lib/unittest/case.py:547: ResourceWarning: unclosed 
file <_io.TextIOWrapper name='/dev/null' mode='a' encoding='utf-8'>
  if method() is not None:
Object allocated at (most recent call last):
  File "/home/serhiy/py/cpython/Lib/logging/__init__.py", lineno 1205
return open_func(self.baseFilename, self.mode,
ok

--

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



[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

test_should_not_rollover (test.test_logging.TimedRotatingFileHandlerTest) ... 
/home/serhiy/py/cpython/Lib/unittest/case.py:547: ResourceWarning: unclosed 
file <_io.TextIOWrapper name='/dev/null' mode='a' encoding='utf-8'>
  if method() is not None:
ResourceWarning: Enable tracemalloc to get the object allocation traceback
ok

--

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



[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-10 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
status: closed -> open

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



[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-10 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

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



[issue45418] types.UnionType is not subscriptable

2021-10-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

types.UnionType corresponds to typing._UnionGenericAlias, not typing.Union.

We can make (int | str | T)[dict] returning an instance of types.UnionType 
instead of an instance of typing._UnionGenericAlias. But it will be a breaking 
change, because typing._UnionGenericAlias and types.UnionType are different and 
not completely compatible types. We should wait some time before making such 
changes, so all user code will be made supporting both 
typing._UnionGenericAlias and types.UnionType.

If the user code does something special like substituting `int | 
Collection[int]` to `int | list[int]`, it should have some additional ifs in 
any case, otherwise it will not recognize new typing types including 
types.UnionTypes. And subscription does not work in all typing types, we have 
copy_with() for some types and special cases for others in the code of the 
typing module. I am going to unify it finally, but it takes time, my time and 
user's time to migrate to new idioms.

--

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



[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Seems it introduced a resource warning in tests.

--

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



[issue45416] "loop argument must agree with lock" instantiating asyncio.Condition

2021-10-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 1a7892414e654aa5c99efa31db767baba7f4a424 by Joongi Kim in branch 
'main':
bpo-45416: Fix use of asyncio.Condition() with explicit Lock objects (GH-28850)
https://github.com/python/cpython/commit/1a7892414e654aa5c99efa31db767baba7f4a424


--

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



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