]> granicus.if.org Git - python/commit
Make dictionary() a real constructor. Accepts at most one argument, "a
authorTim Peters <tim.peters@gmail.com>
Sun, 2 Sep 2001 08:22:48 +0000 (08:22 +0000)
committerTim Peters <tim.peters@gmail.com>
Sun, 2 Sep 2001 08:22:48 +0000 (08:22 +0000)
commit25786c0851da8665bdbba948ddb16b23a040bbb2
tree6bbe5fef549dc5105b642567c9ce1e0e87a0b94f
parent1b8ca0d87a806a5098496ad4864a975707cd6bac
Make dictionary() a real constructor.  Accepts at most one argument, "a
mapping object", in the same sense dict.update(x) requires of x (that x
has a keys() method and a getitem).
Questionable:  The other type constructors accept a keyword argument, so I
did that here too (e.g., dictionary(mapping={1:2}) works).  But type_call
doesn't pass the keyword args to the tp_new slot (it passes NULL), it only
passes them to the tp_init slot, so getting at them required adding a
tp_init slot to dicts.  Looks like that makes the normal case (i.e., no
args at all) a little slower (the time it takes to call dict.tp_init and
have it figure out there's nothing to do).
Lib/test/test_descr.py
Objects/dictobject.c