[issue34320] Creating dict from OrderedDict doesn't preserve order

2018-09-25 Thread INADA Naoki
Change by INADA Naoki : -- dependencies: -Add tests for PEP 468 and PEP 520 resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue34320] Creating dict from OrderedDict doesn't preserve order

2018-09-25 Thread miss-islington
miss-islington added the comment: New changeset d45a9613402b686f8afd3dd5b6acf8141f14d711 by Miss Islington (bot) in branch '3.6': [3.6] bpo-34320: Fix dict(o) didn't copy order of dict subclass (GH-8624) (GH-9583) https://github.com/python/cpython/commit/d45a9613402b686f8afd3dd5b6acf8141f14d

[issue34320] Creating dict from OrderedDict doesn't preserve order

2018-09-25 Thread miss-islington
miss-islington added the comment: New changeset 12e3e80241e91df79811f53ff372e28e9371bf9b by Miss Islington (bot) in branch '3.7': bpo-34320: Fix dict(o) didn't copy order of dict subclass (GH-8624) https://github.com/python/cpython/commit/12e3e80241e91df79811f53ff372e28e9371bf9b --

[issue34320] Creating dict from OrderedDict doesn't preserve order

2018-09-25 Thread miss-islington
Change by miss-islington : -- pull_requests: +8983 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue34320] Creating dict from OrderedDict doesn't preserve order

2018-09-25 Thread miss-islington
Change by miss-islington : -- pull_requests: +8984 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue34320] Creating dict from OrderedDict doesn't preserve order

2018-09-25 Thread miss-islington
miss-islington added the comment: New changeset 2aaf98c16ae3070378de523a173e29644037d8bd by Miss Islington (bot) (INADA Naoki) in branch 'master': bpo-34320: Fix dict(o) didn't copy order of dict subclass (GH-8624) https://github.com/python/cpython/commit/2aaf98c16ae3070378de523a173e29644037d

[issue34320] Creating dict from OrderedDict doesn't preserve order

2018-09-25 Thread Eric Snow
Eric Snow added the comment: > Conversion is happens when type() (or metaclass()) is called. Right. So an extra test to cover the __prepare__ case is somewhat redundant. I only suggested it because type() is called implicitly and the test would make the conversion case clear. However, it

[issue34320] Creating dict from OrderedDict doesn't preserve order

2018-09-25 Thread INADA Naoki
INADA Naoki added the comment: Conversion is happens when type() (or metaclass()) is called. And I added test for it already. https://github.com/python/cpython/pull/8624/files#diff-7ba610fbe5686a1d67c5504312be4817R1977 Why regression test for this bugfix need to use __prepare__? -- _

[issue34320] Creating dict from OrderedDict doesn't preserve order

2018-09-25 Thread Eric Snow
Eric Snow added the comment: There is a conversion. See builtin___build_class__ in Python/bltinmodule.c (and the LOAD_BUILD_CLASS target in Python/ceval.c). Specifically, the metaclass (e.g. the builtin type) is instantiated using the namespace from the class definition. The metaclass cop

[issue34320] Creating dict from OrderedDict doesn't preserve order

2018-09-25 Thread INADA Naoki
INADA Naoki added the comment: > Perhaps another good test of the same thing would be with a metaclass that > returns an OrderedDict from __prepare__(): It is not relating to this issue: there are no conversion happened. Should I add the test in this PR? --

[issue34320] Creating dict from OrderedDict doesn't preserve order

2018-09-20 Thread Eric Snow
Eric Snow added the comment: FWIW, the PEP 520 example isn't exactly right. PEP 520 is about the class definition namespace, not the namespace object passed to type(). That always does the right thing, since the default class definition namespace is dict (which happens to be ordered in 3.6

[issue34320] Creating dict from OrderedDict doesn't preserve order

2018-09-20 Thread Eric Snow
Change by Eric Snow : -- Removed message: https://bugs.python.org/msg325897 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue34320] Creating dict from OrderedDict doesn't preserve order

2018-09-20 Thread Eric Snow
Eric Snow added the comment: FWIW, the PEP 520 example isn't exactly right. PEP 520 is about the class definition namespace, not the namespace object passed to type(). That always does the right thing, since the default class definition namespace is dict (which happens to be ordered in 3.6

[issue34320] Creating dict from OrderedDict doesn't preserve order

2018-08-06 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- dependencies: +Add tests for PEP 468 and PEP 520 ___ Python tracker ___ ___ Python-bugs-list mailing

[issue34320] Creating dict from OrderedDict doesn't preserve order

2018-08-02 Thread INADA Naoki
Change by INADA Naoki : -- keywords: +patch pull_requests: +8129 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-list

[issue34320] Creating dict from OrderedDict doesn't preserve order

2018-08-02 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : >>> from collections import OrderedDict >>> od = OrderedDict([('a', 1), ('b', 2)]) >>> od.move_to_end('a') >>> od OrderedDict([('b', 2), ('a', 1)]) >>> dict(od) {'a': 1, 'b': 2} This affects also PEP 468. >>> def f(**kwargs): return kwargs ... >>> f(**od