This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2020年06月22日 08:38 by vstinner, last changed 2022年04月11日 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 21395 | closed | shihai1991, 2020年07月08日 14:09 | |
| PR 21931 | merged | shihai1991, 2020年08月20日 17:23 | |
| Messages (10) | |||
|---|---|---|---|
| msg372049 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2020年06月22日 08:38 | |
To fix bpo-40170, I would like to modify Py_TRASHCAN_BEGIN() macro to use PyType_GetSlot() to get the deallocator function, rather than accessing directly the PyTypeObject.tp_dealloc member. The problem is that currently PyType_GetSlot() only works on heap allocated types. Would it be possible to add support for statically allocated types to PyType_GetSlot()? Py_TRASHCAN_BEGIN() is currently defined as: #define Py_TRASHCAN_BEGIN(op, dealloc) \ Py_TRASHCAN_BEGIN_CONDITION(op, \ Py_TYPE(op)->tp_dealloc == (destructor)(dealloc)) |
|||
| msg372084 - (view) | Author: Hai Shi (shihai1991) * (Python triager) | Date: 2020年06月22日 11:07 | |
Hi, victor. If you have much bpo need to manage, I could take a look in this week :) |
|||
| msg372541 - (view) | Author: Hai Shi (shihai1991) * (Python triager) | Date: 2020年06月29日 04:52 | |
historical discuss: bpo17162 |
|||
| msg372542 - (view) | Author: Hai Shi (shihai1991) * (Python triager) | Date: 2020年06月29日 04:56 | |
I create a PR in: https://github.com/shihai1991/cpython/pull/13/commits. Looks like It works. If we extend PyType_GetSlot() to accept non-heaptype, we need find a way to judge the max slot of non-heaptype. |
|||
| msg372559 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2020年06月29日 10:32 | |
> historical discuss: bpo17162 bpo-17162 added PyType_GetSlot(), but static types were not discussed there. |
|||
| msg372693 - (view) | Author: Hai Shi (shihai1991) * (Python triager) | Date: 2020年06月30日 14:01 | |
> bpo-17162 added PyType_GetSlot(), but static types were not discussed there. Thanks to correct my info. I paste this bpo just Larry have mentioned the static type in PyType_GetSlot() :) |
|||
| msg372791 - (view) | Author: Petr Viktorin (petr.viktorin) * (Python committer) | Date: 2020年07月01日 20:42 | |
> If we extend PyType_GetSlot() to accept non-heaptype, we need find a way to judge the max slot of non-heaptype. Static types can have some sub-slots structs but not others. A "max slot" will not help for types that have tp_as_mapping but not tp_as_number, for example. You'll probably need some table like typeslots.inc to record which sub-slots struct each slot belongs to. |
|||
| msg372864 - (view) | Author: Hai Shi (shihai1991) * (Python triager) | Date: 2020年07月02日 16:13 | |
> You'll probably need some table like typeslots.inc to record which sub-slots struct each slot belongs to. Looks like it's a good way to solve this probleam, Let me try it ;) |
|||
| msg380712 - (view) | Author: miss-islington (miss-islington) | Date: 2020年11月10日 20:53 | |
New changeset a13b26cac1519dad7bbc8651de7b826df7389d75 by Hai Shi in branch 'master': bpo-41073: PyType_GetSlot() can now accept static types. (GH-21931) https://github.com/python/cpython/commit/a13b26cac1519dad7bbc8651de7b826df7389d75 |
|||
| msg380723 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2020年11月10日 22:32 | |
> bpo-41073: PyType_GetSlot() can now accept static types. (GH-21931) Nice! It will be simpler to use PyType_GetSlot() in an extension with the limited C API, without having to care if the type is a static type or a heap type. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:59:32 | admin | set | github: 85245 |
| 2020年11月10日 22:32:37 | vstinner | set | messages: + msg380723 |
| 2020年11月10日 20:54:53 | petr.viktorin | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2020年11月10日 20:53:54 | miss-islington | set | nosy:
+ miss-islington messages: + msg380712 |
| 2020年08月20日 17:23:18 | shihai1991 | set | pull_requests: + pull_request21044 |
| 2020年07月08日 14:09:39 | shihai1991 | set | keywords:
+ patch stage: patch review pull_requests: + pull_request20543 |
| 2020年07月02日 16:13:19 | shihai1991 | set | messages: + msg372864 |
| 2020年07月01日 20:42:43 | petr.viktorin | set | nosy:
+ petr.viktorin messages: + msg372791 |
| 2020年06月30日 14:01:33 | shihai1991 | set | messages: + msg372693 |
| 2020年06月29日 10:32:16 | vstinner | set | messages: + msg372559 |
| 2020年06月29日 04:56:21 | shihai1991 | set | messages: + msg372542 |
| 2020年06月29日 04:52:22 | shihai1991 | set | messages: + msg372541 |
| 2020年06月22日 11:07:48 | shihai1991 | set | messages: + msg372084 |
| 2020年06月22日 11:02:58 | shihai1991 | set | nosy:
+ shihai1991 |
| 2020年06月22日 08:38:14 | vstinner | create | |