[issue36203] PyWeakref_NewRef docs are misleading

2019-03-06 Thread Maxwell Bernstein
Maxwell Bernstein added the comment: NewProxy checks if it's callable, so I suppose the code should be fixed. On Wed, Mar 6, 2019, 03:32 Windson Yang wrote: > > Windson Yang added the comment: > > Yes, Maxwell. I guess the docs are misleading, the code locate in > https://gi

[issue36203] PyWeakref_NewRef docs are misleading

2019-03-05 Thread Maxwell Bernstein
New submission from Maxwell Bernstein : The docs for `PyWeakref_NewRef` state "if callback is not callable, None, or NULL, this will return NULL and raise TypeError". It does not appear as though there is a callable check for the callback. -- messages: 337255 nosy: Maxwell

[issue36203] PyWeakref_NewRef docs are misleading

2019-03-07 Thread Maxwell Bernstein
Maxwell Bernstein added the comment: I can likely do it tomorrow. If not I'll update this. On Thu, Mar 7, 2019, 00:20 Windson Yang wrote: > > Windson Yang added the comment: > > It looks to me the fix is easy, we just will return NULL and raise > TypeError when the callback

[issue36929] Other Python _io implementations may not expose _io in their type names

2019-05-15 Thread Maxwell Bernstein
Maxwell Bernstein added the comment: I have the beginnings of a PR to patch the test suite to make the prefix optional, if anybody is interested. -- ___ Python tracker <https://bugs.python.org/issue36

[issue36929] Other Python _io implementations may not expose _io in their type names

2019-05-15 Thread Maxwell Bernstein
Change by Maxwell Bernstein : -- keywords: +patch pull_requests: +13258 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36929> ___ _

[issue36929] Other Python _io implementations may not expose _io in their type names

2019-05-15 Thread Maxwell Bernstein
Change by Maxwell Bernstein : -- nosy: +vstinner ___ Python tracker <https://bugs.python.org/issue36929> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36929] Other Python _io implementations may not expose _io in their type names

2019-05-15 Thread Maxwell Bernstein
New submission from Maxwell Bernstein : For a vanishingly small number of internal types, CPython sets the tp_name slot to mod_name.type_name, either in the PyTypeObject or the PyType_Spec. There are a few minor places where this surfaces: * Custom repr functions for those types (some of which

[issue36929] Other Python _io implementations may not expose _io in their type names

2019-05-17 Thread Maxwell Bernstein
Change by Maxwell Bernstein : -- pull_requests: +13302 ___ Python tracker <https://bugs.python.org/issue36929> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue38031] FileIO.__init__ aborts when opener returns bad fd

2019-09-04 Thread Maxwell Bernstein
New submission from Maxwell Bernstein : On a debug build, the following causes an abort: import _io _io.FileIO("foobar", opener=lambda name, flags: 100) 100 is not a valid fd. FileIO attempts to raise an IOError from errno, but there is already an exceptio

[issue38648] Py_tp_free is specified twice in Python-ast.c

2019-10-30 Thread Maxwell Bernstein
New submission from Maxwell Bernstein : This looks like a typo due to copy-paste. -- messages: 355726 nosy: tekknolagi priority: normal severity: normal status: open title: Py_tp_free is specified twice in Python-ast.c versions: Python 3.8

[issue38648] Py_tp_free is specified twice in Python-ast.c

2019-10-30 Thread Maxwell Bernstein
Change by Maxwell Bernstein : -- keywords: +patch pull_requests: +16529 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17002 ___ Python tracker <https://bugs.python.org/issu

[issue40638] input() with malformed input stream triggers assertion failure

2020-05-15 Thread Maxwell Bernstein
Change by Maxwell Bernstein : -- keywords: +patch pull_requests: +19430 stage: -> patch review pull_request: https://github.com/python/cpython/pull/20125 ___ Python tracker <https://bugs.python.org/issu

[issue40638] input() with malformed input stream triggers assertion failure

2020-05-15 Thread Maxwell Bernstein
New submission from Maxwell Bernstein : builtin_input_impl does multiple attribute lookups in a row assuming they will succeed, but part of attribute lookup assumes that there is no pending exception. I propose doing the lookups one by one and checking for an error after each

[issue39985] str.format and string.Formatter subscript behaviors diverge

2020-03-18 Thread Maxwell Bernstein
Change by Maxwell Bernstein : -- keywords: +patch pull_requests: +18418 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19065 ___ Python tracker <https://bugs.python.org/issu

[issue27307] string.Formatter does not support key/attribute access on unnumbered fields

2020-03-19 Thread Maxwell Bernstein
Maxwell Bernstein added the comment: Looks like the patch solves my problem, so I am going to update my PR sometime today. -- ___ Python tracker <https://bugs.python.org/issue27

[issue27307] string.Formatter does not support key/attribute access on unnumbered fields

2020-03-19 Thread Maxwell Bernstein
Maxwell Bernstein added the comment: I'll take a look at the patch and see if this solves my problem. If it does, I'll update my PR with tests. -- ___ Python tracker <https://bugs.python.org/issue27

[issue27307] string.Formatter does not support key/attribute access on unnumbered fields

2020-03-19 Thread Maxwell Bernstein
Maxwell Bernstein added the comment: Okay, well it doesn't provide the desired behavior of raising the error when switching back and forth between manual and auto numbering, so I am looking into that. -- ___ Python tracker <ht

[issue39985] str.format and string.Formatter subscript behaviors diverge

2020-03-16 Thread Maxwell Bernstein
New submission from Maxwell Bernstein : As I understand it, str.format and string.Formatter are supposed to behave the same, with string.Formatter being a pluggable variant. While poking at string.Formatter, I noticed that they do not behave the same when formatting a nameless subscript

[issue40704] PyIter_Check fails when compiling in the Limited API

2020-05-20 Thread Maxwell Bernstein
New submission from Maxwell Bernstein : PyIter_Check is itself marked as available in the Limited API but: a) it's a macro, and b) it pokes directly at tp_iternext This means that it's functionally impossible to use PyIter_Check when working with the Limited API. -- components: C API

[issue40704] PyIter_Check fails when compiling in the Limited API

2020-05-20 Thread Maxwell Bernstein
Maxwell Bernstein added the comment: See for example the following C program: ``` #define Py_LIMITED_API #include "Python.h" int main() { Py_Initialize(); PyObject* foo; PyIter_Check(foo); } ``` when compiled (gcc test.c `pkg-config --cflags python3`) produces: ``` In fil

[issue42065] Fix incorrectly formatted _codecs.charmap_decode error message

2020-10-17 Thread Maxwell Bernstein
Change by Maxwell Bernstein : -- keywords: +patch nosy: +tekknolagi nosy_count: 1.0 -> 2.0 pull_requests: +21704 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19940 ___ Python tracker <https://bugs.p

[issue40704] PyIter_Check fails when compiling in the Limited API

2020-06-19 Thread Maxwell Bernstein
Maxwell Bernstein added the comment: Oh, it looks like this has been done: https://github.com/python/cpython/commit/ea62ce7f4fefc66bc0adba16bcd7666d5bbd5b44 Although I am not sure what version this made it into. So maybe this does not affect versions 3.9/3.10. I've seen it in 3.6/6

[issue40704] PyIter_Check fails when compiling in the Limited API

2020-06-19 Thread Maxwell Bernstein
Change by Maxwell Bernstein : -- keywords: +patch pull_requests: +20165 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/7477 ___ Python tracker <https://bugs.python.org/issu

[issue42199] bytecode_helper assertNotInBytecode fails too eagerly

2020-10-29 Thread Maxwell Bernstein
New submission from Maxwell Bernstein : assertNotInBytecode should only fail if: * the instr matches and the arg is unspecified, or * the instr matches, the arg is specified, and the arg matches But right now it fails in a third case because of the dangling self.fail() call. The self.fail

[issue42199] bytecode_helper assertNotInBytecode fails too eagerly

2020-10-29 Thread Maxwell Bernstein
Change by Maxwell Bernstein : -- keywords: +patch pull_requests: +21950 stage: -> patch review pull_request: https://github.com/python/cpython/pull/23031 ___ Python tracker <https://bugs.python.org/issu

[issue36203] PyWeakref_NewRef docs are misleading

2021-05-20 Thread Maxwell Bernstein
Change by Maxwell Bernstein : -- pull_requests: +24879 pull_request: https://github.com/python/cpython/pull/26273 ___ Python tracker <https://bugs.python.org/issue36

[issue45956] Add scanf regular expressions to re

2021-12-01 Thread Maxwell Bernstein
Change by Maxwell Bernstein : -- keywords: +patch pull_requests: +28111 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29885 ___ Python tracker <https://bugs.python.org/issu

[issue45956] Add scanf regular expressions to re

2021-12-01 Thread Maxwell Bernstein
New submission from Maxwell Bernstein : The documentation for the `re` module suggests several regular expressions for use in simulating `scanf()`. Provide these directly in the `re` module. -- components: Library (Lib) messages: 407491 nosy: tekknolagi priority: normal severity

[issue46041] Add reference counting micro-optimizations to listobject.c

2021-12-10 Thread Maxwell Bernstein
New submission from Maxwell Bernstein : Avoid reference counting in the fast path of list.contains and list.index -- messages: 408242 nosy: tekknolagi priority: normal severity: normal status: open title: Add reference counting micro-optimizations to listobject.c

[issue46041] Add reference counting micro-optimizations to listobject.c

2021-12-10 Thread Maxwell Bernstein
Change by Maxwell Bernstein : -- keywords: +patch pull_requests: +28261 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30036 ___ Python tracker <https://bugs.python.org/issu

[issue39425] list.count performance regression

2021-12-10 Thread Maxwell Bernstein
Change by Maxwell Bernstein : -- nosy: +tekknolagi nosy_count: 5.0 -> 6.0 pull_requests: +28262 pull_request: https://github.com/python/cpython/pull/30036 ___ Python tracker <https://bugs.python.org/issu

[issue45956] Add scanf regular expressions to re

2021-12-01 Thread Maxwell Bernstein
Change by Maxwell Bernstein : -- resolution: -> rejected stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue46561] Descriptor resolution should own arguments passed to descriptors

2022-01-27 Thread Maxwell Bernstein
New submission from Maxwell Bernstein : Currently the descriptor (self) argument to __get__ is passed borrowed, since _PyType_LookupId returns a borrowed reference (see _PyObject_LookupSpecial and lookup_maybe_method in Objects/typeobject.c). This should instead own the reference

[issue46561] Descriptor resolution should own arguments passed to descriptors

2022-01-27 Thread Maxwell Bernstein
Change by Maxwell Bernstein : -- keywords: +patch pull_requests: +29158 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30979 ___ Python tracker <https://bugs.python.org/issu

[issue46561] Descriptor resolution should own arguments passed to descriptors

2022-01-28 Thread Maxwell Bernstein
Maxwell Bernstein added the comment: Hi Dennis, Sorry, let me be more clear. CPython in general ensures that objects passed in as arguments to a function will live for the duration of the function call if they are otherwise untouched. As it is now, this invariant is not maintained when

[issue46561] Descriptor resolution should own arguments passed to descriptors

2022-01-28 Thread Maxwell Bernstein
Maxwell Bernstein added the comment: Ah, and another piece of the puzzle: this can happen in runtimes like Cinder that provide their own native code entrypoints to functions like a __get__. -- ___ Python tracker <https://bugs.python.

[issue46561] Descriptor resolution should own arguments passed to descriptors

2022-01-28 Thread Maxwell Bernstein
Change by Maxwell Bernstein : -- components: +C API ___ Python tracker <https://bugs.python.org/issue46561> ___ ___ Python-bugs-list mailing list Unsubscribe: