Serhiy Storchaka added the comment:
Possible solution: add an ordered subtype of frozenset which would keep an
array of items in the original order. The compiler only creates frozenset when
optimizes "x in {1, 2}" or "for x in {1, 2}". It should now create an ordered
f
Change by Serhiy Storchaka :
--
assignee: -> serhiy.storchaka
versions: +Python 3.11 -Python 3.10, Python 3.7, Python 3.8, Python 3.9
___
Python tracker
<https://bugs.python.org/issu
New submission from Serhiy Storchaka :
_Random.seed() is called twice: first it is called in _Random.__new__(), then
it is called in Random.__init__(). By default it reads system enthropy, so it
consumes global system resource without need.
--
components: Extension Modules
messages
New submission from Serhiy Storchaka :
Non-integer numbers in GNUTranslations.ngettext() are deprecated since 3.7 (see
issue28692 for rationale). But I forget to add deprecation warning for default
implementation (which just tests n == 1) and forget to add the "deprecated"
direct
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +25051
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/26455
___
Python tracker
<https://bugs.python.org/issu
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: test needed -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +25052
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/26456
___
Python tracker
<https://bugs.python.org/issu
Serhiy Storchaka added the comment:
Surprisingly there were almost no tests for keyword arguments in subclasses.
PR 26456 makes checks for some classes (like tuple, list, frozenset) more
strict: if subclass does not define __init__ or __new__, it will reject
arbitrary keyword arguments.
It
Change by Serhiy Storchaka :
--
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue43413>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Serhiy Storchaka :
--
title: asyncio random carsh with longtime run -> asyncio random crash with
longtime run
___
Python tracker
<https://bugs.python.org/issu
Serhiy Storchaka added the comment:
New changeset a6a20658814e8668966fc86de0e80a4772864781 by Serhiy Storchaka in
branch 'main':
bpo-44260: Do not read system entropy without need in Random() (GH-26455)
https://github.com/python/cpython/commit/a6a20658814e8668966fc86de0e80a
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.11
___
Python tracker
<https://bugs.python.or
New submission from Serhiy Storchaka :
Some users can be confused by syntax error message for assigning to ellipsis
[1]:
>>> ... = 1
File "", line 1
... = 1
^^^
SyntaxError: cannot assign to Ellipsis here. Maybe you meant '==' instead of
'=&
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +25071
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/26477
___
Python tracker
<https://bugs.python.org/issu
Change by Serhiy Storchaka :
--
versions: +Python 3.10
___
Python tracker
<https://bugs.python.org/issue44278>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Serhiy Storchaka :
--
resolution: -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder: -> Assigning to Ellipsis should be the same as assigning to
__debug__
___
Python tracker
<https://
Change by Serhiy Storchaka :
--
keywords: +patch
nosy: +serhiy.storchaka
nosy_count: 2.0 -> 3.0
pull_requests: +25072
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/26477
___
Python tracker
<https://bugs.p
Serhiy Storchaka added the comment:
Ah, there is a difference between debug and regular builds. I tested with the
debug build.
--
components: +Interpreter Core -Windows
nosy: +ncoghlan, vstinner -paul.moore, steve.dower, tim.golden, zach.ware
versions: +Python 3.10, Python 3.11
Serhiy Storchaka added the comment:
This is a full duplicate of issue19859. Both ideas of using weak references and
changing documentation were rejected.
--
nosy: +serhiy.storchaka
resolution: -> duplicate
superseder: -> functools.lru_cache keeps objects alive f
Change by Serhiy Storchaka :
--
nosy: +christian.heimes
versions: +Python 3.11 -Python 3.10
___
Python tracker
<https://bugs.python.org/issue44309>
___
___
Pytho
Serhiy Storchaka added the comment:
What is the problem with this?
Setting __slots__ is needed if we want to save memory for creating a lot of
instances. It can also be used for preventing adding arbitrary attributes
and/or making weak references. Setting __slots__ in base class is required
Change by Serhiy Storchaka :
--
title: insttall module faid on wondows 10 -> install module fail on windows 10
___
Python tracker
<https://bugs.python.org/issu
Serhiy Storchaka added the comment:
See also issue43833.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue44317>
___
___
Python-bug
Serhiy Storchaka added the comment:
What about math.pow(0.0, -1.0)? Should it return -inf or raise
ZeroDivisionError?
And what about math.pow(-0.0, -inf)? Should it return inf, -inf or nan or raise
an exception?
--
nosy: +serhiy.storchaka
New submission from Serhiy Storchaka :
See also issue27353.
--
nosy: +lemburg, mark.dickinson, rhettinger, serhiy.storchaka, stutzbach
versions: +Python 3.11 -Python 3.10
___
Python tracker
<https://bugs.python.org/issue44
Serhiy Storchaka added the comment:
Syntax of format strings cannot be the same as in f-strings. {0} means the
first positional argument in format string an integer literal 0 in f-string.
{a[x]} means the value of literal string key "x" of keyword argument a in
format string, an
Serhiy Storchaka added the comment:
I am surprised that this was not proposed before. Perhaps because it is so easy
to write x**(1/3), and if you want a real root of negative argument, it is
-(-x)**(1/3). It can be slightly less accurate that the result of C library
function cbrt(), but
Serhiy Storchaka added the comment:
Is it because exponentiation becomes slower or because multiplication becomes
faster? What are absolute numbers?
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue44
Serhiy Storchaka added the comment:
Only pattern beginning with a dot can match filename beginning with a dot.
>From https://docs.python.org/3/library/glob.html
Note that unlike fnmatch.fnmatch(), glob treats filenames beginning with a
dot (.) as special cases.
This phrase was added
Change by Serhiy Storchaka :
--
nosy: +nailor, petri.lehtinen
___
Python tracker
<https://bugs.python.org/issue44380>
___
___
Python-bugs-list mailing list
Unsub
Serhiy Storchaka added the comment:
It is because you run the code in IDLE.
print(tempList) converts argument to string and write it to sys.stdout. In IDLE
sys.stdout is a proxy object which uses RPC to communicate with the IDLE
process which should insert the written text in the console
Serhiy Storchaka added the comment:
The idea of math.ieee754_total_order looks interesting, but how would it work
with min/max?
In
https://grouper.ieee.org/groups/msc/ANSI_IEEE-Std-754-2019/background/minNum_maxNum_Removal_Demotion_v3.pdf
there is a comparison of several standards and
Serhiy Storchaka added the comment:
>>> math.sqrt(2.5) == 2.5**0.5
True
>>> math.sqrt(25.25) == 25.25**0.5
True
If we test the precision of math.sqrt(), would not be better to test it with
data for which naive way of calculating the root returns different result? For
e
Serhiy Storchaka added the comment:
65733 and 262694 are integers in range 1..100 with largest relative errors
of naive square root (with different signs).
33031 and 524557 are integers in range 1..100 with largest relative errors
of naive cube root (with different signs
Serhiy Storchaka added the comment:
Maybe add two key functions for making NaN either the smallest or the largest
number?
min(1, NAN, key=nan_is_smallest) -> NAN
max(1, NAN, key=nan_is_smallest) -> 1
sorted([1, NAN, 2], key=nan_is_smallest) -> [NAN, 1, 2]
min(1, NAN, key=nan_is_larg
Serhiy Storchaka added the comment:
There is an error in the Python implementation of Decimal.__hash__. It calls
super().__hash__(), but the C implementation calls object.__hash__().
Also, the documentation for floating point hash has the same error.
--
stage: resolved ->
sta
Change by Serhiy Storchaka :
--
pull_requests: +25265
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/26679
___
Python tracker
<https://bugs.python.org/issu
Serhiy Storchaka added the comment:
It is difficult to deprecate getrandbits() because it is one of two base
methods. All Random methods call either getrandbits() or randome(). Overriding
them is a way to make a new random generator.
--
nosy: +serhiy.storchaka
Serhiy Storchaka added the comment:
This is a duplicate of issue21011.
We cannot change this because it breaks C API.
--
nosy: +serhiy.storchaka
resolution: -> wont fix
stage: patch review -> resolved
status: open -> closed
superseder: -> PyArg_ParseTupleAndKeywords
Serhiy Storchaka added the comment:
New changeset 9f1c5f6e8af6ba3f659b2aea1e221ac9695828ba by Serhiy Storchaka in
branch 'main':
bpo-43475: Fix the Python implementation of hash of Decimal NaN (GH-26679)
https://github.com/python/cpython/commit/9f1c5f6e8af6ba3f659b2aea1e221a
Serhiy Storchaka added the comment:
As for randbool() I concur with Steven. It is too trivial and in most case you
do not even need to call bool().
Alternate methods:
choice((False, True))
random() < 0.5
They are less efficient than getrandbits(1), but can be easily extended
Serhiy Storchaka added the comment:
I often use the command-line interface of dis, ast, and sometimes tokenize
modules. They are mature enough and not only for self-testing. If they are not
documented, we need to document them.
Since they read from stdin by default (no need to specify /dev
Serhiy Storchaka added the comment:
How common match-case statements with literal integers? I expect that in most
cases such magic numbers are not used directly, but as named constants.
--
nosy: +serhiy.storchaka
___
Python tracker
<ht
Serhiy Storchaka added the comment:
> Maybe a new comparator is called for (like PY_EQ_FOR_HASH_COLLECTION), which
> would yield float("nan") equivalent to float("nan") and which should be used
> in hash-set/dict?
It is difficult to do from technical p
Serhiy Storchaka added the comment:
Does this change need to be mentioned in What's New?
--
___
Python tracker
<https://bugs.python.org/issue43475>
___
___
Serhiy Storchaka added the comment:
What is self.logger and how do you run your application? Do you redirect its
stdout and stderr and to where?
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue44
Serhiy Storchaka added the comment:
I do not know what are lib.logger.Log and lib.debugger.Tee, but I guess that
lib.logger.Log() creates a logger which writes to sys.stdout, and
lib.debugger.Tee() is a file-like object which writes to the specified file and
to standard output.
Standard
Serhiy Storchaka added the comment:
I concur with Zachary. If the flow geometry manager be added in Tk we will add
its support in Tkinter. We can even add pure Python implementation for older Tk
versions. But we do not want to risk conflicting with Tk
Serhiy Storchaka added the comment:
See also thread "Order of positional and keyword arguments" on the Python-Dev
mailing list
(https://mail.python.org/archives/list/python-...@python.org/thread/I6AUYV6DVEMP7XVYVDWC62N6PK6FHX3H/).
--
nosy: +serhiy
Serhiy Storchaka added the comment:
I think it would be a useful feature.
But would not be better to make interface similar to interface of standard
Linux command uuidgen? In any case it should support the -h or --help options.
--
nosy: +serhiy.storchaka
Serhiy Storchaka added the comment:
Would not be be better in long term to get rid of irregularities? It would make
the grammar simpler and the documentation clearer.
The only use case of such syntax in wrappers, but they always can be rewritten
in other style, with natural order of
Change by Serhiy Storchaka :
--
versions: +Python 3.11 -Python 3.4, Python 3.5
___
Python tracker
<https://bugs.python.org/issue23316>
___
___
Python-bugs-list m
Serhiy Storchaka added the comment:
Oh, LZMAFile.write() should not use len() directly on input data because it
does not always work correctly with memoryview and other objects supporting the
buffer protocol. It should use memoryview(data).nbytes or data =
memoryview(data).cast('B
Change by Serhiy Storchaka :
--
assignee: -> serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue12022>
___
___
Python-bugs-list mailing list
Un
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +25391
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/26809
___
Python tracker
<https://bugs.python.org/issu
Change by Serhiy Storchaka :
--
nosy: +gvanrossum
___
Python tracker
<https://bugs.python.org/issue12022>
___
___
Python-bugs-list mailing list
Unsubscribe:
Serhiy Storchaka added the comment:
PR 26809 makes "with" and "async with" raising TypeError instead of
AttributeError for wrong types.
--
___
Python tracker
<https://bug
New submission from Serhiy Storchaka :
In Lib/test/test_coroutines.py some tests test that the body of the "asyn with"
statement with bad context manager was not executed by setting a value of a
variable in the body and checking its value after executing.
body_execut
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +25398
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/26817
___
Python tracker
<https://bugs.python.org/issu
Serhiy Storchaka added the comment:
New changeset 5d2b3a0d688cf8a33db3d266c9e7049c13766a4c by Serhiy Storchaka in
branch 'main':
bpo-44469: Fix tests for "async with" with bad object (GH-26817)
https://github.com/python/cpython/commit/5d2b3a0d688cf8a33db3
New submission from Serhiy Storchaka :
For consistency with the "with" statement (see issue12022)
ExitStack.enter_context() should raise TypeError instead of AttributeError if
the argument is not a context manager. Same for
AsyncExitStack.enter_async_context().
--
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +25401
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/26820
___
Python tracker
<https://bugs.python.org/issu
Change by Serhiy Storchaka :
--
dependencies: +AttributeError should report the same details when raised by
lookup_special() as when raised in the REPL
___
Python tracker
<https://bugs.python.org/issue44
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
If no one going to provide documentation changes I propose to close this issue.
--
nosy: +serhiy.storchaka
status: open -> pending
versions: +Python 3.11 -Python 3.6, Python 3.7, Python 3.8
___
Python trac
Change by Serhiy Storchaka :
--
pull_requests: +25408
pull_request: https://github.com/python/cpython/pull/26827
___
Python tracker
<https://bugs.python.org/issue40
Serhiy Storchaka added the comment:
PR 26827 is a draft for float.from_number() and complex.from_number().
--
versions: +Python 3.11 -Python 3.10
___
Python tracker
<https://bugs.python.org/issue40
Serhiy Storchaka added the comment:
Concur with Martin. Most likely it is an OS bug, the same as issue5614.
--
nosy: +serhiy.storchaka
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> Malloc error
New submission from Serhiy Storchaka :
There is possible resource leak in glob on alternate Python implementation
witch do not use reference counting to immediate releasing resources.
It is in the code
names = list(_iterdir(dirname, dir_fd, dironly))
where _iterdir() is a generator
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +25424
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/26843
___
Python tracker
<https://bugs.python.org/issu
New submission from Serhiy Storchaka :
The following example crashes:
class TypeVar:
@property
def __module__(self):
1/0
str | TypeVar()
Output:
Fatal Python error: _Py_CheckSlotResult: Slot | of type type succeeded with an
exception set
Python runtime state: initialized
Serhiy Storchaka added the comment:
New changeset bc6c12c72a9536acc96e7b9355fd69d1083a43c1 by Ma Lin in branch
'main':
bpo-44439: BZ2File.write() / LZMAFile.write() handle buffer protocol correctly
(GH-26764)
https://github.com/python/cpython/commit/bc6c12c72a9536acc96e7b9355fd69
Serhiy Storchaka added the comment:
New changeset adfa1ba398c74720b42f16f06fd3ec0353599fa5 by Ken Jin in branch
'main':
bpo-44483: Fix crash in union object with bad ``__module__`` (GH-26848)
https://github.com/python/cpython/commit/adfa1ba398c74720b42f16f06fd3ec
Serhiy Storchaka added the comment:
New changeset 8bc26d8c9d092840054f57f9b4620de0d40d8423 by Ma Lin in branch
'3.9':
bpo-44439: BZ2File.write()/LZMAFile.write() handle length correctly (GH-26846)
https://github.com/python/cpython/commit/8bc26d8c9d092840054f57f9b4620d
Serhiy Storchaka added the comment:
Thank you for your contribution Ma Lin.
--
components: +Library (Lib)
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
type: -> behavior
versions: +Python 3.10, Python 3.11
Serhiy Storchaka added the comment:
New changeset 01858fbe31e8e0185edfbd3f10172f7c61391c9d by Miss Islington (bot)
in branch '3.10':
bpo-44439: BZ2File.write() / LZMAFile.write() handle buffer protocol correctly
(GH-26764) (GH-26845)
https://github.com/python/cpyt
Serhiy Storchaka added the comment:
New changeset 7e6cad7e303b3991360a0fe332b0d21aa0f6fe5e by Miss Islington (bot)
in branch '3.10':
bpo-44483: Fix crash in union object with bad ``__module__`` (GH-26848)
(GH-26852)
https://github.com/python/cpyt
Serhiy Storchaka added the comment:
Yes, Checking each result individually is a right way. Not only because
performance, but because calling any Python code while an error is set will
cause a crash in debug build and weird bugs in release build. It is better to
return as fast as you have an
Serhiy Storchaka added the comment:
New changeset 5c7940257e1f611e7284fd504887bd29a63d0a94 by Serhiy Storchaka in
branch 'main':
bpo-44482: Fix very unlikely resource leak in glob in non-CPython
implementations (GH-26843)
https://github.com/python/cpyt
Serhiy Storchaka added the comment:
Yes. I added you Guido to the nosy list to attract attention to a general
issue. If the generator owns resources, it should be guaranteed closed. Since
generator do not support the context manager protocol, we need to use closing().
Using generators is
Serhiy Storchaka added the comment:
New changeset 38e021ab90b595945f15c59273c788f2f24053dc by Miss Islington (bot)
in branch '3.10':
bpo-44482: Fix very unlikely resource leak in glob in non-CPython
implementations (GH-26843) (GH-26872)
https://github.com/python/cpyt
Serhiy Storchaka added the comment:
New changeset e9c8f784fa13ea3a51df3b72a498a3896ec9e768 by E-Paine in branch
'main':
bpo-44404: tkinter `after` support callable classes (GH-26812)
https://github.com/python/cpython/commit/e9c8f784fa13ea3a51df3b72a498a3
Serhiy Storchaka added the comment:
It is on borderline between new feature and bugfix (depends on your
interpretation of the documentation), so I decided to backport it to not yet
released 3.10, but not to 3.9 which has been already used for a year.
--
stage: patch review ->
t
Change by Serhiy Storchaka :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> pathlib's relative_to should behave like os.path.relpath
___
Python tracker
<https://bugs.p
Change by Serhiy Storchaka :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> pathlib's relative_to should behave like os.path.relpath
___
Python tracker
<https://bugs.p
Serhiy Storchaka added the comment:
> "and exponentiation and conditional expressions, which group from right to
> left".
LGTM
> "Python evaluates expressions from left to right (except for conditional
> expressions)."
LGTM. It would be nice to add a
Serhiy Storchaka added the comment:
> folding all contiguous LOAD_CONSTs (within some sort of limit ofc) into a
> single tuple load and then adding an UNPACK_SEQUENCE
I already experimented with this in issue33325. It does not worth an effort.
For optimizing calls with constant arg
Change by Serhiy Storchaka :
--
pull_requests: +25489
pull_request: https://github.com/python/cpython/pull/26916
___
Python tracker
<https://bugs.python.org/issue44
Serhiy Storchaka added the comment:
There were some issues with the backporting bot. Seems they were temporary.
Thank you for your contribution E. Paine. For this issue and others.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -&g
Serhiy Storchaka added the comment:
I understand why this problem arose. If you parse an HTTP URL, its path always
starts with "/" if not empty. And you usually want to interpret it as a
relative to some base directory. But lstrip('/') works well here. In any case
y
New submission from Serhiy Storchaka :
In the following example:
def gen():
try:
yield 1
finally:
print('finalize inner')
def func():
try:
for x in gen():
break
finally:
print('finalize outer')
func()
print(&
Serhiy Storchaka added the comment:
New changeset 4861fdaf25f246eb9ee4e8161c15dad26efe895d by Serhiy Storchaka in
branch '3.9':
[3.9] bpo-44482: Fix very unlikely resource leak in glob in non-CPython
implementations (GH-26843). (GH-26916)
https://github.com/python/cpyt
Serhiy Storchaka added the comment:
New changeset ed1076428cca3c8dc7d075c16a575aa390e25fb8 by Miguel Brito in
branch 'main':
bpo-44110: Improve string's __getitem__ error message (GH-26042)
https://github.com/python/cpython/commit/ed1076428cca3c8dc7d075c16a575aa390e25fb8
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: -Python 3.10
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
Thank you for your contribution Miguel.
I decided to not backport this change to 3.10 because the benefit is too small
in comparison with possibility to break someone's tests.
--
___
Python tracker
&
Serhiy Storchaka added the comment:
Sorry, I do not understand what do you mean. The problem is that non-exhausted
asynchronous generators are not finalized until asyncio.run() is finished. This
differs from synchronous generators which are finalized as early as possible
(in CPython
Change by Serhiy Storchaka :
--
versions: +Python 3.11 -Python 3.10
___
Python tracker
<https://bugs.python.org/issue43232>
___
___
Python-bugs-list mailin
Change by Serhiy Storchaka :
--
versions: +Python 3.11 -Python 3.10
___
Python tracker
<https://bugs.python.org/issue43234>
___
___
Python-bugs-list mailin
Serhiy Storchaka added the comment:
If you want to interpret None as an empty string, you can just write
quote_from_bytes(data or b'').
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.o
Serhiy Storchaka added the comment:
Inlined asyncio.run(func()) is roughly equivalent to the following code:
loop = asyncio.new_event_loop()
loop.run_until_complete(func())
loop.run_until_complete(loop.shutdown_asyncgens())
loop.close()
If comment out loop.run_until_complete
1201 - 1300 of 25874 matches
Mail list logo