Message303340
| Author | Oren Milman |
|---|
| Recipients | Oren Milman, rhettinger, serhiy.storchaka, xiang.zhang |
|---|
| Date | 2017-09-29.16:52:28 |
|---|
| SpamBayes Score | -1.0 |
|---|
| Marked as misclassified | Yes |
|---|
| Message-id | <1506703948.7.0.213398074469.issue28280@psf.upfronthosting.co.za> |
|---|
| In-reply-to | |
|---|
| Content |
|---|
I would be happy to write a PR that implements that.However, i am not sure which way is better to construct a list from the returnvalue (an iterable, hopefully) of keys() etc.:- Call PyList_Type() (in each of PyMapping_Keys() etc.) on the iterable, and overwrite the error message in case it is a TypeError.- Write a helper function iterable_as_list(), which uses PyObject_GetIter() and PySequence_List(), and call it in each of PyMapping_Keys() etc.. (iterable_as_list() would receive "keys" etc., so that it would raise the appropriate error message, in case of a TypeError.)ISTM that the first one is simpler, but I am not sure about the performancedifference between them. |
|