On 05/23/2015 09:46 PM, Guido van       Rossum wrote:
    
           How will __definition_order__ be set in the case         where __prepare__ doesn't return an OrderedDict? Or where a         custom metaclass's __new__ calls its superclass's __new__ with a         plain dict? (I just wrote some code that does that. :-)
                
    In his patch, type_new tests to see if the dict passed in is an     ordered dict (PyODict_Check).  __definition_order__ is only created     and populated if it passes the test.
    
http://bugs.python.org/file39446/odict-class-definition-namespace.diff
    
    
    /arry
  ">

(original) (raw)

But isn't that also a problem? It would make the existence of that member a bit unpredictable.

On Saturday, May 23, 2015, Larry Hastings <larry@hastings.org> wrote:



On 05/23/2015 09:46 PM, Guido van Rossum wrote:
How will \_\_definition\_order\_\_ be set in the case where \_\_prepare\_\_ doesn't return an OrderedDict? Or where a custom metaclass's \_\_new\_\_ calls its superclass's \_\_new\_\_ with a plain dict? (I just wrote some code that does that. :-)

In his patch, type\_new tests to see if the dict passed in is an ordered dict (PyODict\_Check). \_\_definition\_order\_\_ is only created and populated if it passes the test.
http://bugs.python.org/file39446/odict-class-definition-namespace.diff

/arry


--
--Guido van Rossum (on iPad)