Issue 30162: Add _PyTuple_Empty and make PyTuple_New(0) never failing
Created on 2017-04-25 16:51 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 1283 | closed | serhiy.storchaka, 2017-04-25 16:56 | |
| Messages (4) | |||
|---|---|---|---|
| msg292274 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2017-04-25 16:51 | |
Proposed patch makes the empty tuple be allocated in static memory rather than dynamic memory, expose a reference to it as _PyTuple_Empty, and makes PyTuple_New(0) never raising exceptions. This allows to simplify the code. No longer need to call PyTuple_New(0), check it's result for errors, and clean up it after the use, you just can use a borrowed reference _PyTuple_Empty. _PyTuple_Empty is for CPython internal use only. |
|||
| msg292297 - (view) | Author: Raymond Hettinger (rhettinger) * ![]() |
Date: 2017-04-26 04:03 | |
The patch shows a nice payoff from this short-cut, so go ahead and apply it. Still, I wish there were some aversion to posting a new patch every two days that alters twenty files all over the standard library. The rate of churn is alarming. |
|||
| msg350453 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2019-08-25 13:21 | |
Closed because several commenters found things to not like about it. |
|||
| msg350570 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2019-08-26 21:35 | |
We could add a _PyTuple_Init() function to ensure that the empty tuple singleton is created as soon as possible, as call it early, in pycore_init_types(). |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:45 | admin | set | github: 74348 |
| 2019-08-26 21:35:12 | vstinner | set | messages: + msg350570 |
| 2019-08-25 13:21:03 | serhiy.storchaka | set | status: open -> closed resolution: rejected messages: + msg350453 stage: patch review -> resolved |
| 2017-04-26 04:03:43 | rhettinger | set | nosy:
+ rhettinger messages: + msg292297 |
| 2017-04-25 16:56:01 | serhiy.storchaka | set | pull_requests: + pull_request1391 |
| 2017-04-25 16:51:52 | serhiy.storchaka | create | |
