[Python-Dev] Re: Deprecate Py_TRASHCAN_SAFE_BEGIN/END in 3.10?

2021-08-17 Thread Łukasz Langa
Hi everybody, I'd like to revive this thread as I feel like we have to do something here but some consensus is needed first. To recap, the current state of things is as follows: - in March 2000 (d724b23420f) Christian Tismer contributed the "trashcan" patch that added Py_TRASHCAN_SAFE_BEGIN and

[Python-Dev] Re: Making code object APIs unstable

2021-08-17 Thread Gregory P. Smith
Doing a search of a huge codebase (work), the predominant user of PyCode_New* APIs appears to be checked in Cython generated code (in all sorts of third_party OSS projects). It's in the boilerplate that Cython extensions make use of via it's __Pyx_PyCode_New macro.

[Python-Dev] Re: Deprecate Py_TRASHCAN_SAFE_BEGIN/END in 3.10?

2021-08-17 Thread Antoine Pitrou
On Tue, 17 Aug 2021 12:00:11 +0200 Łukasz Langa wrote: > > Now, there are a couple of things we can do here: > Option 1: Finish GH-12607 to fix the old macros, keeping in mind this will > restore compatibility lost with Python 3.8 - 3.10 only for users of 3.11+ > Option 2: Review and merge

[Python-Dev] Rejecting PEP 648

2021-08-17 Thread Thomas Wouters
Hi Mario, Thank you for submitting PEP 648 (Extensible customizations of the interpreter at startup). The Steering Council has reviewed the PEP and after careful consideration, we have decided to reject the PEP. There are a number of reasons why we have arrived at this decision so we would like

[Python-Dev] Re: Deprecate Py_TRASHCAN_SAFE_BEGIN/END in 3.10?

2021-08-17 Thread Irit Katriel via Python-Dev
On Tue, Aug 17, 2021 at 12:05 PM Duncan Grisby wrote: > I don't know if it is pertinent to this at all, but I raised > https://bugs.python.org/issue9 in which the faulthandler module can > lead to a segfault inside Py_TRASHCAN_SAFE_BEGIN. Would that be avoided if > frameobject.c was changed

[Python-Dev] Re: Deprecate Py_TRASHCAN_SAFE_BEGIN/END in 3.10?

2021-08-17 Thread Petr Viktorin
On 17. 08. 21 12:00, Łukasz Langa wrote: Hi everybody, I'd like to revive this thread as I feel like we have to do something here but some consensus is needed first. To recap, the current state of things is as follows: - *in March 2000* (d724b23420f) Christian Tismer contributed the

[Python-Dev] Re: Making code object APIs unstable

2021-08-17 Thread Petr Viktorin
I'm late to the thread, and as I read it I see everything I wanted to say was covered already :) So just a few clarifications. The stable ABI is not defined by PEP 384 or PEP 652 or by the header something is defined in, but by the docs: - https://docs.python.org/dev/c-api/stable.html and

[Python-Dev] Re: Deprecate Py_TRASHCAN_SAFE_BEGIN/END in 3.10?

2021-08-17 Thread Duncan Grisby
I don't know if it is pertinent to this at all, but I raised https://bugs.python.org/issue9 in which the faulthandler module can lead to a segfault inside Py_TRASHCAN_SAFE_BEGIN. Would that be avoided if frameobject.c was changed to use Py_TRASHCAN_BEGIN / END? Duncan. On Tue, 2021-08-17 at

[Python-Dev] Re: Deprecate Py_TRASHCAN_SAFE_BEGIN/END in 3.10?

2021-08-17 Thread Victor Stinner
If the macro is deprecated, please provide an detailed explanation how to port existing C code to the new C API, in What's New In Python 3.X (version where the macro is deprecated, Python 3.11 if I understood correctly). Also, is there a way to write a single code base working on Python

[Python-Dev] Re: Deprecate Py_TRASHCAN_SAFE_BEGIN/END in 3.10?

2021-08-17 Thread Victor Stinner
See also: * https://bugs.python.org/issue44881 "Consider integration of PyObject_GC_UnTrack() with the trashcan C API". * https://bugs.python.org/issue44897 "Integrate trashcan mechanism into _Py_Dealloc" The issue44897 would make all these macros useless ;-) Victor

[Python-Dev] Re: Making code object APIs unstable

2021-08-17 Thread Victor Stinner
Since Cython is a common consumer of this C API, can somone please dig into Cython to see exactly what it needs in terms of API? How does Cython create all arguments of the __Pyx_PyCode_New() macro? Does it copy an existing function to only override some fields, something like

[Python-Dev] Re: Problems with dict subclassing performance

2021-08-17 Thread Marco Sulla
On Sun, 15 Aug 2021 at 22:30, Marco Sulla wrote: > Oh, this is enough. The sense of the phrase was very clear and you all > have understood it. Remarking grammatical errors is a gross violation > of the Netiquette. I ask __immediately__ the intervent of a moderator, > even if I quite sure, since

[Python-Dev] Re: Problems with dict subclassing performance

2021-08-17 Thread Marco Sulla
My time is short, so thank you for focusing on the real subject. On Mon, 16 Aug 2021 at 11:00, Jeff Allen wrote: > I have spent a lot of time reading typeobject.c over the years I've been > looking at an alternative implementation. It's quite difficult to follow, and > full of tweaks for

[Python-Dev] Re: Making code object APIs unstable

2021-08-17 Thread Gregory P. Smith
+cc: cython-devel background reading for those new to the thread: https://mail.python.org/archives/list/python-dev@python.org/thread/ZWTBR5ESYR26BUIVMXOKPFRLGGYDJSFC/ On Tue, Aug 17, 2021 at 9:47 AM Victor Stinner wrote: > Since Cython is a common consumer of this C API, can somone please dig

[Python-Dev] Re: Making code object APIs unstable

2021-08-17 Thread Guido van Rossum
Both locations Greg found seem to be creating a completely *empty* code object except for the name, filename and lineno. So that would actually work fine with my proposal. On Tue, Aug 17, 2021 at 4:24 PM Gregory P. Smith wrote: > +cc: cython-devel > > background reading for those new to the

[Python-Dev] Re: Making code object APIs unstable

2021-08-17 Thread Spencer Brown
Victor Stinner wrote: > Since Cython is a common consumer of this C API, can somone please dig > into Cython to see exactly what it needs in terms of API? How does > Cython create all arguments of the __Pyx_PyCode_New() macro? Does it > copy an existing function to only override some fields,