[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2022-01-27 Thread STINNER Victor
STINNER Victor added the comment: Raymond: > Is the subinterpreters work still on hold pending a PEP? While sub-interpreters is one motivation to convert static types to heap types, it's not the only one. IMO it's better to use the "embedded Python" use case to justify these changes, since

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2022-01-27 Thread STINNER Victor
STINNER Victor added the comment: Quick update on this closed issue. I landed on this issue from Erlend's SC request: https://github.com/python/steering-council/issues/99 > Oh! I assumed this bug wasn't resolved, but it is -- in bpo-34784. Sorry, I > should have checked! Yes, there is the

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2022-01-19 Thread Hai Shi
Hai Shi added the comment: > If not, I'd like to close this (with apologies for not doing my research and > letting Hai Shi do unmerged work). > If a use case is found, I suspect it'll need a different solution – perhaps > allowing PyType_Slot·s OK, I close this bpo. We can reopen or create

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-11-16 Thread Petr Viktorin
Petr Viktorin added the comment: Back to this issue -- do we have any use case other than setting the internal Py_TPFLAGS_DISALLOW_INSTANTIATION flag? If not, I'd like to close this (with apologies for not doing my research and letting Hai Shi do unmerged work). If a use case is found, I

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-26 Thread Petr Viktorin
Petr Viktorin added the comment: PEP 630 has motivations and technical notes. What needs to be documented better is how both applies to stdlib. Specifically: - list the behavior changes when static types are converted to heap types (mutability, pickleability, any more?), and document how to

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-23 Thread Hai Shi
Hai Shi added the comment: > PEP 3121 is not withdrawn; PEP 630 is not withdrawn. What is then expected of > a new PEP? Or the other way around: what is missing from those two PEPs? Thanks Erlend for the relative information you provided. AFAIK, the stdlib is not the extension module

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-23 Thread Erlend E. Aasland
Erlend E. Aasland added the comment: Oh, I found PEP 3121 (Extension Module Initialization and Finalization). It is a Standards Track PEP and it is accepted. The abstract is pretty short. Let me just repost it here, for convenience: Extension module initialization currently has a few

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-23 Thread Erlend E. Aasland
Erlend E. Aasland added the comment: Petr: > Hmm, the best I can find is > https://github.com/python/steering-council/blob/main/updates/2021-02-steering-council-update.md#february-08 Perfect, thanks! Christian: Thanks for your input. If this was a discussion on Discourse, I'd press the L

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-23 Thread Christian Heimes
Christian Heimes added the comment: > Given that some essential third party modules are not going down this path, > it is unlikely that general users would ever see any benefit. I disagree with your statement. It does not reflect my experience, too. Heap types are a prerequisite for abi3

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-23 Thread Petr Viktorin
Petr Viktorin added the comment: > Quoting PEP 630 (active PEP): > > Whenever this PEP mentions extension modules, the advice also applies to > built-in modules, such as the C parts of the standard library. The standard > library is expected to switch to per-module state early. Maybe I

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-23 Thread Erlend E. Aasland
Erlend E. Aasland added the comment: Thanks, Petr. Yes, that is correct. PEP 630 (I assume you meant 630, not 640) still describes the _rationale_ very well. I guess what's needed is a Standards Track PEP based on PEP 630 (IIUC). -- ___ Python

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-23 Thread Petr Viktorin
Petr Viktorin added the comment: Pep 640 is Informational, and per PEP 1: Informational PEPs do not necessarily represent a Python community consensus or recommendation, so users and implementers are free to ignore Informational PEPs or follow their advice. (Will reply more tomorrow, I'm

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-22 Thread Erlend E. Aasland
Erlend E. Aasland added the comment: > My understanding is that this entire class of code changes has been put on > hold pending Steering Council approval. Can you please point me to the official SC statement regarding this? I cannot find it. > It represents a great deal of code churn and

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: > Why is not PEP 630 enough? My understanding is that this entire class of code changes has been put on hold pending Steering Council approval. It represents a great deal of code churn and creation on new APIs. Several of the patches had had negative

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-22 Thread Erlend E. Aasland
Erlend E. Aasland added the comment: >> Can I do something for this pending PEP? > > Ask Victor, he should know more. But as far as I know, no one started on it > yet. Quoting PEP 630 (active PEP): Whenever this PEP mentions extension modules, the advice also applies to built-in

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-22 Thread Erlend E. Aasland
Erlend E. Aasland added the comment: FYI, see bpo-43916 regarding the introduction and rationale of introducing Py_TPFLAGS_DISALLOW_INSTANTIATION. Slightly related: bpo-43908 -- ___ Python tracker

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-22 Thread Petr Viktorin
Petr Viktorin added the comment: > Can I do something for this pending PEP? Ask Victor, he should know more. But as far as I know, no one started on it yet. > I guess the outside user will use it MAYBE. Py_TPFLAGS_DISALLOW_INSTANTIATION is not part of the limited API, so it would be nice

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-20 Thread Hai Shi
Hai Shi added the comment: >Ah, sorry, I overlooked the flags. It's Okay. >This does beg the question: what else from PyType_Spec will be needed? I guess we don't want to allow additional slots/methods. +1. >Also, note that converting the stdlib to heap types is suspended, pending a >PEP.

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-19 Thread Petr Viktorin
Petr Viktorin added the comment: Ah, sorry, I overlooked the flags. This does beg the question: what else from PyType_Spec will be needed? I guess we don't want to allow additional slots/methods. (Combining them would be hard anyway; if someone needs them they should make a subclass.) So it

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-13 Thread Hai Shi
Hai Shi added the comment: > The only thing the proposed PR adds is a way to set ht_module, which actually > isn't very useful (it's used for module state access. Hm, there have some static types. so I create the PyStructSequence_FromModuleAndDes() could receive tp_flags and try convert

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-12 Thread Petr Viktorin
Petr Viktorin added the comment: Oh! I assumed this bug wasn't resolved, but it is -- in bpo-34784. Sorry, I should have checked! The only thing the proposed PR adds is a way to set ht_module, which actually isn't very useful (it's used for module state access, but PyStructSequence_Desc

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-09-26 Thread Hai Shi
Change by Hai Shi : -- keywords: +patch pull_requests: +26955 stage: -> patch review pull_request: https://github.com/python/cpython/pull/28573 ___ Python tracker ___

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-09-25 Thread Hai Shi
Hai Shi added the comment: > More generally, this would need solving one of the remaining limitations of > the limited API (PEPs 489, 630): type-specific data. Agree. We can't track and destroy the memory block created from the heap now. -- ___

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-09-21 Thread Petr Viktorin
Petr Viktorin added the comment: Subinterpreters are not the only reason to do this (and they're not *my* reason to do it). Adding a way to create PyStructSequence heap will help users of the stable ABI, where reduced performance is a known tradeoff (see

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-09-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: Is the subinterpreters work still on hold pending a PEP? I thought that conversions to heap types had been suspended because there is a Steering Council level cost benefit decision. Mostly it seems that everything helps subinterpreters makes code worse

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-09-13 Thread Erlend E. Aasland
Change by Erlend E. Aasland : -- nosy: +erlendaasland ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-09-06 Thread STINNER Victor
Change by STINNER Victor : -- nosy: -vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-09-06 Thread Hai Shi
Hai Shi added the comment: > But I encourage you to try, so you get a better understanding of the problem > :) OK, thanks, Petr. I try to add this C API to see what will happen :) -- ___ Python tracker

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-09-06 Thread Petr Viktorin
Petr Viktorin added the comment: I think you will run into issues with allocating tp_members, because there isn't a good mechanism to for type objects to manage C-level data. But I encourage you to try, so you get a better understanding of the problem :) --

[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-09-06 Thread hai shi
New submission from hai shi : Copied from https://bugs.python.org/issue40512#msg399847: Victor: PyStructSequence_InitType2() is not compatible with subinterpreters: it uses static types. Moreover, it allocates tp_members memory which is not released when the type is destroyed. But I'm not