[issue27140] Opcode for creating dict with constant keys

2016-06-16 Thread STINNER Victor
STINNER Victor added the comment: Nice enhancement. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://

[issue27140] Opcode for creating dict with constant keys

2016-06-16 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ _

[issue27140] Opcode for creating dict with constant keys

2016-06-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, I left it for symmetry and for easier modifying if we will add more restrictions on using BUILD_CONST_KEY_MAP. Thank you for your reviews Demur and Benjamin. -- ___ Python tracker

[issue27140] Opcode for creating dict with constant keys

2016-06-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset 27b0dbaf0ea8 by Serhiy Storchaka in branch 'default': Issue #27140: Added BUILD_CONST_KEY_MAP opcode. https://hg.python.org/cpython/rev/27b0dbaf0ea8 -- nosy: +python-dev ___ Python tracker

[issue27140] Opcode for creating dict with constant keys

2016-06-11 Thread Benjamin Peterson
Benjamin Peterson added the comment: Okay, I think it's fine then. However, you have a for loop in compiler_subkwargs which only executes once. -- ___ Python tracker ___ ___

[issue27140] Opcode for creating dict with constant keys

2016-06-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I have just tested. BUILD_CONST_KEY_MAP doesn't used in it, because at this time -0. still is not a constant, but an expression (negation of 0.). With -0 it doesn't work too. $ ./python -m dis {0: 1, 2: 3} 1 0 LOAD_CONST 0 (1)

[issue27140] Opcode for creating dict with constant keys

2016-06-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I didn't test, but I'm sure this change doesn't break this function. Otherwise functions containing (0.0, 1) and (-0.0, -1) would be broken. Actually they were broken until recently Victor fixed this bug. -- ___ P

[issue27140] Opcode for creating dict with constant keys

2016-06-09 Thread Benjamin Peterson
Benjamin Peterson added the comment: Does this change break this function? def subtle(): one = {-0. : 'a', -1: 'b'} two = {0. : 'a', -1: 'b'} assert all(math.copysign(1, x) < 0 for x in one) assert any(math.copysign(1, x) > 0 for x in two) Perhaps you should restrict yourself to s

[issue27140] Opcode for creating dict with constant keys

2016-06-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Could anyone please make a review? -- keywords: +needs review ___ Python tracker ___ ___ Python-bu

[issue27140] Opcode for creating dict with constant keys

2016-06-04 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +Mark.Shannon ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue27140] Opcode for creating dict with constant keys

2016-06-03 Thread Demur Rumed
Demur Rumed added the comment: When is this intended to be merged? I've been waiting on this before updating the patch @ #27095 with fixes to other code review comments -- ___ Python tracker __

[issue27140] Opcode for creating dict with constant keys

2016-05-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Perhaps BUILD_CONST_KEY_MAP? LGTM. > Ideally the opcode could ellide the LOAD_CONST for the tuple. ie have > LOAD_CONST 2 (1, 2, 3), BUILD_CONST_KEY_MAP 3 be BUILD_CONST_KEY_MAP 2 (1, 2, > 3). However that'd require stack_effect to somehow lookup the cons

[issue27140] Opcode for creating dict with constant keys

2016-05-30 Thread Demur Rumed
Demur Rumed added the comment: Perhaps BUILD_CONST_KEY_MAP? Ideally the opcode could ellide the LOAD_CONST for the tuple. ie have LOAD_CONST 2 (1, 2, 3), BUILD_CONST_KEY_MAP 3 be BUILD_CONST_KEY_MAP 2 (1, 2, 3). However that'd require stack_effect to somehow lookup the const tuple Thinking to

[issue27140] Opcode for creating dict with constant keys

2016-05-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Proposed patch adds the BUILD_MAP_EX opcode (maybe somebody propose better name?). It takes values from the stack and keys from the tuple on the top of the stack. Currently it affects only creating a dict with const keys and calling a function with keywords

[issue27140] Opcode for creating dict with constant keys

2016-05-27 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python

[issue27140] Opcode for creating dict with constant keys

2016-05-27 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: BUILD_MAP, BUILD_MAP_UNPACK and BUILD_MAP_UNPACK_WITH_CALL need pushing key-value pairs on the stack. If keys and values are not constant, this is correct order of evaluating them. But if keys are constant (very common case), the order of pushing them does