Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# The Universal Permissive License (UPL), Version 1.0
Expand Down Expand Up @@ -57,3 +57,13 @@ def test_import():
except ImportError:
imported = False
assert imported


def test_tuplegetter_arguments():
from collections import _tuplegetter
assert_raises(TypeError, _tuplegetter)
assert_raises(TypeError, _tuplegetter, 0)
assert_raises(TypeError, _tuplegetter, 0, None, 1)
assert_raises(TypeError, _tuplegetter, 0, doc=None)
assert_raises(TypeError, _tuplegetter, index=0, doc=None)
assert _tuplegetter(1, 'doc').__get__((10, 20)) == 20
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The Universal Permissive License (UPL), Version 1.0
Expand Down Expand Up @@ -95,7 +95,7 @@ protected List<? extends NodeFactory<? extends PythonBuiltinBaseNode>> getNodeFa
}

@Slot(value = SlotKind.tp_new, isComplex = true)
@SlotSignature(name = J_TUPLE_GETTER, parameterNames = {"cls", "index", "doc"})
@SlotSignature(name = J_TUPLE_GETTER, minNumOfPositionalArgs = 3, numOfPositionalOnlyArgs = 3, parameterNames = {"cls", "index", "doc"})
@ArgumentClinic(name = "index", conversion = ArgumentClinic.ClinicConversion.Index)
@GenerateNodeFactory
public abstract static class TupleGetterNode extends PythonTernaryClinicBuiltinNode {
Expand Down