{"record":{"id":"a940257a10fe2a0f","repo":"arduino/Arduino","slug":"update-takes-at-least-1-argument-0-given","errorCode":null,"errorMessage":"update() takes at least 1 argument (0 given)","messagePattern":"update\\(\\) takes at least 1 argument \\(0 given\\)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"arduino-core/src/processing/app/i18n/python/requests/packages/urllib3/packages/ordered_dict.py","lineNumber":156,"sourceCode":"    def iteritems(self):\n        'od.iteritems -> an iterator over the (key, value) items in od'\n        for k in self:\n            yield (k, self[k])\n\n    def update(*args, **kwds):\n        '''od.update(E, **F) -> None.  Update od from dict/iterable E and F.\n\n        If E is a dict instance, does:           for k in E: od[k] = E[k]\n        If E has a .keys() method, does:         for k in E.keys(): od[k] = E[k]\n        Or if E is an iterable of items, does:   for k, v in E: od[k] = v\n        In either case, this is followed by:     for k, v in F.items(): od[k] = v\n\n        '''\n        if len(args) > 2:\n            raise TypeError('update() takes at most 2 positional '\n                            'arguments (%d given)' % (len(args),))\n        elif not args:\n            raise TypeError('update() takes at least 1 argument (0 given)')\n        self = args[0]\n        # Make progressively weaker assumptions about \"other\"\n        other = ()\n        if len(args) == 2:\n            other = args[1]\n        if isinstance(other, dict):\n            for key in other:\n                self[key] = other[key]\n        elif hasattr(other, 'keys'):\n            for key in other.keys():\n                self[key] = other[key]\n        else:\n            for key, value in other:\n                self[key] = value\n        for key, value in kwds.items():\n            self[key] = value\n\n    __update = update  # let subclasses override update without breaking __init__","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/arduino/Arduino/blob/a0df6e0e83b652c72bc78b0a1376c54d6ebc3bee/arduino-core/src/processing/app/i18n/python/requests/packages/urllib3/packages/ordered_dict.py#L138-L174","documentation":"The vendored OrderedDict.update() requires at least one positional argument (the self instance in its unbound-style signature); calling it with zero positional arguments raises this TypeError. In practice this happens when update() is invoked as an unbound method without an OrderedDict instance, or with no mapping/iterable source at all.","triggerScenarios":"Calling OrderedDict.update() with no arguments; calling it unbound as OrderedDict.update(other) where `other` lands in the self slot; keyword-only usage like od.update(**kwargs) with no positional arg.","commonSituations":"Porting dict.update(**kw) style calls that worked on built-in dict but not on this backport; reflecting/patching update() and dropping the instance argument.","solutions":["Call it as a bound method on an instance with one source: od.update(mapping).","If updating from kwargs on this backport, pass a dict: od.update(kwargs_dict).","Ensure the class is instantiated before updating instead of calling the function object directly."],"exampleFix":"// before\nOrderedDict.update({'a': 1})  # unbound, missing instance\n// after\nod = OrderedDict()\nod.update({'a': 1})","handlingStrategy":"validation","validationCode":"if not isinstance(od, dict):\n    raise TypeError('update() must be called on an OrderedDict instance')\nassert source is not None","typeGuard":"def is_ordered_dict(o):\n    return isinstance(o, dict) and hasattr(o, 'popitem') and hasattr(o, 'move_to_end') or isinstance(o, dict)","tryCatchPattern":"try:\n    od.update(source)\nexcept TypeError as e:\n    if 'at least 1 argument' in str(e):\n        raise ValueError('update() called without a source mapping') from e\n    raise","preventionTips":["Always call update() as a bound method on an instance with a positional source.","Never call the unbound function without the instance as first argument.","Do not rely on keyword-only updates for this backport; pass a mapping or iterable of pairs."],"tags":["python","typeerror","ordered-dict","argument-count"],"backgroundTag":"missing-required-argument","analyzedSha":"a0df6e0e83b652c72bc78b0a1376c54d6ebc3bee","analyzedAt":"2026-09-06T10:13:38.901Z","contentChangedAt":"2026-09-06T10:13:38.901Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}