Serhiy Storchaka added the comment:
I concur with Matthew. I tested several implementations in different
programming languages. Perl, PHP and Java behave the same way as Python. Sed,
awk and Go behave other way. We can argue that one or other way is "better",
but it looks subjecti
Serhiy Storchaka added the comment:
"cannot assign to name" looks wrong. Usually we can assign to name, unless it
is a keyword. And the problem is not that we cannot assign to name (we can),
but that is is an invalid syntax, assignment is a statement, not an expression.
Seems
Serhiy Storchaka added the comment:
I tried to add
| a=NAME '=' {
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(
a, "invalid syntax. Maybe you meant '==' or ':=' instead of '='?") }
| a=bitwise_or '=' {
RAISE
Serhiy Storchaka added the comment:
> Do you see a way to make C functions and Python functions behave the same?
Implement __get__ for C functions.
Of course it is breaking change so we should first emit a warning. It will
force all users to use staticmethod explicitly if they set
Change by Serhiy Storchaka :
--
nosy: +ned.deily, ronaldoussoren
___
Python tracker
<https://bugs.python.org/issue43800>
___
___
Python-bugs-list mailin
Serhiy Storchaka added the comment:
I you declare a method as METH_NOARGS, you would not able to pass any argument
to it.
I concur with Josh. There is nothing wrong here.
--
nosy: +serhiy.storchaka
resolution: -> not a bug
stage: -> resolved
status: open -&g
Serhiy Storchaka added the comment:
It is the same "gotcha" as
>>> math.cos(math.pi/2)
6.123233995736766e-17
You can expect that cos(π/2) is exactly 0, but floating point value math.pi is
only an approximation of the π number. The difference between math.pi and exact
valu
Change by Serhiy Storchaka :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
Good example! Similar issue was discussed on the mailing list 3 years ago
(https://mail.python.org/archives/list/python-...@python.org/thread/D2WPCITHG2LBQAP7DBTC6CY26WQUBAKP/#D2WPCITHG2LBQAP7DBTC6CY26WQUBAKP).
Now with new example it perhaps should be
Serhiy Storchaka added the comment:
Better example:
>>> [0x1for x in (1,2)]
[31]
The code is parsed as [0x1f or x in (1,2)] instead of [0x1 for x in (1,2)] as
you may expect.
--
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
Sure. Thanks for reminder.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Serhiy Storchaka added the comment:
Perhaps MappingProxyType is unhashable by accident. It implements __eq__, and
it makes it unhashable by default. And nobody made request for this feature
before. I think that implementing __hash__ would not make anything wrong
New submission from Serhiy Storchaka :
The purpose of MappingProxyType is to provide a read-only proxy for mapping. It
should not expose the underlying mapping because it would invalidate the
purpose of read-only proxy. But there is a way to do this using comparison
operator:
from types
Serhiy Storchaka added the comment:
But there is an issue with comparison implementation in MappingProxyType (see
issue43838). Resolving that issue can affect the decision about hashability.
There should be always true the following predicate: if x == y then hash(x) ==
hash(y
Change by Serhiy Storchaka :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> Deprecation warnings in test cases
___
Python tracker
<https://bugs.python
Change by Serhiy Storchaka :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> Deprecation warnings in test cases
___
Python tracker
<https://bugs.python
Serhiy Storchaka added the comment:
I considered rewriting this code when touched that files last time (in
issue43083). But PyTuple_SetItem() newer fails in these cases, so I left it as
is to minimize change.
So it is a pure cosmetic change. I am not opposing it
Serhiy Storchaka added the comment:
What is performance impact of this change? I expect that creating a list
incrementally can hurt performance, but how much?
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue43
Serhiy Storchaka added the comment:
Python method is just a thin wrapper around corresponding curses function
(wgetch() in this case). It looks like an issue is in the curses library. We
cannot do anything with it.
--
nosy: +serhiy.storchaka
resolution: -> third party
status: o
Serhiy Storchaka added the comment:
No, I did not mean using msize() or something like. Since memory is managed
outside of Python, we have no a list of allocated blocks.
I meant that we can get the total memory used by the Python process (using
OS-specific methods) and compare it between
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +24190
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/25466
___
Python tracker
<https://bugs.python.org/issu
Serhiy Storchaka added the comment:
PR 25466 makes the tokenizer emitting a deprecation warning if the numeric
literal is followed by one of keywords which are valid after numeric literals.
In future releases it will be changed to syntax warning, and finally to syntax
error.
It is breaking
Serhiy Storchaka added the comment:
There is no issues with lists and strings. "]" clearly ends the list display,
and a quote ends a string literal. The problem with numeric literals is that
they can contain letters, so it is not clear (for human reader) where the
numeric literal
Serhiy Storchaka added the comment:
It would be interesting to test also with the yarl module. It is based on
urlparse and urljoin, but does extra normalization of %-encoding.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.
Serhiy Storchaka added the comment:
The drawback of that recipe of partition() is that it calls predicate twice on
every element. The following implementation calls it only once for every
element:
def partition(pred, iterable):
t1, t2 = tee((bool(pred(x)), x) for x in iterable
Serhiy Storchaka added the comment:
It all works as documented.
https://docs.python.org/3/library/functions.html#round
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue43
Serhiy Storchaka added the comment:
It is correct because it works as documented. Please read the documentation
carefully.
It was intentional change in Python 3. See
https://docs.python.org/3/whatsnew/3.0.html#builtins.
--
___
Python tracker
Serhiy Storchaka added the comment:
We can add a new column for the offset or the index of the error handler. Or
add pseudo-instructions (which do not correspond to any bytecode) at boundaries
of the code with some error handler.
--
___
Python
Serhiy Storchaka added the comment:
Why deepcopy is used at all? It is a very specific feature which should not be
used by default. If you want to make a deep copy of fields, you can call
copy.deepcopy() explicitly.
copy.deepcopy(dataclasses.astuple(obj))
or
dataclasses.astuple
Serhiy Storchaka added the comment:
The problem is not related to dis, but to compile.
--
nosy: +serhiy.storchaka
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> Compiling long expression leads to seg
Serhiy Storchaka added the comment:
Maybe name it Py_TPFLAGS_IMMUTABLETYPE? Just IMMUTABLE can mean that instances
of the type are immutable, but we want to make a type itself immutable.
--
nosy: +serhiy.storchaka
___
Python tracker
<ht
Serhiy Storchaka added the comment:
Is there a full list of types converted to heap types? There may be other
issues related to differences between heap and static types.
1. Static type with tp_new = NULL does not have public constructor, but heap
type inherits constructor from base class
Serhiy Storchaka added the comment:
There is no “expr-without-await-or-async-for” subgrammar, but "await" and
asynchronous comprehensions are invalid in synchronous functions. There should
be similar flag for annotations in
Serhiy Storchaka added the comment:
New changeset 3bb3fb3be09d472a43cdc3d9d9578bd49f3dfb8c by Serhiy Storchaka in
branch 'master':
bpo-43655: Tkinter and IDLE dialog windows are now recognized as dialogs by
window managers on macOS and X Window (#25187)
https://github.com/pyth
Change by Serhiy Storchaka :
--
pull_requests: +24307
pull_request: https://github.com/python/cpython/pull/25588
___
Python tracker
<https://bugs.python.org/issue43
Serhiy Storchaka added the comment:
New changeset b5adc8a7e5c13d175b4d3e53b37bc61de35b1457 by Serhiy Storchaka in
branch 'master':
bpo-43534: Make dialogs in turtle.textinput() and turtle.numinput() transitient
again (GH-24923)
https://github.com/python/cpyt
New submission from Serhiy Storchaka :
Some of methods in the turtle module implicitly use the default root window:
call global mainloop() and create PhotoImage without specifying the master
window. It can cause a problem if multiple root windows are used.
--
components: Library (Lib
Change by Serhiy Storchaka :
--
pull_requests: +24310
pull_request: https://github.com/python/cpython/pull/25591
___
Python tracker
<https://bugs.python.org/issue43
Serhiy Storchaka added the comment:
New changeset face87c94e67ad9c72b9a3724f112fd76c1002b9 by Serhiy Storchaka in
branch 'master':
bpo-42609: Check recursion depth in the AST validator and optimizer (GH-23744)
https://github.com/python/cpython/commit/face87c94e67ad9c72b9a3724f112f
Serhiy Storchaka added the comment:
New changeset 172c0f2752d8708b6dda7b42e6c5a3519420a4e8 by Serhiy Storchaka in
branch 'master':
bpo-39529: Deprecate creating new event loop in asyncio.get_event_loop()
(GH-23554)
https://github.com/python/cpyt
Change by Serhiy Storchaka :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
type: -> enhancement
versions: +Python 3.10
___
Python tracker
<https://bugs.python
Change by Serhiy Storchaka :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> Eval with too high string multiplication crashes newer Python
versions
___
Python tracker
<https://bugs.python
Change by Serhiy Storchaka :
--
keywords: +patch
pull_requests: +24311
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/25591
___
Python tracker
<https://bugs.python.org/issu
Change by Serhiy Storchaka :
--
pull_requests: -24310
___
Python tracker
<https://bugs.python.org/issue43534>
___
___
Python-bugs-list mailing list
Unsubscribe:
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 9a165399aec930f27639dd173426ccc33586662b by Serhiy Storchaka in
branch '3.9':
[3.9] bpo-43655: Tkinter and IDLE dialog windows are now recognized as dialogs
by window managers on macOS and X Window (GH-25187). (GH-25588)
https://
Serhiy Storchaka added the comment:
New changeset 6077efa2b2be17e736d061fe74f933dc616c64b2 by Miss Islington (bot)
in branch '3.8':
[3.9] bpo-43655: Tkinter and IDLE dialog windows are now recognized as dialogs
by window managers on macOS and X Window (GH-25187). (GH-25588) (GH-25
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 8af929fc76f21fb123f6a47cb3ebcf4e5b758dea by Serhiy Storchaka in
branch 'master':
bpo-43534: Fix the turtle module working with multiple root windows (GH-25591)
https://github.com/python/cpython/commit/8af929fc76f21fb123f6a47cb3ebcf
Serhiy Storchaka added the comment:
In Python 3.8 there were only few extension heap types: _curses_panel.panel,
ssl.SSLError, _tkinter.tkapp, _tkinter.Tcl_Obj, _tkinter.tktimertoken and
PyStructSequence types.
The following heap types were added in Python 3.9: posix.DirEntry
Change by Serhiy Storchaka :
--
Removed message: https://bugs.python.org/msg391902
___
Python tracker
<https://bugs.python.org/issue43908>
___
___
Python-bug
Serhiy Storchaka added the comment:
>From Objects/typeobject.c:
/* The condition below could use some explanation.
It appears that tp_new is not inherited for static types
whose base class is 'object'; this seems to be a precaution
Serhiy Storchaka added the comment:
The explaining comment was added in f884b749103bad0724e2e4878cd5fe49a41bd7df.
The code itself is much older. It was originally added in
6d6c1a35e08b95a83dbe47dbd9e6474daff00354, then
weaked in c11e192d416e2970e6a06cf06d4cf788f322c6ea and strengthen in
Serhiy Storchaka added the comment:
It is incomplete. For example arrayiterator did have tp_new = NULL (in other
words, PyArrayIter_Type.tp_new was not set to non-NULL value).
In 3.9:
>>> import array
>>> type(iter(array.array('I')))()
Traceback (most recent c
Serhiy Storchaka added the comment:
Thank you for your work Erlend.
--
___
Python tracker
<https://bugs.python.org/issue43916>
___
___
Python-bugs-list mailin
Serhiy Storchaka added the comment:
I afraid that changing the corresponding code in Objects/typeobject.c will
break existing user code. For now, it is safer to patch every single type
manually. Later we can design a general solution
Serhiy Storchaka added the comment:
I think it is safer to merge apply-to-all.diff, and revert the changes for
individual types if we have reasons to make them mutable.
Correspondingly, for all converted heap types we should set tp_new = NULL
unless they have special tp_new implementation
Serhiy Storchaka added the comment:
test_uninitialised_heap_types.py will need to import unrelited modules (some of
which can be platform depending). And more modules will be added as more types
be converted. I think it is better to add tests for different modules in
corresponding module
Serhiy Storchaka added the comment:
These types were immutable before. If merely making them immutable again makes
tests failing then perhaps there is something wrong with these tests or there
are other bugs which are needed to be fixed
Change by Serhiy Storchaka :
--
pull_requests: +24328
pull_request: https://github.com/python/cpython/pull/25634
___
Python tracker
<https://bugs.python.org/issue42
Serhiy Storchaka added the comment:
>From PEP 307:
listitemsOptional, and new in this PEP.
If this is not None, it should be an iterator (not a
sequence!) yielding successive list items. These list
items will be pickled, and appen
Change by Serhiy Storchaka :
--
components: +Interpreter Core
versions: +Python 3.10, Python 3.9
___
Python tracker
<https://bugs.python.org/issue43947>
___
___
Serhiy Storchaka added the comment:
Alternatively we can make PyType_FromSpec() setting tp_new to NULL if there is
explicit {Py_tp_new, NULL} in slots.
--
___
Python tracker
<https://bugs.python.org/issue43
Serhiy Storchaka added the comment:
It was fixed in issue42282.
--
nosy: +serhiy.storchaka
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> Constant folding is skipped in named expressions
___
Py
Serhiy Storchaka added the comment:
Is it ok to skip tests if it is too hard to write them.
Tests should be decorated with @cpython_only because other Python
implementations can have working constructors for these types. It is an
implementation detail that these types are implemented in C
Serhiy Storchaka added the comment:
I am not sure tests are needed here. Immutability of the type is mainly an
implementation detail. We keep the types immutable because we don't want users
to use the feature of mutating these types. I don't think anything bad will
happen if in s
Serhiy Storchaka added the comment:
Where does functools.update_wrapper() set __defaults__?
--
___
Python tracker
<https://bugs.python.org/issue44003>
___
___
Serhiy Storchaka added the comment:
I meant that I looked up the code of functools.update_wrapper() and did not see
that it sets the __defaults__ attribute.
In your example in msg392643 you use functools.update_wrapper() incorrectly.
The first argument is wrapper, and the second argument is
Change by Serhiy Storchaka :
--
pull_requests: -21763
___
Python tracker
<https://bugs.python.org/issue42095>
___
___
Python-bugs-list mailing list
Unsubscribe:
Serhiy Storchaka added the comment:
Why PR 20784 has been merged? Was not the plan to emit a deprecation warning
first?
--
___
Python tracker
<https://bugs.python.org/issue40
Serhiy Storchaka added the comment:
Sorry, I was confused by Victor's long msg371219.
--
___
Python tracker
<https://bugs.python.org/issue40943>
___
___
Serhiy Storchaka added the comment:
It cannot be 0 if PyUnicode_IS_READY() returns true.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue44
Serhiy Storchaka added the comment:
It was proposed before in issue37884.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue44
Serhiy Storchaka added the comment:
The reason is different. The scandir() iterator should be closed before we go
recursively deep in the directory tree. Otherwise we can reach the limit of
open file descriptors (especially if several glob()s are called in parallel).
See issue22167
Serhiy Storchaka added the comment:
Good catch! The signature of dictkeys_reversed was already fixed (for purity
reason), but the same bug in dictvalues_reversed and dictitems_reversed was
missed. It is nice that such bugs can now be caught by tools.
--
nosy: +serhiy.storchaka
Change by Serhiy Storchaka :
--
type: behavior -> crash
versions: +Python 3.10, Python 3.11, Python 3.8, Python 3.9
___
Python tracker
<https://bugs.python.org/issu
Serhiy Storchaka added the comment:
I do not understand the problem with pickling sentinel values used as default
values for function parameters. Could you please show an example?
--
nosy: +serhiy.storchaka
___
Python tracker
<ht
Serhiy Storchaka added the comment:
I just have merged a change which makes many C-style formatting as fast as
f-strings (issue28307) and am working on supporting more format codes (%d, %x,
%f, etc). Using C-style formatting can be a good option if you want performance
and backward
Change by Serhiy Storchaka :
--
versions: +Python 3.11 -Python 3.10
___
Python tracker
<https://bugs.python.org/issue38693>
___
___
Python-bugs-list mailin
Serhiy Storchaka added the comment:
Should not they be kept for binary compatibility, so you can link with
extensions compiled for older Python versions? They can be removed from
headers, so newly compiled extensions will not be able to use them.
--
nosy: +serhiy.storchaka
Serhiy Storchaka added the comment:
Parameters are not passed to a function. Arguments are passed. And what you
need is just to not pass to the wrapped function arguments which were not
passed to wrapper. *args and **kwargs do not contain arguments which were not
passed.
I understand that
Change by Serhiy Storchaka :
--
pull_requests: +24794
pull_request: https://github.com/python/cpython/pull/26160
___
Python tracker
<https://bugs.python.org/issue28
Change by Serhiy Storchaka :
--
nosy: +Mark.Shannon
versions: +Python 3.11 -Python 3.7
___
Python tracker
<https://bugs.python.org/issue28307>
___
___
Python-bug
Serhiy Storchaka added the comment:
PR 26160 adds support of %d, %i, %u, %o, %x, %X, %f, %e, %g, %F, %E, %G.
What is not supported:
* Formatting with a single value not wrapped into a 1-tuple (like in "%d bytes"
% size). The behavior is non-trivial, it needs checking whether the
Serhiy Storchaka added the comment:
New changeset 925cb85e9e28d69be53db669527c0a1292f0fbfb by Miss Islington (bot)
in branch '3.9':
bpo-44114: Fix dictkeys_reversed and dictvalues_reversed function signatures
(GH-26062) (GH-26093)
https://github.com/python/cpyt
Serhiy Storchaka added the comment:
Are you sure that all characters in Δημοϲθενικοί are upper-case letters?
Because this is what the isupper() method tests.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue44
Serhiy Storchaka added the comment:
What if register Tcl_Finalize as an atexit callback?
--
___
Python tracker
<https://bugs.python.org/issue40452>
___
___
Pytho
Serhiy Storchaka added the comment:
That comment may be outdated. The atexit callbacks are called very early at the
interpreter shutdown stage. The interpreter is still entirely intact at this
point.
--
___
Python tracker
<ht
Serhiy Storchaka added the comment:
It was commented out in
commit 43ff8683fe68424b9c179ee4970bb865e11036d6
Author: Guido van Rossum
Date: Tue Jul 14 18:02:13 1998 +
Temporarily get rid of the registration of Tcl_Finalize() as a
low-level Python exit handler. This can attempt
Serhiy Storchaka added the comment:
Please repeat benchmarking for interned names:
kwargs = {sys.intern("a"*i): None for i in range(1, N+1)}
and for more distinctive names:
kwargs = {sys.intern(f"a{i}"): None for i in range(1, N+1)}
I guess the diffe
Serhiy Storchaka added the comment:
The problem is that such exceptions are often used with the EAFP style. For
example:
while stop is None or i < stop:
try:
v = self[i]
if v is value or v == value:
retur
Serhiy Storchaka added the comment:
BTW, we use different approaches for builtin and Python functions.
* For Python functions: iterate all keyword arguments and search in the list of
keyword parameter names.
* For builtin functions: iterate all keyword parameters and search in the list
of
Serhiy Storchaka added the comment:
There are no problems with exposing _PyArg_ParseStack(). Although I am arguing
that it would be better to rename it to _PyArg_ParseArray.
But _PyArg_ParseStackAndKeywords() is more complicated. It uses a private
structure _PyArg_Parser allocated on the
Change by Serhiy Storchaka :
--
pull_requests: +24913
pull_request: https://github.com/python/cpython/pull/26318
___
Python tracker
<https://bugs.python.org/issue28
Serhiy Storchaka added the comment:
I only seen this idiom in the code of Argument Clinic (written by Larry). I am
sure that it is used in third-party code, but I do not know how common is it.
As for the proposed code, checking that the value is a string is not enough.
1. It can be a str
Serhiy Storchaka added the comment:
"Does not work" is not informative. What did you get and what did you expect to
get? Please proved a complete reproducible example.
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bu
Serhiy Storchaka added the comment:
It is partially an IDLE issue. The code expects that indices in Python string
correspond indices in Tcl string, but this is not true in case of astral
characters which are encoded as 2 (or maybe even 4) characters in Tcl.
To fix it we need to translate
Serhiy Storchaka added the comment:
Well, it works, but the priority of := is lower than priority of other
operators. (x := item.upper() not in "ABC") is interpreted as (x :=
(item.upper() not in "ABC")).
--
resolution: -> not a bug
stage: -> resol
Serhiy Storchaka added the comment:
Go ahead!
--
___
Python tracker
<https://bugs.python.org/issue44235>
___
___
Python-bugs-list mailing list
Unsubscribe:
Serhiy Storchaka added the comment:
There are alternative ideas of parsing API which should be considered:
1. Linearize keyword arguments using _PyArg_UnpackKeywords() and parse the
linear array of arguments with a variant of _PyArg_ParseStack().
2. Parse arguments outside of the user
1101 - 1200 of 25874 matches
Mail list logo