GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Bug]: `collections._tuplegetter` accepts fewer than two arguments and keyword arguments · Issue #1249 · oracle/graalpython

[Bug]: collections._tuplegetter accepts fewer than two arguments and keyword arguments #1249

New issue
Copy link
New issue
Copy link
Open
#1261
Open
[Bug]: collections._tuplegetter accepts fewer than two arguments and keyword arguments#1249
#1261
Copy link
Labels
bugSomething isn't workingSomething isn't working

Description

@jseop-lim
jseop-lim
opened on Oct 31, 2026
Issue body actions

Describe the bug

_collections._tuplegetter treats index and doc as optional keyword-capable parameters. A call with fewer than two arguments builds a getter for index 0, while CPython requires exactly two positional arguments and rejects keywords.

Operating system

macOS

CPU architecture

ARM64

GraalPy version

master a3009f9 (Python 3.13.14); also reproduced on 25.0.2 (Python 3.12.8)

JDK version

No response

Context configuration

No response

Steps to reproduce

import collections
print(type(collections._tuplegetter(0)))

GraalPy master a3009f9:

<class '_collections._tuplegetter'>

Expected behavior

CPython 3.13.14 (same on 3.12.13):

TypeError: _tuplegetter expected 2 arguments, got 1

Stack trace

Additional context

_tuplegetter() with no arguments also succeeds, and _tuplegetter(0, doc=None) and _tuplegetter(index=0, doc=None) succeed where CPython raises TypeError: _tuplegetter() takes no keyword arguments.

Root Cause

The tp_new of TupleGetterNode declares @SlotSignature(name = J_TUPLE_GETTER, parameterNames = {"cls", "index", "doc"}) with no minimum or positional-only count (TupleGetterBuiltins.java#L97-L99), so both arguments are optional and can be passed by keyword. CPython's tuplegetter_new rejects keywords and then calls _PyArg_CheckPositional("_tuplegetter", nargs, 2, 2) (_collectionsmodule.c.h#L607-L613).

Fix Suggestion

Add minNumOfPositionalArgs = 3, numOfPositionalOnlyArgs = 3 to that @SlotSignature.

Activity

  1. jseop-lim
    added
    bugSomething isn't workingSomething isn't working
    on Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.