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 — Consistent use of valid index check · Issue #99761 · python/cpython

Consistent use of valid index check #99761

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
Consistent use of valid index check#99761
Copy link
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement

Description

@eendebakpt
eendebakpt
opened on Nov 24, 2022
Issue body actions

Feature or enhancement

In listobject.c there is an optimization to check whether an index is valid (e.g. 0 <= index < N) using a single comparison. The same optimization is not used in other files such as tupleobject.c.

By replacing index checks with a single macro that includes the optimization we have consistency in the code and have the optimized check for all index checks.

Previous discussion

Idea first mentioned at faster-cpython/ideas#498

Linked PRs

  • gh-99761: add invalid_index macro #99762
  • gh-99761: Add _PyLong_IsPositiveSingleDigit #100064

Activity

  1. eendebakpt
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Nov 24, 2022
  2. kumaraditya303
    added a commit that references this issue on Dec 22, 2022

    gh-99761: Add `_PyLong_IsPositiveSingleDigit` function to check for s…

    2b82c36
  3. iritkatriel
    added a commit that references this issue on Dec 28, 2022

    Merged main into regmachine branch (#50)

    fdc73cb
  4. iritkatriel
    added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    on Nov 27, 2023
  5. serhiy-storchaka commented on Jun 8, 2024

    @serhiy-storchaka
    serhiy-storchaka
    on Jun 8, 2024
    Member
    More actions

    This is a duplicate of #72583.

  6. serhiy-storchaka
    closed this as not plannedon Jun 8, 2024
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

    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement

    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.