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 — Dead code in PyNumber_AsSsize_t() at L1542 · Issue #112634 · python/cpython

Dead code in PyNumber_AsSsize_t() at L1542 #112634

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
Dead code in PyNumber_AsSsize_t() at L1542#112634
Copy link
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@skirpichev
skirpichev
opened on Dec 3, 2023
Issue body actions

cpython/Objects/abstract.c

Lines 1526 to 1542 in 18203a6

PyObject *value = _PyNumber_Index(item);
if (value == NULL)
return -1;
/* We're done if PyLong_AsSsize_t() returns without error. */
result = PyLong_AsSsize_t(value);
if (result != -1)
goto finish;
PyThreadState *tstate = _PyThreadState_GET();
runerr = _PyErr_Occurred(tstate);
if (!runerr) {
goto finish;
}
/* Error handling code -- only manage OverflowError differently */
if (!PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {

But according to the docs (https://docs.python.org/3/c-api/long.html?#c.PyLong_AsSsize_t), PyLong_AsSsize_t() call above may raise only OverflowError (at that line "value" - is an int or int subclass). I think we can turn this line to an assert (or just remove it entirely).

// transformed to a separate issue per @serhiy-storchaka suggestion in #112145

Linked PRs

  • gh-112634: remove dead code in PyNumber_AsSsize_t() #112635

Activity

  1. skirpichev
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Dec 3, 2023
  2. skirpichev
    added a commit that references this issue on Dec 3, 2023

    pythongh-112634: remove dead code in PyNumber_AsSsize_t()

    2aaa4d7
  3. skirpichev
    changed the title [-]Dead code in PyNumber_AsSsize_t()[/-] [+]Dead code in PyNumber_AsSsize_t() at L1542[/+] on Dec 3, 2023
  4. skirpichev
    closed this as completedon Dec 8, 2023
  5. skirpichev
    closed this as not plannedon Dec 8, 2023
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

    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — 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.