[Python-Dev] Re: PEP 683: "Immortal Objects, Using a Fixed Refcount"

2022-02-22 Thread Eddie Elizondo via Python-Dev
Hey Inada, thanks for the feedback > Generally speaking, fork is a legacy API. It is too difficult to know which > library is fork-safe, even for stdlibs. Yes, this is something that Instagram has to go into great lengths to make sure that we get the entire execution into a state where it's saf

[Python-Dev] Re: "immortal" objects and how they would help per-interpreter GIL

2021-12-16 Thread Eddie Elizondo via Python-Dev
I've just updated the original Immortal Instances PR with a bunch of tricks that I used to achieve as much performance parity as possible: https://github.com/python/cpython/pull/19474 . You can see the details along with some benchmarks in the PR itself. This should address a bunch of the origi

[Python-Dev] Fixing Copy on Writes with Immortal Instances

2020-04-11 Thread Eddie Elizondo
Copy on writes are a big problem in large Python application that rely on multiple processes sharing the same memory. I just sent out a patch introduces Immortal Instances which allows the user to bypass reference counting on specific objects to avoid CoW on forked processes. This has helped in

[Python-Dev] subtype_dealloc causes segfaults on c heap type subclasses

2019-08-17 Thread Eddie Elizondo
Hi everyone, I found a bug in subtype_dealloc causing segfaults when used with C heap types. Given that it modifies the deallocation routine of every instance, I thought it was important to surface this in here as well. Also worth noting, this blocks the adoption of PEP384 in C Extension modul

[Python-Dev] An update on heap-allocated types

2019-02-14 Thread Eddie Elizondo
s a custom tp_dealloc and it’s not decrefing the type. The fix here is that a custom tp_dealloc should ALWAYS decref the type. Open to feedback/discussion so feel free to reply if you have any questions! - Eddie Elizondo ___ Python-Dev mailing list Python-Dev@

Re: [Python-Dev] Heap-allocated StructSequences

2018-10-02 Thread Eddie Elizondo
> We have to assess how 3rd party extension modules would be affected > by this change. This change is fully compatible with 3rd party extensions. The current change to InitType2 is only refactoring, there is no logic change there so that API remains unchanged. Also, there should not be any insta

[Python-Dev] Heap-allocated StructSequences

2018-09-04 Thread Eddie Elizondo
PEP-384 talks about defining a Stable ABI by making PyTypeObject opaque. Thus, banning the use of static PyTypeObjects. Specifically, I’d like to focus on those static PyTypeObjects that are initialized as StructSequences. As of today, there are 14 instances of these types (in timemodule.c, pos

Re: [Python-Dev] A Subtle Bug in Class Initializations

2018-08-28 Thread Eddie Elizondo
Hi everyone, Sorry for the delay - I finally sent out a patch: https://bugs.python.org/issue34522. Also, I'm +1 for modifying all extension modules to use PyType_FromSpec! I might lend a hand to start moving them :) - Eddie On 8/13/18, 6:02 AM, "Erik Bray" wrote: On Fri, Aug 10, 2018

[Python-Dev] A Subtle Bug in Class Initializations

2018-08-06 Thread Eddie Elizondo
Background: Through the implementation of an alternate runtime I've been poking around some of the class initialization routines and I found out that there was a subtle bug with PyType_Ready and the header initializer PyVarObject_HEAD_INIT. Looking through the codebase, I couldn't really find an