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 — Add variant of `Py_BEGIN_CRITICAL_SECTION` that accepts a `NULL` argument · Issue #115432 · python/cpython

Add variant of Py_BEGIN_CRITICAL_SECTION that accepts a NULL argument #115432

New issue
Copy link
New issue
Copy link
Closed
Closed
Add variant of Py_BEGIN_CRITICAL_SECTION that accepts a NULL argument#115432
Copy link
Assignees
colesbury
Labels
topic-free-threadingtype-featureA feature request or enhancementA feature request or enhancement

Description

@colesbury
colesbury
opened on Feb 13, 2024
Issue body actions

Feature or enhancement

We should add a variant of Py_BEGIN_CRITICAL_SECTION / Py_END_CRITICAL_SECTION that accepts a possibly NULL object. If the passed object is NULL then nothing is locked or unlocked. Otherwise, it behaves like Py_BEGIN_CRITICAL_SECTION.

For example:

PyObject *object = maybe ? real_object : NULL;
Py_XBEGIN_CRITICAL_SECTION(object);
...
Py_XEND_CRITICAL_SECTION();

This will be useful in making set thread-safe. There are a number of functions that take an optional iterable that may be NULL. We want to lock it in the cases where it's not NULL.

I don't think we will need a version of Py_BEGIN_CRITICAL_SECTION2 that accepts optionally NULL arguments.

Linked PRs

  • gh-115432: Add critical section variant that handles a NULL object #115433
  • Revert "gh-115432: Add critical section variant that handles a NULL object (#115433)" #118861
  • [3.13] Revert "gh-115432: Add critical section variant that handles a NULL object (GH-115433)" (GH-118861) #118872

Activity

  1. colesbury
    added
    type-featureA feature request or enhancementA feature request or enhancement
    topic-free-threading
    on Feb 13, 2024
  2. colesbury
    added 2 commits that reference this issue on Feb 13, 2024

    pythongh-115432: Add critical section variant that handles a NULL object

    7b4e4e7

    gh-115432: Add critical section variant that handles a NULL object (#…

    ad4f909
  3. colesbury
    closed this as completedon Feb 15, 2024
  4. colesbury
    self-assigned this
    on Mar 19, 2024
  5. colesbury
    reopened this on Mar 19, 2024
  6. colesbury commented on Mar 19, 2024

    @colesbury
    colesbury
    on Mar 19, 2024
    ContributorAuthor
    More actions

    It turns out that we are not using this in set (or anywhere else), so I think we should revert the PR.

    Reacted by Erlend E. Aasland
  7. diegorusso
    added a commit that references this issue on Apr 17, 2024

    pythongh-115432: Add critical section variant that handles a NULL obj…

    f106877
  8. colesbury
    added 2 commits that reference this issue on May 9, 2024

    Revert "pythongh-115432: Add critical section variant that handles a …

    49a359e

    Revert "gh-115432: Add critical section variant that handles a NULL o…

    46c8081
  9. miss-islington
    added a commit that references this issue on May 9, 2024

    Revert "pythongh-115432: Add critical section variant that handles a …

    8f03d20
  10. colesbury
    added a commit that references this issue on May 9, 2024

    [3.13] Revert "gh-115432: Add critical section variant that handles a…

    b62cb52
  11. colesbury
    closed this as completedon May 9, 2024
  12. SonicField
    added a commit that references this issue on May 10, 2024

    Revert "pythongh-115432: Add critical section variant that handles a …

    9c4ae02
  13. LukasWoodtli
    added a commit that references this issue on Jan 22, 2025

    pythongh-115432: Add critical section variant that handles a NULL obj…

    98e20d1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @colesbury
    colesbury

Labels

topic-free-threadingtype-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 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.