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 — `Py_EnterRecursiveCall()`/`_Py_EnterRecursiveCall()` return value misused in a number of places · Issue #101965 · python/cpython

Py_EnterRecursiveCall()/_Py_EnterRecursiveCall() return value misused in a number of places #101965

New issue
Copy link
New issue
Copy link
Closed
#101966
Closed
Py_EnterRecursiveCall()/_Py_EnterRecursiveCall() return value misused in a number of places#101965
#101966
Copy link
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@OTheDev
OTheDev
opened on Feb 16, 2023
Issue body actions

Using grep, I identified 3 instances in main where code checks if Py_EnterRecursiveCall(...) < 0 (which just returns _Py_EnterRecursiveCall(...)) or _Py_EnterRecursiveCall(...) < 0.

  1. Py_EnterRecursiveCall() documentation only guarantees that a nonzero value is returned in the event of an error.
  2. The actual implementation can't return a negative value:

cpython/Include/internal/pycore_ceval.h

Lines 130 to 138 in 7644935

static inline int _Py_EnterRecursiveCallTstate(PyThreadState *tstate,
const char *where) {
return (_Py_MakeRecCheck(tstate) && _Py_CheckRecursiveCall(tstate, where));
}
static inline int _Py_EnterRecursiveCall(const char *where) {
PyThreadState *tstate = _PyThreadState_GET();
return _Py_EnterRecursiveCallTstate(tstate, where);
}

Linked PRs

  • gh-101965: Fix usage of Py_EnterRecursiveCall return value in _bisectmodule.c #101966

Activity

  1. OTheDev
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Feb 16, 2023
  2. OTheDev
    changed the title [-]`Py_EnterRecursiveCall()`/`_Py_EnterRecursiveCall()` return value misused in a number of places in `main`[/-] [+]`Py_EnterRecursiveCall()`/`_Py_EnterRecursiveCall()` return value misused in a number of places[/+] on Feb 16, 2023
  3. erlend-aasland commented on Feb 20, 2023

    @erlend-aasland
    erlend-aasland
    on Feb 20, 2023
    Contributor
    More actions

    Thanks for the report, Owain! In this case, I think we can close it as obsolete bco. Irit's patch #102078. Thanks for your interest in improving CPython :)

  4. erlend-aasland
    closed this as not plannedon Feb 20, 2023
  5. OTheDev commented on Feb 20, 2023

    @OTheDev
    OTheDev
    on Feb 20, 2023
    ContributorAuthor
    More actions

    @erlend-aasland Thanks! However, Irit's patch does not fix the instances in the bisect module. Will it be addressed there?

  6. erlend-aasland commented on Feb 20, 2023

    @erlend-aasland
    erlend-aasland
    on Feb 20, 2023
    Contributor
    More actions

    @erlend-aasland Thanks! However, Irit's patch does not fix the instances in the bisect module. Will it be addressed there?

    Well observed! Check with Irit on her PR. I'm guessing it is out of scope for her PR. In that case we'll reopen this and you can update your PR to target the remaining issues.

    Reacted by Irit Katriel
  7. erlend-aasland
    reopened this on Feb 20, 2023
  8. miss-islington
    closed this as completedin #101966on Feb 21, 2023
  9. miss-islington
    added a commit that references this issue on Feb 21, 2023

    gh-101965: Fix usage of Py_EnterRecursiveCall return value in _bisect…

    0f7a972
  10. carljm
    added a commit that references this issue on Feb 23, 2023

    Merge branch 'main' into lockfreecp

    b257a16
  11. python-sidebar
    added 2 commits that reference this issue on Sep 1, 2024

    pythongh-101965: Fix usage of Py_EnterRecursiveCall return value in _…

    cae0c82

    pythongh-101965: Fix usage of Py_EnterRecursiveCall return value in _…

    4d04a5a
  12. JelleZijlstra
    added a commit that references this issue on Sep 10, 2024

    pythongh-101965: Fix usage of Py_EnterRecursiveCall return value in _…

    95e4c76
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 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.