Serhiy Storchaka added the comment:
I think Raymond means extending the tables to TableSize=101. It can benefit
larger arguments if move the code in perm_comb_small(). And perhaps loops in
perm_comb_small() could be optimized by using precalculated values for some
products
Serhiy Storchaka added the comment:
Okay. As a workaround we can explicitly specify the dispatching type:
@f.register(list)
def _(a: list[int]) -> None:
pass
--
resolution: -> rejected
stage: -> resolved
status: open -> closed
__
Serhiy Storchaka added the comment:
New changeset 8d7644fa64213207b8dc6f555cb8a02bfabeced2 by andrei kulakov in
branch 'main':
bpo-45853: Fix misspelling and unused import in pathlib (GH-30292)
https://github.com/python/cpython/commit/8d7644fa64213207b8dc6f555cb8a0
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Serhiy Storchaka :
--
nosy: +vinay.sajip
___
Python tracker
<https://bugs.python.org/issue46200>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Serhiy Storchaka :
--
resolution: -> wont fix
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Serhiy Storchaka :
--
resolution: -> third party
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Serhiy Storchaka :
--
pull_requests: +28518
pull_request: https://github.com/python/cpython/pull/30305
___
Python tracker
<https://bugs.python.org/issue37
Serhiy Storchaka added the comment:
PR 30305 applies Mark's algorithm for larger n (up to 127) depending on k, as
was suggested by Raymond. Note that it uses different table for limits, which
maps k to maximal n.
--
___
Python tracker
&
Serhiy Storchaka added the comment:
I think that the man page should contain all details related to the CLI (and
may be even some examples).
--
___
Python tracker
<https://bugs.python.org/issue46
Serhiy Storchaka added the comment:
There are other issues with the documentation of splitext().
1. It uses term "extension" (it is even a part of function name), but it is
vague and usually does not include a period. On Windows the extension of
"python.exe" is "
Serhiy Storchaka added the comment:
Well, so we can keep term "extension". But I think it is worth to clarify that
"leading periods" is related to the last component, not the whole path. It is
related to the original issue.
--
__
Serhiy Storchaka added the comment:
I think it is better to not change posixpath for now. And it is not necessary.
But shutil.rmtree() needs to support file descriptors, and it is not trivial
issue.
--
___
Python tracker
<https://bugs.python.
New submission from Serhiy Storchaka :
It is necessary in particularly for supporting dir_fd in the tempfile module
(issue25927).
--
components: Library (Lib)
messages: 409599
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Add support for dir_fd in
Change by Serhiy Storchaka :
--
dependencies: +Add support for dir_fd in shutil.rmtree()
___
Python tracker
<https://bugs.python.org/issue25927>
___
___
Pytho
Change by Serhiy Storchaka :
--
pull_requests: +28596
pull_request: https://github.com/python/cpython/pull/30365
___
Python tracker
<https://bugs.python.org/issue46
Serhiy Storchaka added the comment:
I am sorry, I implemented this feature before opening this issue, but due to
typo the PR was not linked here.
--
___
Python tracker
<https://bugs.python.org/issue46
Serhiy Storchaka added the comment:
Is
i, rem = isqrt_rem(n)
i + (rem != 0)
better than
(isqrt(n<<2) + 1) >> 1
or
n and isqrt(n-1) + 1
?
As for use cases, there were few cases in my experience when I needed the
ceiling square root, mostly in simple experiments
Serhiy Storchaka added the comment:
I have also almost finished this issue (only needed to add some tests and docs).
--
___
Python tracker
<https://bugs.python.org/issue25
Change by Serhiy Storchaka :
--
resolution: -> third party
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
My plan was to fix as much bugs in the stdlib and backport workaround to 3.9
and 3.10, then propose to revert this "feature" in 3.11.
There is a risk of introducing some regressions by this change, but we can
handle it. I think it is better to
Serhiy Storchaka added the comment:
Good point. That code was originally added in issue420304 because every
exception raised in PyObject_GetAttr() (including a TypeError for non-string
name) was silenced in hasattr() and 3-argument getattr(). It was changed in
Python 3, so this code
Serhiy Storchaka added the comment:
It was a bug fix. msg320663 states that that issue needs a more complex fix
than provided by the initial patch. And that more complex fix was applied.
It looks to me that this issue is caused by running new tests with old stdlib.
Tests caught a bug in an
Serhiy Storchaka added the comment:
If you are looking for case-insensitive string comparison, look at
locale.strcoll() and locale.strxfrm(). They are locale-aware.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue46
Serhiy Storchaka added the comment:
The CPython source code is irregularly scanned by different code analysis
tools. The results shown extremely high quality of code in comparison with
other open source and proprietary code. Most of reports are false positive.
Last time real bugs (2 or 3
Serhiy Storchaka added the comment:
No, it is a backslash following by a newline.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue46
Serhiy Storchaka added the comment:
A warning is an indication of possible bugs in your code. If you do not close
file explicitly, and it is closed by the garbage collector, the time of closing
is undeterminated. This can lead to exhausting of file descriptors if you have
a lot of opened
Change by Serhiy Storchaka :
--
nosy: +vstinner
___
Python tracker
<https://bugs.python.org/issue46303>
___
___
Python-bugs-list mailing list
Unsubscribe:
Serhiy Storchaka added the comment:
The safe way of using read_lines() is:
lines = read_lines()
try:
# use lines
finally:
lines.close()
or
with contextlib.closing(read_lines()) as lines:
# use lines
And it is in no way better than using "with
Serhiy Storchaka added the comment:
New changeset 2d787971c65b005d0cce219399b9a8e2b70d4ef4 by Serhiy Storchaka in
branch 'main':
bpo-37295: Use constant-time comb() and perm() for larger n depending on k
(GH-30305)
https://github.com/python/cpyt
Serhiy Storchaka added the comment:
Accepting a slice directly in the range constructor is ambiguous. What to do if
start or stop are negative or None? What if stop is less than start? You need
to specify a sequence length to handle these cases.
Maybe the following expressions work for you
Serhiy Storchaka added the comment:
What are the use cases for this feature?
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue46
Serhiy Storchaka added the comment:
The simplest way of collecting template names is to use a defaultdict:
>>> d = collections.defaultdict(str)
>>> string.Template('$a $b').substitute(d)
' '
>>> d.keys()
dict_keys(['a', 'b
Change by Serhiy Storchaka :
--
nosy: +mark.dickinson, rhettinger, stutzbach, tim.peters
___
Python tracker
<https://bugs.python.org/issue46407>
___
___
Pytho
Serhiy Storchaka added the comment:
See msg234768 and issue23325. I propose to close this as a duplicate of
issue23325.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue46
Serhiy Storchaka added the comment:
As Steven have noted the compiler-time optimization is not applicable here
because name frozenset is resolved at run-time.
In these cases where a set of constants can be replaced with a frozenset of
constants (in "x in {1,2,3}" and in "
Serhiy Storchaka added the comment:
New changeset 1292aa6db5bed889a3c87df443754fcae0177801 by Nikita Sobolev in
branch 'main':
bpo-46425: Fix direct invocation of multiple test modules (GH-30666)
https://github.com/python/cpython/commit/1292aa6db5bed889a3c87df443754f
New submission from Serhiy Storchaka :
There is a flaw in tests for the dir_fd argument in test_posix. All these tests
open a current directory as dir_fd, so all paths are relative to the current
directory. They will pass in case of the following errors:
1. dir_fd, src_dir_fd or dst_dir_fd
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +28868
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/30668
___
Python tracker
<https://bugs.python.org/issu
Serhiy Storchaka added the comment:
New changeset 65940fa5c12a4b4a0650c7845044ffd63b94e227 by Kumar Aditya in
branch 'main':
bpo-20823: Clarify copyreg.pickle() documentation (GH-30230)
https://github.com/python/cpython/commit/65940fa5c12a4b4a0650c7845044ff
Serhiy Storchaka added the comment:
New changeset 60ceedbdd5b5fb22803039a59954798d931f659a by Thomas Klausner in
branch 'main':
bpo-46045: Do not use POSIX semaphores on NetBSD (GH-30047)
https://github.com/python/cpython/commit/60ceedbdd5b5fb22803039a59954798d931f659a
-
Serhiy Storchaka added the comment:
New changeset 16bf9bd157c7bf5f9c60414fa8e0fe5047c55a9b by Géry Ogam in branch
'main':
bpo-44024: Improve the TypeError message in getattr and hasattr (GH-25863)
https://github.com/python/cpython/commit/16bf9bd157c7bf5f9c60414fa8e0fe
Serhiy Storchaka added the comment:
Thank you for your contribution Géry.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
All this should be tested with the C implementation because relative cost of
operations is different in C and Python.
I have tested Raymond's idea about using iterative algorithm for small k.
$ ./python -m timeit -s 'from math import comb'
Serhiy Storchaka added the comment:
comb(n, k) can be computed as perm(n, k) // factorial(k).
$ ./python -m timeit -r1 -n1 -s 'from math import comb' "comb(100, 50)"
recursive: 1 loop, best of 1: 9.16 sec per loop
iterative: 1 loop, best of 1: 164 sec per loop
Serhiy Storchaka added the comment:
I share concerns of Inada-san. I also think that keeping a status quo (ignoring
the mapping attribute in typing) is the lesser evil. I am not sure that
exposing this attribute was a good idea. We do not expose attributes list and
index for list iterators
Serhiy Storchaka added the comment:
Arguments of cos() and sin() should be in radians, not in degrees. So the
correct formulas are k*cos(pi/2-pi/k) and k*sin(pi/k). They are useless because
to find the pi approximation you need to know pi.
--
nosy: +serhiy.storchaka
resolution
Serhiy Storchaka added the comment:
Yes, math.radians() just multiplies its argument by pi/180.
And what is your issue?
--
___
Python tracker
<https://bugs.python.org/issue46
Serhiy Storchaka added the comment:
Is device number -1 used in any context (for example as "unknown device
number")?
--
___
Python tracker
<https://bugs.python.o
Serhiy Storchaka added the comment:
It may take a time, because the module initialization code has been completely
rewritten.
--
___
Python tracker
<https://bugs.python.org/issue23
Serhiy Storchaka added the comment:
New changeset 22f73bd9f1fc573d5c998f345b66c29f7ca6614d by Nikita Sobolev in
branch 'main':
bpo-46425: Fix direct invocation of `test_contextlib` (GH-30681)
https://github.com/python/cpython/commit/22f73bd9f1fc573d5c998f345b66c2
Serhiy Storchaka added the comment:
New changeset cfadcc31ea84617b1c73022ce54d4ae831333e8d by andrei kulakov in
branch 'main':
bpo-21987: Fix TarFile.getmember getting a dir with a trailing slash (GH-30283)
https://github.com/python/cpython/commit/cfadcc31ea84617b1c73022ce54d4a
Serhiy Storchaka added the comment:
New changeset 40fcd16889028bd3cd2289e0f8a2af43f17a5824 by Thomas Klausner in
branch 'main':
bpo-30512: Add CAN Socket support for NetBSD (GH-30066)
https://github.com/python/cpython/commit/40fcd16889028bd3cd2289e0f8a2af
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.or
Serhiy Storchaka added the comment:
New changeset 54610bb448a9cf5be77d53b66169fca4c11be6cb by Serhiy Storchaka in
branch 'main':
bpo-46426: Improve tests for the dir_fd argument (GH-30668)
https://github.com/python/cpython/commit/54610bb448a9cf5be77d53b66169fc
Change by Serhiy Storchaka :
--
pull_requests: +28944
pull_request: https://github.com/python/cpython/pull/30757
___
Python tracker
<https://bugs.python.org/issue46
Serhiy Storchaka added the comment:
New changeset a1015c6478e8cbec2ecb984a3cba733783d168b5 by Miss Islington (bot)
in branch '3.10':
bpo-46426: Improve tests for the dir_fd argument (GH-30668) (GH-30739)
https://github.com/python/cpython/commit/a1015c6478e8cbec2ecb984a3cba73
Serhiy Storchaka added the comment:
Why __class_getitem__ was added in PurePath at first place? PurePath should not
be a generic class, unlike to os.PathLike. For os.PathLike the type parameters
represent the returning type of os.fspath() (either str or bytes), but the
pathlib module only
Serhiy Storchaka added the comment:
It is difficult to distinguish Mapping from Sequence because they have the same
set of dunder methods. The difference is only in semantic -- __iter__ yields
items for Sequence and keys for Mapping, __getitem__ gets an item by index (or
a sequence by slice
Serhiy Storchaka added the comment:
New changeset 94d6434ba7ec3e4b154e515c5583b0b665ab0b09 by Miss Islington (bot)
in branch '3.9':
[3.9] bpo-21987: Fix TarFile.getmember getting a dir with a trailing slash
(GH-30283) (GH-30738)
https://github.com/python/cpyt
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.5
___
Python tracker
<https://bugs.python.or
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: -Python 3.10, Python 3.9
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
This module provides a simple way to time small bits of Python code.
What problem are you trying to solve.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue46
Serhiy Storchaka added the comment:
New changeset 3f1ea163ea54513e00e0e9d5442fee1b639825cc by Serhiy Storchaka in
branch '3.9':
[3.9] bpo-46426: Improve tests for the dir_fd argument (GH-30668) (GH-30757)
https://github.com/python/cpython/commit/3f1ea163ea54513e00e0e9d5442fee
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
It is not related to email and asyncio either.
--
components: -asyncio, email
___
Python tracker
<https://bugs.python.org/issue46
Serhiy Storchaka added the comment:
New changeset 82bce54614f8116a40454fbbbf96a3fd460ca7df by Nikita Sobolev in
branch 'main':
bpo-46544: Do not leak `x` and `uspace` in textwrap.TextWrapper (GH-30955)
https://github.com/python/cpython/commit/82bce54614f8116a40454fbbbf96a3
Serhiy Storchaka added the comment:
New changeset ecfacc362dd7fef7715dcd94f2e2ca6c622ef115 by Serhiy Storchaka in
branch 'main':
bpo-44791: Fix substitution of ParamSpec in Concatenate with different
parameter expressions (GH-27518)
https://github.com/python/cpyt
Change by Serhiy Storchaka :
--
pull_requests: +29147
pull_request: https://github.com/python/cpython/pull/30969
___
Python tracker
<https://bugs.python.org/issue44
Serhiy Storchaka added the comment:
PR 27518 fixes a substitution of a ParamSpec variable with a Concatenate nad a
list of types. It is not specified explicitly in PEP 612, but it does not
contradict it.
PR 30969 makes an ellipsis be valid as the last argument of Concatenate to fix
a
Serhiy Storchaka added the comment:
I think it should be closed for the same reasons as #35095. It is not common
enough case to complicate Path.write_text(), and you always can use
open()+write().
--
nosy: +serhiy.storchaka
___
Python tracker
Serhiy Storchaka added the comment:
Usually, when you benchmark a non-trivial piece of code, you need also to
specify a setup code. If the benchmarked code is large enough to be read from a
file, the setup code should be read from a file too.
The common practice is to write the benchmarked
Serhiy Storchaka added the comment:
True is a keyword which is compiled to expression whose value is True, 𝕋𝕣𝕦𝕖 is
an identifier which refers to the builtin variable "True" which has a value
True by default. You can change the value of a builtin variable, but the value
of expre
Change by Serhiy Storchaka :
--
pull_requests: +29195
pull_request: https://github.com/python/cpython/pull/21628
___
Python tracker
<https://bugs.python.org/issue41
Serhiy Storchaka added the comment:
https://docs.python.org/3/library/constants.html#built-in-constants
--
___
Python tracker
<https://bugs.python.org/issue46
Serhiy Storchaka added the comment:
There is nothing wrong with writing two lines of code. And two lines of code
may be more readable than one line of code. New method or parameter has a cost
-- core developers need to maintain it, update documentation and tests if they
conflict with new
Change by Serhiy Storchaka :
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue46615>
___
___
Python-bugs-list mailing list
Unsub
Serhiy Storchaka added the comment:
Concur with Eric and Raymond.
--
nosy: +serhiy.storchaka
resolution: -> not a bug
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
New changeset 0cbdd2131195b0d313762968f604e80a3e65ca9f by Nikita Sobolev in
branch 'main':
bpo-46565: `del` loop vars that are leaking into module namespaces (GH-30993)
https://github.com/python/cpython/commit/0cbdd2131195b0d313762968f604e8
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
New changeset 7ffe7ba30fc051014977c6f393c51e57e71a6648 by Nikita Sobolev in
branch 'main':
bpo-46483: Remove `__class_getitem__` from `pathlib.PurePath` (GH-30848)
https://github.com/python/cpython/commit/7ffe7ba30fc051014977c6f393c51e
Serhiy Storchaka added the comment:
New changeset b4bd1e1422997de61faf506b4916e83013bc7d21 by Zackery Spytz in
branch 'main':
bpo-44977: Deprecate delegation of int to __trunc__ (GH-31031)
https://github.com/python/cpython/commit/b4bd1e1422997de61faf506b4916e8
Serhiy Storchaka added the comment:
Thanks Zackery.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
It does not have a use case of T[int] in mind. It is an implementation detail
which simplifies the code, makes runtime checks more strict and makes
types.GenericAlias more similar to typing._GenericAlias.
For example, currently:
>>> A = List
Serhiy Storchaka added the comment:
See also issue31978.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue46639>
___
___
Python-bug
Serhiy Storchaka added the comment:
I am not convinced. What are examples of using re.match() instead of
re.search()? How common is this type of errors?
There are perhaps many millions of scripts which use re.match(), deprecating
re.match() at any time in future would be very destructive
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Serhiy Storchaka :
--
pull_requests: +29321
pull_request: https://github.com/python/cpython/pull/31143
___
Python tracker
<https://bugs.python.org/issue44
Serhiy Storchaka added the comment:
I have created an alternative PR 31143 which adds special method
__typing_subst__ in TypeVar and ParamSpec instead of __parameters__ and
__getitem__. It has almost the same effect except making TypeVar and ParamSpec
and subscriptable. The Python code in
Serhiy Storchaka added the comment:
There were two reasons of accepting arbitrary callables in _type_check():
1. NewType() returned a function.
2. xml.etree.cElementTree.Element was a function in Python 2.
Now NewType is a class, and Python 2 no longer supported. I agree that we
should get
Change by Serhiy Storchaka :
--
pull_requests: +29332
pull_request: https://github.com/python/cpython/pull/31159
___
Python tracker
<https://bugs.python.org/issue46
Serhiy Storchaka added the comment:
Note that instances of most other types are non-subclassable "by accident".
>>> class A(42): pass
...
Traceback (most recent call last):
File "", line 1, in
TypeError: int() takes at most 2 arguments (3 given)
>>&
Serhiy Storchaka added the comment:
No, List[42] is not currently accepted.
>>> List[42]
Traceback (most recent call last):
File "", line 1, in
File "/home/serhiy/py/cpython/Lib/typing.py", line 318, in inner
return func(*args, **kwds)
Serhiy Storchaka added the comment:
But it gives the same result.
What version of Python do you test with?
--
___
Python tracker
<https://bugs.python.org/issue46
Serhiy Storchaka added the comment:
The test is good. If we accidentally make a TypeVar instance subclassable, it
will catch such error.
--
___
Python tracker
<https://bugs.python.org/issue46
Serhiy Storchaka added the comment:
New changeset c1ff4cb98b11c00aee765019364544c71e7dd2df by Nikita Sobolev in
branch '3.10':
[3.10] bpo-46611: add coverage to instance and class checks in `typing.py`
(GH-31078) (GH-31182)
https://github.com/python/cpyt
Serhiy Storchaka added the comment:
Thanks Nikita.
--
components: +Tests -Library (Lib)
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
It is valid syntax.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue46674>
___
___
Python-bug
Serhiy Storchaka added the comment:
Round division would be useful not less than ceil division, if not more. In the
stdlib it would be used in:
1. The datetime module.
2. Fraction.__round__.
--
___
Python tracker
<https://bugs.python.
Change by Serhiy Storchaka :
--
components: +Extension Modules
nosy: +serhiy.storchaka
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.8
___
Python tracker
<https://bugs.python.org/issue45
101 - 200 of 25874 matches
Mail list logo