Pure Python operator.index doesn't match the C version.

Open
#62,912 23 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
c, python
Domain
backend

Research direction

Start by reviewing operator_index.patch through operator_index_4.patch and the linked PRs gh-148023 and gh-148025, then inspect the current operator.index entry point. Compare the pure-Python and C behavior, including the dependency on bpo-17576; done means both implementations agree for the reported cases.

Written by the indexing model from the issue text.

Description

3.13 3.14 3.15 extension-modules type-bug
BPO 18712
Nosy @arigo, @mdickinson, @ericsnowcurrently, @zware, @serhiy-storchaka, @corona10, @iritkatriel
Dependencies
  • bpo-17576: PyNumber_Index() is not int-subclass friendly (or operator.index() docs lie)
  • Files
  • operator_index.patch
  • x.py
  • operator_index_2.patch
  • y.py
  • operator_index_3.patch
  • operator_index_4.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2013-08-12.14:09:38.011>
    labels = ['extension-modules', 'type-bug', '3.11']
    title = "Pure Python operator.index doesn't match the C version."
    updated_at = <Date 2021-10-02.15:33:51.696>
    user = 'https://github.com/mdickinson'
    

    bugs.python.org fields:

    activity = <Date 2021-10-02.15:33:51.696>
    actor = 'corona10'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Extension Modules']
    creation = <Date 2013-08-12.14:09:38.011>
    creator = 'mark.dickinson'
    dependencies = ['17576']
    files = ['31273', '31334', '31335', '31336', '31344', '31353']
    hgrepos = []
    issue_num = 18712
    keywords = ['patch']
    message_count = 21.0
    messages = ['194966', '195000', '195006', '195064', '195451', '195454', '195457', '195458', '195474', '195476', '195489', '195490', '195510', '195513', '195545', '195546', '195547', '195548', '195549', '195665', '401603']
    nosy_count = 7.0
    nosy_names = ['arigo', 'mark.dickinson', 'eric.snow', 'zach.ware', 'serhiy.storchaka', 'corona10', 'iritkatriel']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue18712'
    versions = ['Python 3.11']
    

    Linked PRs
    • gh-148023
    • gh-148025
    Dominant language
    Python
    Stars
    77.2k
    Forks
    36k
    Avg merge
    1d 9h
    Merged PRs (30d)
    558

    Contributor guide

    Open the contributing guide

    First steps

    1. Read the whole issue, then the project's contributing guide.
    2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
    3. Fork the repository and make your change on a branch.
    4. Open a pull request that references the issue number.

    More from python/cpython

    All issues in python/cpython

    Similar issues

    More Python issues

    Get new issues in your inbox

    A short digest of beginner-friendly GitHub issues.