Issue 36936: CALL_FUNCTION_KW opcode: keyword names must be non-empty
Created on 2019-05-16 09:21 by jdemeyer, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 13357 | closed | jdemeyer, 2019-05-16 09:28 | |
| Messages (6) | |||
|---|---|---|---|
| msg342631 - (view) | Author: Jeroen Demeyer (jdemeyer) * ![]() |
Date: 2019-05-16 09:21 | |
Document and add an assertion that the "keyword names" tuple of the CALL_FUNCTION_KW opcode must be non-empty. This is already the case with the current compiler: if there are no keyword arguments in a call, then the CALL_FUNCTION_KW opcode is not used. In light of https://github.com/python/peps/pull/1049 it's good to make this an explicit guarantee. |
|||
| msg342636 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2019-05-16 10:22 | |
What happens when pass an empty tuple? |
|||
| msg342638 - (view) | Author: Jeroen Demeyer (jdemeyer) * ![]() |
Date: 2019-05-16 10:37 | |
> What happens when pass an empty tuple? The way how bytecode is compiled, that doesn't actually happen so it's an entirely hypothetical question. The various XXX_FastCallKeywords functions seem to allow passing an empty tuple to mean "no keyword arguments", so I guess that nothing breaks when you would actually pass an empty tuple |
|||
| msg342640 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2019-05-16 11:28 | |
Then I do not see a reason to add an assertion. |
|||
| msg342641 - (view) | Author: Jeroen Demeyer (jdemeyer) * ![]() |
Date: 2019-05-16 11:41 | |
Adding that assertion allows future optimizations and simplifications: with the assertion, "keyword arguments are passed" becomes equivalent to kwnames != NULL instead of kwnames != NULL && PyTuple_GET_SIZE(kwnames) > 0 This may not be useful right now, but it will become more useful when implementing PEP 590. |
|||
| msg343181 - (view) | Author: Petr Viktorin (petr.viktorin) * ![]() |
Date: 2019-05-22 11:46 | |
Closing per discussion in https://github.com/python/cpython/pull/13357 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:15 | admin | set | github: 81117 |
| 2019-05-22 11:46:56 | petr.viktorin | set | status: open -> closed resolution: not a bug messages: + msg343181 stage: patch review -> resolved |
| 2019-05-16 11:41:54 | jdemeyer | set | messages: + msg342641 |
| 2019-05-16 11:28:00 | serhiy.storchaka | set | messages: + msg342640 |
| 2019-05-16 10:37:23 | jdemeyer | set | messages: + msg342638 |
| 2019-05-16 10:22:30 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg342636 |
| 2019-05-16 09:28:04 | jdemeyer | set | keywords:
+ patch stage: patch review pull_requests: + pull_request13266 |
| 2019-05-16 09:21:33 | jdemeyer | create | |

