[issue43714] re.findall: '\Z' must consume end of string if it matched

2021-04-10 Thread Serhiy Storchaka
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

[issue43797] Improve syntax error for invalid comparisons

2021-04-10 Thread Serhiy Storchaka
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

[issue43797] Improve syntax error for invalid comparisons

2021-04-10 Thread Serhiy Storchaka
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

[issue43682] Make static methods created by @staticmethod callable

2021-04-10 Thread Serhiy Storchaka
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

[issue43800] os.fwalk is not exposed on macOS

2021-04-10 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +ned.deily, ronaldoussoren ___ Python tracker <https://bugs.python.org/issue43800> ___ ___ Python-bugs-list mailin

[issue43824] array.array.__deepcopy__() accepts a parameter of any type

2021-04-13 Thread Serhiy Storchaka
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

[issue43830] (-1) ** 0.5 returns (6.123233995736766e-17+1j) instead of 1j

2021-04-13 Thread Serhiy Storchaka
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

[issue43830] (-1) ** 0.5 returns (6.123233995736766e-17+1j) instead of 1j

2021-04-13 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-04-13 Thread Serhiy Storchaka
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

[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-04-13 Thread Serhiy Storchaka
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

[issue42152] Use PyDict_Contains() and PyDict_SetDefault() instead of PyDict_GetItemWithError()

2021-04-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Sure. Thanks for reminder. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue43829] MappingProxyType cannot hash a hashable underlying mapping

2021-04-14 Thread Serhiy Storchaka
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

[issue43838] There is a way to access an underlying mapping in MappingProxyType

2021-04-14 Thread Serhiy Storchaka
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

[issue43829] MappingProxyType cannot hash a hashable underlying mapping

2021-04-14 Thread Serhiy Storchaka
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

[issue43839] [easy] test_cmd_line: DeprecationWarning: invalid escape sequence \u

2021-04-14 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Deprecation warnings in test cases ___ Python tracker <https://bugs.python

[issue43841] [easy] test_collections: DeprecationWarning: Please use assertEqual instead

2021-04-14 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Deprecation warnings in test cases ___ Python tracker <https://bugs.python

[issue43852] [sqlite3] Improve tuple creation

2021-04-15 Thread Serhiy Storchaka
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

[issue43846] Control stack usage in large expressions

2021-04-15 Thread Serhiy Storchaka
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

[issue43854] curses: returns incorrect chars after resuming a suspended process

2021-04-15 Thread Serhiy Storchaka
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

[issue35056] Test leaks of memory not managed by Python allocator

2021-04-16 Thread Serhiy Storchaka
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

[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-04-18 Thread Serhiy Storchaka
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

[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-04-18 Thread Serhiy Storchaka
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

[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-04-18 Thread Serhiy Storchaka
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

[issue43883] Making urlparse WHATWG conformant

2021-04-18 Thread Serhiy Storchaka
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.

[issue43899] separate builtin function

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

[issue43903] round() produces incorrect results with certain values

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

[issue43903] round() produces incorrect results with certain values

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

[issue40222] "Zero cost" exception handling

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

[issue43905] dataclasses.astuple does deepcopy on all fields

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

[issue43909] Fuzz dis module and find crashes for dis.dis(), dis.get_instructions() dis.show_code()

2021-04-22 Thread Serhiy Storchaka
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

[issue43908] array.array should remain immutable

2021-04-22 Thread Serhiy Storchaka
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

[issue43908] array.array should remain immutable

2021-04-22 Thread Serhiy Storchaka
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

[issue42725] PEP 563: Should the behavior change for yield/yield from's

2021-04-24 Thread Serhiy Storchaka
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

[issue43655] Tkinter: make X window & macOS recognize dialogs as such

2021-04-25 Thread Serhiy Storchaka
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

[issue43655] Tkinter: make X window & macOS recognize dialogs as such

2021-04-25 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +24307 pull_request: https://github.com/python/cpython/pull/25588 ___ Python tracker <https://bugs.python.org/issue43

[issue43534] turtle.textinput window is not transient

2021-04-25 Thread Serhiy Storchaka
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

[issue43937] Turtle uses the default root window

2021-04-25 Thread Serhiy Storchaka
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

[issue43534] turtle.textinput window is not transient

2021-04-25 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +24310 pull_request: https://github.com/python/cpython/pull/25591 ___ Python tracker <https://bugs.python.org/issue43

[issue42609] Eval with too high string multiplication crashes newer Python versions

2021-04-25 Thread Serhiy Storchaka
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

[issue39529] Deprecate get_event_loop()

2021-04-25 Thread Serhiy Storchaka
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

[issue39529] Deprecate get_event_loop()

2021-04-25 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed type: -> enhancement versions: +Python 3.10 ___ Python tracker <https://bugs.python

[issue43664] Compiling long expression leads to segfault (again)

2021-04-25 Thread Serhiy Storchaka
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

[issue43937] Turtle uses the default root window

2021-04-25 Thread Serhiy Storchaka
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

[issue43534] turtle.textinput window is not transient

2021-04-25 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: -24310 ___ Python tracker <https://bugs.python.org/issue43534> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43534] turtle.textinput window is not transient

2021-04-25 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue43655] Tkinter: make X window & macOS recognize dialogs as such

2021-04-25 Thread Serhiy Storchaka
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://

[issue43655] Tkinter: make X window & macOS recognize dialogs as such

2021-04-25 Thread Serhiy Storchaka
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

[issue43655] Tkinter: make X window & macOS recognize dialogs as such

2021-04-25 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue43534] turtle.textinput window is not transient

2021-04-25 Thread Serhiy Storchaka
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

[issue43908] array.array should remain immutable

2021-04-26 Thread Serhiy Storchaka
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

[issue43908] array.array should remain immutable

2021-04-26 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- Removed message: https://bugs.python.org/msg391902 ___ Python tracker <https://bugs.python.org/issue43908> ___ ___ Python-bug

[issue43916] Check that new heap types cannot be created uninitialised

2021-04-26 Thread Serhiy Storchaka
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

[issue43916] Check that new heap types cannot be created uninitialised

2021-04-26 Thread Serhiy Storchaka
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

[issue43916] Check that new heap types cannot be created uninitialised

2021-04-26 Thread Serhiy Storchaka
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

[issue43916] Check that new heap types cannot be created uninitialised

2021-04-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you for your work Erlend. -- ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ Python-bugs-list mailin

[issue43916] Check that new heap types cannot be created uninitialised

2021-04-26 Thread Serhiy Storchaka
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

[issue43908] array.array should remain immutable

2021-04-26 Thread Serhiy Storchaka
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

[issue43916] Check that new heap types cannot be created uninitialised

2021-04-26 Thread Serhiy Storchaka
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

[issue43908] array.array should remain immutable

2021-04-26 Thread Serhiy Storchaka
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

[issue42609] Eval with too high string multiplication crashes newer Python versions

2021-04-26 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +24328 pull_request: https://github.com/python/cpython/pull/25634 ___ Python tracker <https://bugs.python.org/issue42

[issue43946] unpickling a subclass of list fails when it implements its own extend method

2021-04-26 Thread Serhiy Storchaka
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

[issue43947] lambdas stored with assignment expressions are unoptimized

2021-04-26 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- components: +Interpreter Core versions: +Python 3.10, Python 3.9 ___ Python tracker <https://bugs.python.org/issue43947> ___ ___

[issue43916] Check that new heap types cannot be created uninitialised

2021-04-27 Thread Serhiy Storchaka
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

[issue43947] lambdas stored with assignment expressions are unoptimized

2021-04-27 Thread Serhiy Storchaka
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

[issue43916] Check that new heap types cannot be created uninitialised

2021-04-28 Thread Serhiy Storchaka
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

[issue43908] array.array should remain immutable

2021-04-28 Thread Serhiy Storchaka
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

[issue44003] functools.lru_cache omits __defaults__ attribute from wrapped function

2021-05-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Where does functools.update_wrapper() set __defaults__? -- ___ Python tracker <https://bugs.python.org/issue44003> ___ ___

[issue44003] functools.lru_cache omits __defaults__ attribute from wrapped function

2021-05-01 Thread Serhiy Storchaka
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

[issue42095] plistlib: Add tests that compare with plutil(1)

2021-05-05 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: -21763 ___ Python tracker <https://bugs.python.org/issue42095> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue40943] PEP 353: Drop support for PyArg_ParseTuple() "#" formats when PY_SSIZE_T_CLEAN is not defined

2021-05-06 Thread Serhiy Storchaka
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

[issue40943] PEP 353: Drop support for PyArg_ParseTuple() "#" formats when PY_SSIZE_T_CLEAN is not defined

2021-05-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Sorry, I was confused by Victor's long msg371219. -- ___ Python tracker <https://bugs.python.org/issue40943> ___ ___

[issue44068] Possible divide by zero problems

2021-05-07 Thread Serhiy Storchaka
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

[issue44115] Improve conversions for fractions

2021-05-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It was proposed before in issue37884. -- nosy: +serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue44

[issue44069] pathlib.Path.glob's generator is not a real generator

2021-05-13 Thread Serhiy Storchaka
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

[issue44114] Incorrect function signatures in dictobject.c

2021-05-13 Thread Serhiy Storchaka
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

[issue44114] Incorrect function signatures in dictobject.c

2021-05-13 Thread 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

[issue44123] make function parameter sentinel value true singletons

2021-05-14 Thread Serhiy Storchaka
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

[issue38693] Use f-strings instead of str.format within importlib

2021-05-14 Thread Serhiy Storchaka
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

[issue38693] Use f-strings instead of str.format within importlib

2021-05-14 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- versions: +Python 3.11 -Python 3.10 ___ Python tracker <https://bugs.python.org/issue38693> ___ ___ Python-bugs-list mailin

[issue44117] [C API] Remove deprecated PyEval_InitThreads()

2021-05-14 Thread Serhiy Storchaka
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

[issue44123] make function parameter sentinel value true singletons

2021-05-14 Thread 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

[issue28307] Accelerate 'string' % (value, ...) by using formatted string literals

2021-05-16 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +24794 pull_request: https://github.com/python/cpython/pull/26160 ___ Python tracker <https://bugs.python.org/issue28

[issue28307] Accelerate 'string' % (value, ...) by using formatted string literals

2021-05-16 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +Mark.Shannon versions: +Python 3.11 -Python 3.7 ___ Python tracker <https://bugs.python.org/issue28307> ___ ___ Python-bug

[issue28307] Accelerate 'string' % (value, ...) by using formatted string literals

2021-05-16 Thread Serhiy Storchaka
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

[issue44114] Incorrect function signatures in dictobject.c

2021-05-16 Thread Serhiy Storchaka
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

[issue44152] .isupper() does not support Polytonic Greek (but .islower() does)

2021-05-16 Thread Serhiy Storchaka
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

[issue40452] Tkinter/IDLE: preserve clipboard on closure

2021-05-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What if register Tcl_Finalize as an atexit callback? -- ___ Python tracker <https://bugs.python.org/issue40452> ___ ___ Pytho

[issue40452] Tkinter/IDLE: preserve clipboard on closure

2021-05-17 Thread Serhiy Storchaka
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

[issue40452] Tkinter/IDLE: preserve clipboard on closure

2021-05-17 Thread Serhiy Storchaka
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

[issue44160] speed up searching for keywords by using a dictionary

2021-05-17 Thread Serhiy Storchaka
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

[issue44166] Make IndexError messages for list more informative

2021-05-18 Thread Serhiy Storchaka
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

[issue44160] speed up searching for keywords by using a dictionary

2021-05-18 Thread Serhiy Storchaka
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

[issue44214] PyArg_Parse* for vectorcall?

2021-05-23 Thread Serhiy Storchaka
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

[issue28307] Accelerate 'string' % (value, ...) by using formatted string literals

2021-05-23 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +24913 pull_request: https://github.com/python/cpython/pull/26318 ___ Python tracker <https://bugs.python.org/issue28

[issue44194] Folding ''.join() into f-strings

2021-05-23 Thread Serhiy Storchaka
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

[issue44223] := in comprehensions does not work

2021-05-24 Thread Serhiy Storchaka
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

[issue44217] Tkinter/IDLE: literal astral char discombobulates text editing

2021-05-24 Thread Serhiy Storchaka
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

[issue44223] := in comprehensions does not work

2021-05-24 Thread Serhiy Storchaka
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

[issue44235] Remove l*gettext() and related functions in the gettext module

2021-05-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Go ahead! -- ___ Python tracker <https://bugs.python.org/issue44235> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44214] PyArg_Parse* for vectorcall?

2021-05-25 Thread Serhiy Storchaka
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

<    7   8   9   10   11   12   13   14   15   16   >