diff --git a/py/dict.go b/py/dict.go index 61b6e5cd..41b958f6 100644 --- a/py/dict.go +++ b/py/dict.go @@ -29,6 +29,10 @@ var ( func init() { StringDictType.Dict["items"] = MustNewMethod("items", func(self Object, args Tuple) (Object, error) { + err := UnpackTuple(args, nil, "items", 0, 0) + if err != nil { + return nil, err + } sMap := self.(StringDict) o := make([]Object, 0, len(sMap)) for k, v := range sMap { diff --git a/py/tests/dict.py b/py/tests/dict.py index 1fa317c3..5f1d0a64 100644 --- a/py/tests/dict.py +++ b/py/tests/dict.py @@ -1,6 +1,7 @@ # Copyright 2018 The go-python Authors. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. +from libtest import assertRaises doc="str" assert str({}) == "{}" @@ -35,6 +36,7 @@ assert v == "b" if k == "c": assert v == 5.5 +assertRaises(TypeError, a.items, 'a') doc="__contain__" a = {'hello': 'world'} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy