[issue41618] [C API] How many slots of static types should be exposed in PyType_GetSlot()

2021-01-15 Thread hai shi
hai shi added the comment: >Not a function, shouldn't be used with PyType_Slot: > * tp_dict - I'd add a PyType_GetDict if there is a need to get this > * tp_mro - I'd add a PyType_GetMRO if there is a need to get this I checked some other projects which use type fileds directly. cpython

[issue41618] [C API] How many slots of static types should be exposed in PyType_GetSlot()

2020-12-29 Thread Petr Viktorin
Petr Viktorin added the comment: Documentation for developers *of* CPython should generally go in the dev guide, a comment in the code, or in issues like this. -- ___ Python tracker

[issue41618] [C API] How many slots of static types should be exposed in PyType_GetSlot()

2020-11-07 Thread hai shi
hai shi added the comment: > Do you mean something like "only expose a slot if you have a reason for > > exposing it"? That sounds like a tautology. > Where in the docs would this go? Add a friend Note in docs of `PyType_GetSlot` MAYBE? > You mean nb_reserved, right? Yes, thanks for your

[issue41618] [C API] How many slots of static types should be exposed in PyType_GetSlot()

2020-11-05 Thread Petr Viktorin
Petr Viktorin added the comment: My views on individual slots: Not a function, shouldn't be used with PyType_Slot: * tp_dict - I'd add a PyType_GetDict if there is a need to get this * tp_mro - I'd add a PyType_GetMRO if there is a need to get this (There are existing slots that aren't

[issue41618] [C API] How many slots of static types should be exposed in PyType_GetSlot()

2020-11-03 Thread Petr Viktorin
Petr Viktorin added the comment: > Can we write those info to docs? In case some developer want to exposing slot > in future. Do you mean something like "only expose a slot if you have a reason for exposing it"? That sounds like a tautology. Where in the docs would this go? > nb_inserved

[issue41618] [C API] How many slots of static types should be exposed in PyType_GetSlot()

2020-10-30 Thread hai shi
hai shi added the comment: > IMO, a slot should be exposed if there is some reason for exposing it. Can we write those info to docs? In case some developer want to exposing slot in future. > Which other slots are we missing? nb_inserved in PyNumberMethods should be removed? --

[issue41618] [C API] How many slots of static types should be exposed in PyType_GetSlot()

2020-10-20 Thread Petr Viktorin
Petr Viktorin added the comment: Also: PyType_GetSlot should return a function pointer, not data. For some slots (Py_tp_doc, Py_tp_methods, Py_tp_members, Py_tp_getset) that ship has sailed, but for new ones, we should honor the distinction between data and function pointers. The C standard

[issue41618] [C API] How many slots of static types should be exposed in PyType_GetSlot()

2020-09-08 Thread Petr Viktorin
Petr Viktorin added the comment: IMO, a slot should be exposed if there is some reason for exposing it. bpo-41073 talks about tp_dealloc, which is already exposed as Py_tp_dealloc. Recently, Py_bf_* slots were exposed (but not as part of the limited API), in bpo-40724 which links to the

[issue41618] [C API] How many slots of static types should be exposed in PyType_GetSlot()

2020-08-23 Thread hai shi
hai shi added the comment: related bpo: bpo-41073 -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue41618] [C API] How many slots of static types should be exposed in PyType_GetSlot()

2020-08-23 Thread hai shi
New submission from hai shi : In order to resolve bpo41073, we want to extend `PyType_GetSlot()` to accept static types. But there have another question we should be considered: How many slots should be exposed in `PyType_GetSlot()`. petr's opinion from PR-21931:I would not want to expose