[issue43770] Rework C types initialization

2021-06-28 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +25513 pull_request: https://github.com/python/cpython/pull/26946 ___ Python tracker ___ __

[issue1662] [patch] assert tp_traverse in PyType_GenericAlloc()

2021-06-28 Thread STINNER Victor
STINNER Victor added the comment: This issue was fixed differently in bpo-44263, by adding a test in PyType_Ready(): // bpo-44263: tp_traverse is required if Py_TPFLAGS_HAVE_GC is set. // Note: tp_clear is optional. if (type->tp_flags & Py_TPFLAGS_HAVE_GC && type->tp_trave

[issue1662] [patch] assert tp_traverse in PyType_GenericAlloc()

2021-06-28 Thread STINNER Victor
STINNER Victor added the comment: > tp_traverse is optional, so we should not add this assertion. It is required by types implementing the GC protocol. This assumption is non-obvious and was not documented. The documentation was completed in bpo-44263 by commit 8b55bc3f93a655bc803bff79725d5f

[issue44442] Globals (and presumably builtins) are cleared premuturely in FrameObject

2021-06-28 Thread STINNER Victor
STINNER Victor added the comment: I marked bpo-44288 as a duplicate of this issue. -- ___ Python tracker ___ ___ Python-bugs-list m

[issue44288] unittest: _is_relevant_tb_level() fails because tb.tb_frame.f_globals=None

2021-06-28 Thread STINNER Victor
STINNER Victor added the comment: I mark this issue as a duplicate of bpo-2. -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Globals (and presumably builtins) are cleared premuturely in FrameObject ___ Py

[issue40142] Modify _PyObject_GC_TRACK() to ensure that newly tracked object is valid

2021-06-28 Thread STINNER Victor
STINNER Victor added the comment: PyType_GenericAlloc() cannot traverse the object since the object members are not initialized yet. For example, dict_traverse() can only be called when PyDict_New() completes. A different approach would be to: * (1) Add PyType_AllocNoTrack(), use it in buil

[issue44529] Using typing.Union in isinstance checks

2021-06-28 Thread Kaleb Barrett
Kaleb Barrett added the comment: Ah, this was implemented for 3.10 as a part of PEP 604. https://www.python.org/dev/peps/pep-0604/#isinstance-and-issubclass. Feel free to close. -- ___ Python tracker _

[issue44531] Add _PyType_AllocNoTrack() function: allocate without tracking in the GC

2021-06-28 Thread STINNER Victor
New submission from STINNER Victor : The PyType_GenericAlloc() function tracks the newly created object in the garbage collector (GC) as soon as memory is initialized, but before all object members are initialized. If a GC collection happens before the object is fully initialized, the travers

[issue44531] Add _PyType_AllocNoTrack() function: allocate without tracking in the GC

2021-06-28 Thread STINNER Victor
Change by STINNER Victor : -- keywords: +patch pull_requests: +25514 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26947 ___ Python tracker ___ _

[issue44531] Add _PyType_AllocNoTrack() function: allocate without tracking in the GC

2021-06-28 Thread STINNER Victor
STINNER Victor added the comment: In bpo-40142, I tried to modify _PyObject_GC_TRACK() to visit the object before tracking it, as done by PyObject_GC_Track(). Problem: PyType_GenericAlloc() cannot traverse the object since the object members are not initialized yet. For example, dict_travers

[issue40142] Modify _PyObject_GC_TRACK() to ensure that newly tracked object is valid

2021-06-28 Thread STINNER Victor
STINNER Victor added the comment: I created bpo-44531 "Add _PyType_AllocNoTrack() function: allocate without tracking in the GC". -- ___ Python tracker ___ __

[issue40142] Modify _PyObject_GC_TRACK() to ensure that newly tracked object is valid

2021-06-28 Thread STINNER Victor
STINNER Victor added the comment: Attached gc_track.patch: my latest attempt to implement this idea. -- Added file: https://bugs.python.org/file50130/gc_track.patch ___ Python tracker ___

[issue44531] Add _PyType_AllocNoTrack() function: allocate without tracking in the GC

2021-06-28 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +25515 pull_request: https://github.com/python/cpython/pull/26948 ___ Python tracker ___ __

[issue43625] CSV has_headers heuristic could be improved

2021-06-28 Thread Andrei Kulakov
Andrei Kulakov added the comment: Skip: If I understand right, in the patch the last two types -- float and int, will never have an effect because if float(x) and int(x) succeed, so will complex(x), and conversely, if complex(x) fails, float and int will also fail. So the effect of the patch

[issue44440] logging does not work as documented (setLevel)

2021-06-28 Thread Ned Deily
Change by Ned Deily : -- nosy: +vinay.sajip ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue44492] Building a C extension on Big Sur and SDK v10.15 fails

2021-06-28 Thread Ned Deily
Change by Ned Deily : -- components: +macOS nosy: +ned.deily, ronaldoussoren ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue44521] str.removeprefix(): add strict: bool

2021-06-28 Thread Dennis Sweeney
Dennis Sweeney added the comment: I'm +-0 on this. I would write something like this instead: assert whatever.startswith(prefix) result = whatever.removeprefix(prefix) Note that if this were to change, the corresponding methods would also have to change on bytes, bytearray, and colle

[issue43595] Can not add a metclass that inherits both ABCMeta & ABC to a Union

2021-06-28 Thread Andrei Kulakov
Andrei Kulakov added the comment: Works for me, too - no error (MacOS, 3.9.1) -- nosy: +andrei.avk ___ Python tracker ___ ___ Pytho

[issue44526] Doc typo in "What’s New In Python 3.10" (x/y-axis)

2021-06-28 Thread Brandt Bucher
Change by Brandt Bucher : -- nosy: +brandtbucher ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue44526] Doc typo in "What’s New In Python 3.10" (x/y-axis)

2021-06-28 Thread Brandt Bucher
Brandt Bucher added the comment: I don’t think this is a typo. When x is 0, the point resides somewhere upon the vertical y axis. When y is 0, the point resides somewhere upon the horizontal x axis. Try plotting the points (0, 1) and (1, 0), for example. -- _

[issue44532] multi subinterpreters use _PyStructSequence_InitType failed.

2021-06-28 Thread junyixie
New submission from junyixie : In _PyStructSequence_InitType, it will check type is initialized. but when we have multi subinterpreters, type may be initialized expected. when type already been initialized, should return 0 rather than throw exception. ```c /* PyTypeObject has already been initi

<    1   2