[issue16958] The sqlite3 context manager does not work with isolation_level=None

2022-03-25 Thread Kodiologist
Kodiologist added the comment: This bit me real bad. On Python 3.8, I wrote a program with `isolation_level = None` and `with db: …` and spent a long time figuring out why writes were so slow. Turns out that `with db` doesn't actually start a transaction in this case, as the document

[issue46555] Unicode-mangled names refer inconsistently to constants

2022-01-30 Thread Kodiologist
Kodiologist added the comment: > the builtin variable "True" Is the existence of this entity, as separate from the constant `True`, documented anywhere? constants.rst doesn't seem to acknowledge it. Indeed, is its existence a feature, or is

[issue46520] ast.unparse produces bad code for identifiers that become keywords

2022-01-29 Thread Kodiologist
Change by Kodiologist : -- keywords: +patch pull_requests: +29191 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31012 ___ Python tracker <https://bugs.python.org/issu

[issue46520] ast.unparse produces bad code for identifiers that become keywords

2022-01-29 Thread Kodiologist
Kodiologist added the comment: (Hilariously, I couldn't post this comment on bugs.python.org due to some kind of Unicode bug ("Edit Error: 'utf8' codec can't decode bytes in position 208-210: invalid continuation byte"), so I've rendered "\U0001D

[issue46555] Unicode-mangled names refer inconsistently to constants

2022-01-27 Thread Kodiologist
New submission from Kodiologist : I'm not sure if this is a bug, but it certainly surprised me. Most reserved words, when Unicode-mangled, as in "𝕕𝕖𝕗", act like ordinary identifiers (see e.g. bpo-46520). `True`, `False`, and `None` are weird in that Unicode-mangled version

[issue46520] `ast.unparse` produces syntactically illegal code for identifiers that look like reserved words

2022-01-26 Thread Kodiologist
Kodiologist added the comment: And yes, while this behavior will look strange, the only code that will parse to AST nodes that require it will be code that uses exactly the same trick. -- ___ Python tracker <https://bugs.python.org/issue46

[issue46520] `ast.unparse` produces syntactically illegal code for identifiers that look like reserved words

2022-01-26 Thread Kodiologist
Kodiologist added the comment: I've done very little work on CPython, but I do a lot of AST construction and call `ast.unparse` a lot in my work on Hylang, and I think this is a wart worth fixing. The real mistake was letting the user say `𝕕𝕖𝕗 = 1`, but that's been legal Python

[issue46520] `ast.unparse` produces syntactically illegal code for identifiers that look like reserved words

2022-01-25 Thread Kodiologist
New submission from Kodiologist : This works: 𝕕𝕖𝕗 = 1 This raises SyntaxError: import ast exec(ast.unparse(ast.parse("𝕕𝕖𝕗 = 1"))) It looks like `ast.parse` creates a `Name` node with `id='def'`, which is correct per PEP 3131, but `ast.unparse` does

[issue43521] Allow `ast.unparse` to handle NaNs and empty sets

2021-03-16 Thread Kodiologist
Change by Kodiologist : -- keywords: +patch pull_requests: +23662 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24897 ___ Python tracker <https://bugs.python.org/issu

[issue43521] Allow `ast.unparse` to handle NaNs and empty sets

2021-03-16 Thread Kodiologist
New submission from Kodiologist : `ast.unparse` throws an error on an empty set, and it produces `nan` for NaN, which isn't a legal Python literal. PR to follow shortly. -- messages: 388872 nosy: Kodiologist priority: normal severity: normal status: open title: Allow `ast.unpars

[issue40830] Certain uses of dictionary unpacking raise TypeError

2020-05-30 Thread Kodiologist
New submission from Kodiologist : On Python 3.8.2, the below program runs without errors. On Python 3.9.0b1, it raises "TypeError: 'tuple' object is not callable" for the last line. d1 = {'a': 1} d2 = {'c': 3} def fun(a, b, c): re

[issue29088] Inconsistent use of underscore in names that start with "is"

2016-12-27 Thread Kodiologist
New submission from Kodiologist: Compare ``isinstance``, ``issubclass``, and ``islower`` to ``is_integer``, ``is_fifo``, and ``is_enabled``. In Python 3.6, of all the names in the standard library starting with ``is``, I count 69 names with the underscore and 91 without. It seems better to