[issue35899] '_is_sunder' function in 'enum' module fails on empty string
New submission from Maxwell : This is a really minor bug. In enum.py the function _is_sunder(name) fails on empty string with an IndexError. As a result, attempting to create an Enum with an empty string fails. >>> from enum import Enum >>> Yay = Enum('Yay', ('', 'B', 'C')) Traceback (most recent call last): File "", line 1, in File "C:\Program Files\Python37\lib\enum.py", line 311, in __call__ return cls._create_(value, names, module=module, qualname=qualname, type=type, start=start) File "C:\Program Files\Python37\lib\enum.py", line 422, in _create_ classdict[member_name] = member_value File "C:\Program Files\Python37\lib\enum.py", line 78, in __setitem__ if _is_sunder(key): File "C:\Program Files\Python37\lib\enum.py", line 36, in _is_sunder return (name[0] == name[-1] == '_' and IndexError: string index out of range >>> Expected behavior is for it to not fail, as Enum accepts wierd strings. Example: >>> from enum import Enum >>> Yay = Enum('Yay', ('!', 'B', 'C')) >>> getattr(Yay, '!') >>> Transcript of lines 26 to 39 of enum.py: def _is_dunder(name): """Returns True if a __dunder__ name, False otherwise.""" return (name[:2] == name[-2:] == '__' and name[2:3] != '_' and name[-3:-2] != '_' and len(name) > 4) def _is_sunder(name): """Returns True if a _sunder_ name, False otherwise.""" return (name[0] == name[-1] == '_' and name[1:2] != '_' and name[-2:-1] != '_' and len(name) > 2) Solution 1: Replace with: def _is_dunder(name): """Returns True if a __dunder__ name, False otherwise.""" return (len(name) > 4 and name[:2] == name[-2:] == '__' and name[2] != '_' and name[-3] != '_') def _is_sunder(name): """Returns True if a _sunder_ name, False otherwise.""" return (len(name) > 2 and name[0] == name[-1] == '_' and name[1:2] != '_' and name[-2:-1] != '_') In this solution, function '_is_dunder' was also altered for consistency. Altering '_is_dunder' is not necessary, though. Solution 2: Replace with: def _is_dunder(name): """Returns True if a __dunder__ name, False otherwise.""" return (name[:2] == name[-2:] == '__' and name[2:3] != '_' and name[-3:-2] != '_' and len(name) > 4) def _is_sunder(name): """Returns True if a _sunder_ name, False otherwise.""" return (name[:0] == name[-1:] == '_' and name[1:2] != '_' and name[-2:-1] != '_' and len(name) > 2) In this solution, function '_is_sunder' was altered to follow the style used in function '_is_dunder'. -- components: Library (Lib) messages: 334866 nosy: Maxpxt priority: normal severity: normal status: open title: '_is_sunder' function in 'enum' module fails on empty string type: crash versions: Python 3.7 ___ Python tracker <https://bugs.python.org/issue35899> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35899] '_is_sunder' function in 'enum' module fails on empty string
Maxwell added the comment: Typo fix on solution 2: def _is_sunder(name): """Returns True if a _sunder_ name, False otherwise.""" return (name[:1] == name[-1:] == '_' and name[1:2] != '_' and name[-2:-1] != '_' and len(name) > 2) -- ___ Python tracker <https://bugs.python.org/issue35899> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46041] Add reference counting micro-optimizations to listobject.c
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 ___ Python tracker <https://bugs.python.org/issue46041> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46041] Add reference counting micro-optimizations to listobject.c
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/issue46041> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39425] list.count performance regression
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/issue39425> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46561] Descriptor resolution should own arguments passed to descriptors
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. -- messages: 411978 nosy: tekknolagi priority: normal severity: normal status: open title: Descriptor resolution should own arguments passed to descriptors versions: Python 3.10, Python 3.11, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue46561> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46561] Descriptor resolution should own arguments passed to descriptors
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/issue46561> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46561] Descriptor resolution should own arguments passed to descriptors
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 calling the __get__ descriptor. Right now, it is not only borrowed by the callee but also not owned by the caller (!). Max -- ___ Python tracker <https://bugs.python.org/issue46561> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46561] Descriptor resolution should own arguments passed to descriptors
Change by Maxwell Bernstein : -- components: +C API ___ Python tracker <https://bugs.python.org/issue46561> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46561] Descriptor resolution should own arguments passed to descriptors
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.org/issue46561> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1727780] 64/32-bit issue when unpickling random.Random
Peter Maxwell added the comment: For the record, and to prevent dilution of the count of times this bug has been encountered: this issue is a duplicate of issue1472695, which was later marked "won't fix" for no apparent reason. sligocki's patch is more thorough than mine was and I hope it has a better fate too. -- nosy: +pm67nz _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1727780> _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3547] Ctypes is confused by bitfields of varying integer types
New submission from Tim Maxwell <[EMAIL PROTECTED]>: Steps to reproduce: Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53) [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from ctypes import * >>> fields = [('a', c_short, 4), ('b', c_short, 4), ('c', c_long, 24)] >>> class Foo(Structure): ... _fields_ = fields ... >>> Foo.a >>> Foo.b >>> Foo.c # Wrong! More about my machine: >>> sizeof(c_short) 2 >>> sizeof(c_long) 4 This particular example comes from a 32-bit Mac OS X Intel machine. The bug has been reproduced on Linux as well, but could not be reproduced on Windows XP. -- assignee: theller components: ctypes messages: 71060 nosy: theller, tim.maxwell severity: normal status: open title: Ctypes is confused by bitfields of varying integer types type: behavior versions: Python 2.5 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3547> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38031] FileIO.__init__ aborts when opener returns bad fd
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 exception set when PyErr_SetFromErrno uses PyObject_Call to create the exception. -- components: IO messages: 351150 nosy: tekknolagi priority: normal severity: normal status: open title: FileIO.__init__ aborts when opener returns bad fd type: crash versions: Python 3.6 ___ Python tracker <https://bugs.python.org/issue38031> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32689] shutil.move raises AttributeError if first argument is a pathlib.Path object and destination is a directory
Change by Maxwell McKinnon : -- nosy: +bodom ___ Python tracker <https://bugs.python.org/issue32689> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38648] Py_tp_free is specified twice in Python-ast.c
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 ___ Python tracker <https://bugs.python.org/issue38648> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38648] Py_tp_free is specified twice in Python-ast.c
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/issue38648> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36203] PyWeakref_NewRef docs are misleading
Change by Maxwell Bernstein : -- pull_requests: +24879 pull_request: https://github.com/python/cpython/pull/26273 ___ Python tracker <https://bugs.python.org/issue36203> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44466] faulthandler should indicate if the fault happened in garbage collection
New submission from Maxwell Ballenger : I have been working on debugging a segfault. When faulthandler catches the fault, it makes a printout like this: Current thread 0x7f4fa62b2700 (most recent call first): File "/usr/lib/python3.6/site-packages/tornado/ioloop.py", line 919, in call_at File "/usr/lib/python3.6/site-packages/tornado/ioloop.py", line 502, in add_timeout ... However, when I run the same app with gdb, catch the segfault with gdb and and run py-bt, it makes a printout like this (gdb) py-bt Traceback (most recent call first): Garbage-collecting File "/usr/lib/python3.6/site-packages/tornado/ioloop.py", line 919, in call_at functools.partial(stack_context.wrap(callback), *args, **kwargs), File "/usr/lib/python3.6/site-packages/tornado/ioloop.py", line 502, in add_timeout return self.call_at(deadline, callback, *args, **kwargs) ... The important distinction here for me is the "Garbage-collecting" line. When debugging this issue with faulthandler, I thought that the segfault was happening somewhere in the execution stack of this ioloop.py function. It wasn't until I ran under gdb that I realized it was actually happening in garbage collection and more or less has nothing to do with ioloop.py. It seems like faulthandler should be able to tell that the segfault was actually generated in garbage collection and this would make faulthandler much more helpful for cases like this. Thank you for reading! -- components: Library (Lib) messages: 396196 nosy: maxballenger priority: normal severity: normal status: open title: faulthandler should indicate if the fault happened in garbage collection type: enhancement versions: Python 3.6 ___ Python tracker <https://bugs.python.org/issue44466> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44466] faulthandler should indicate if the fault happened in garbage collection
Maxwell Ballenger added the comment: Thank you Victor, sounds great! -- ___ Python tracker <https://bugs.python.org/issue44466> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45956] Add scanf regular expressions to re
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: normal status: open title: Add scanf regular expressions to re versions: Python 3.11 ___ Python tracker <https://bugs.python.org/issue45956> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45956] Add scanf regular expressions to re
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/issue45956> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45956] Add scanf regular expressions to re
Change by Maxwell Bernstein : -- resolution: -> rejected stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue45956> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39985] str.format and string.Formatter subscript behaviors diverge
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: ``` import string str.format("{[0]}", "hello") # => "h" string.Formatter().format("{[0]}", "hello") # => KeyError("") ``` They seem to work the same in the case where the arg is either indexed by number or by name: ``` import string str.format("{0[0]}", "hello") # => "h" string.Formatter().format("{0[0]}", "hello") # => "h" str.format("{a[0]}", a="hello") # => "h" string.Formatter().format("{a[0]}", a="hello") # => "h" ``` After some digging, I have come up with a couple ideas: * Change _string.formatter_field_name_split to treat an empty string field name as 0, so that string.Formatter.get_value looks up the arg in args, instead of kwargs * Change string.Formatter.get_value to treat empty string key as 0, and look up the arg in args, instead of kwargs I'm happy to submit a PR if people find one of these two solutions palatable or have some solutions of their own. (Note: this may appear in other versions, but I don't have them on my machine to test.) -- components: Library (Lib) messages: 364382 nosy: tekknolagi priority: normal severity: normal status: open title: str.format and string.Formatter subscript behaviors diverge type: behavior versions: Python 2.7, Python 3.6, Python 3.7 ___ Python tracker <https://bugs.python.org/issue39985> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39985] str.format and string.Formatter subscript behaviors diverge
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/issue39985> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27307] string.Formatter does not support key/attribute access on unnumbered fields
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/issue27307> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27307] string.Formatter does not support key/attribute access on unnumbered fields
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/issue27307> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27307] string.Formatter does not support key/attribute access on unnumbered fields
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 <https://bugs.python.org/issue27307> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40638] input() with malformed input stream triggers assertion failure
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. There is an upcoming patch. -- components: Interpreter Core, Library (Lib) messages: 368982 nosy: tekknolagi priority: normal severity: normal status: open title: input() with malformed input stream triggers assertion failure versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue40638> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40638] input() with malformed input stream triggers assertion failure
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/issue40638> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40704] PyIter_Check fails when compiling in the Limited API
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 messages: 369479 nosy: tekknolagi priority: normal severity: normal status: open title: PyIter_Check fails when compiling in the Limited API versions: Python 3.6, Python 3.7 ___ Python tracker <https://bugs.python.org/issue40704> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40704] PyIter_Check fails when compiling in the Limited API
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 file included from /usr/include/python3.6m/Python.h:135:0, from test.c:3: test.c: In function ‘main’: /usr/include/python3.6m/abstract.h:712:20: error: dereferencing pointer to incomplete type ‘struct _typeobject’ ((obj)->ob_type->tp_iternext != NULL && \ ^ test.c:8:3: note: in expansion of macro ‘PyIter_Check’ PyIter_Check(foo); ^~~~ /usr/include/python3.6m/abstract.h:713:38: error: ‘_PyObject_NextNotImplemented’ undeclared (first use in this function); did you mean ‘PyObject_HashNotImplemented’? (obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented) ^ test.c:8:3: note: in expansion of macro ‘PyIter_Check’ PyIter_Check(foo); ^~~~ /usr/include/python3.6m/abstract.h:713:38: note: each undeclared identifier is reported only once for each function it appears in (obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented) ^ test.c:8:3: note: in expansion of macro ‘PyIter_Check’ PyIter_Check(foo); ^~~~ ``` -- ___ Python tracker <https://bugs.python.org/issue40704> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40704] PyIter_Check fails when compiling in the Limited API
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, for sure. -- versions: +Python 3.6, Python 3.7 -Python 3.10, Python 3.9 ___ Python tracker <https://bugs.python.org/issue40704> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40704] PyIter_Check fails when compiling in the Limited API
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/issue40704> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21041] pathlib.PurePath.parents rejects negative indexes
Maxwell Ballenger added the comment: Use case: I want to see if a Path is a descendent of /tmp. if filepath.parents[-2] == Path('tmp'): turns into if filepath.parents[len(filepath.parents)-2] == Path('tmp'): -- nosy: +maxballenger ___ Python tracker <https://bugs.python.org/issue21041> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42065] Fix incorrectly formatted _codecs.charmap_decode error message
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.python.org/issue42065> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42199] bytecode_helper assertNotInBytecode fails too eagerly
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() call should be moved into the `if`/`elif`. -- components: Tests messages: 379885 nosy: tekknolagi priority: normal severity: normal status: open title: bytecode_helper assertNotInBytecode fails too eagerly versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue42199> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42199] bytecode_helper assertNotInBytecode fails too eagerly
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/issue42199> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36929] Other Python _io implementations may not expose _io in their type names
Change by Maxwell Bernstein : -- pull_requests: +13302 ___ Python tracker <https://bugs.python.org/issue36929> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36203] PyWeakref_NewRef docs are misleading
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 Bernstein priority: normal severity: normal status: open title: PyWeakref_NewRef docs are misleading versions: Python 3.6, Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue36203> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36203] PyWeakref_NewRef docs are misleading
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://github.com/python/cpython/blob/master/Objects/weakrefobject.c#L748 > > if (callback == Py_None) > callback = NULL; > if (callback == NULL) > /* return existing weak reference if it exists */ > result = ref; > if (result != NULL) > Py_INCREF(result); > else { > ... > } > > However, I'm not sure we should fix the docs or the code here. > > -- > nosy: +Windson Yang > > ___ > Python tracker > <https://bugs.python.org/issue36203> > ___ > -- ___ Python tracker <https://bugs.python.org/issue36203> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36203] PyWeakref_NewRef docs are misleading
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 is not callable, None, or NULL. I'm not an > expert in C, but I would love to create a PR for it if you don't have time. > > -- > > ___ > Python tracker > <https://bugs.python.org/issue36203> > ___ > -- ___ Python tracker <https://bugs.python.org/issue36203> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36929] Other Python _io implementations may not expose _io in their type names
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 ignore the tp_name in favor of using a string literal, such as _io.TextIOWrapper) * Pickling error messages The existing test suite only tests the former. This makes it tricky for other Python implementations to pass the test suite if they do not expose the module name (_io, _ssl, _tkinter, etc) in their type names. -- assignee: christian.heimes components: IO, SSL, Tests, Tkinter messages: 342593 nosy: christian.heimes, tekknolagi priority: normal severity: normal status: open title: Other Python _io implementations may not expose _io in their type names type: behavior versions: Python 3.6, Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue36929> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36929] Other Python _io implementations may not expose _io in their type names
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/issue36929> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36929] Other Python _io implementations may not expose _io in their type names
Change by Maxwell Bernstein : -- keywords: +patch pull_requests: +13258 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36929> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36929] Other Python _io implementations may not expose _io in their type names
Change by Maxwell Bernstein : -- nosy: +vstinner ___ Python tracker <https://bugs.python.org/issue36929> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16219] segfault when using xml.etree.ElementTree.XMLTreeBuilder
New submission from Scott Maxwell: I upgraded the meld3 module (used by Supervisord) to work on Py3K and discovered this segfault. It happens every time. I have seen this on the pre-built Mac 3.3.0 and a source-built 3.3.0 on Linux. It does not occur in 3.2.2. It appears to happen in native code so I can pinpoint the exact location of the crash. But it is easy to reproduce. It is easy to reproduce. Just grab meld3.py and test_meld3.py from my GitHub and run test_meld3. Files are here: https://raw.github.com/scottkmaxwell/meld3/master/meld3/meld3.py https://raw.github.com/scottkmaxwell/meld3/master/meld3/test_meld3.py On just clone my depot. -- components: Library (Lib) messages: 172815 nosy: scottmax priority: normal severity: normal status: open title: segfault when using xml.etree.ElementTree.XMLTreeBuilder type: crash versions: Python 3.3 ___ Python tracker <http://bugs.python.org/issue16219> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com