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 — Make PY_SSIZE_T_CLEAN not mandatory again · Issue #104922 · python/cpython

Make PY_SSIZE_T_CLEAN not mandatory again #104922

New issue
Copy link
New issue
Copy link
Closed
Closed
Make PY_SSIZE_T_CLEAN not mandatory again#104922
Copy link
Labels
topic-C-APItype-featureA feature request or enhancementA feature request or enhancement

Description

@methane
methane
opened on May 25, 2023
Issue body actions

Feature or enhancement

Use ssize_t version API regardless PY_SSIZE_T_CLEAN is defined.

No change to ABI.

Pitch

After Python 3.12 become EOL, extension developers can forget about PY_SSIZE_T_CLEAN completely.

Previous discussion

https://mail.python.org/archives/list/[email protected]/thread/KSREO43D6GQWO5LMVIU2LF7CP4IBYT2C/#FG44N6RL5CT5O3XQ6UV6LBLUCET7IF6I

Linked PRs

  • gh-104922: Make PY_SSIZE_T_CLEAN not mandatory #104923
  • gh-104922: Make PY_SSIZE_T_CLEAN not mandatory again #105051
  • gh-104922: Doc: extending: add note about PY_SSIZE_T_CLEAN #106314
  • gh-104922: remove PY_SSIZE_T_CLEAN #106315

Activity

  1. methane
    added
    type-featureA feature request or enhancementA feature request or enhancement
    topic-C-API
    on May 25, 2023
  2. AlexWaygood
    changed the title [-]Make PY_SSIZE_T_CLEAN not mandatolly again[/-] [+]Make PY_SSIZE_T_CLEAN not mandatory again[/+] on May 25, 2023
  3. methane
    added a commit that references this issue on May 31, 2023

    gh-104922: Make `PY_SSIZE_T_CLEAN` not mandatory again (#105051)

    adccff3
  4. methane
    closed this as completedon May 31, 2023
  5. vstinner commented on Jul 1, 2023

    @vstinner
    vstinner
    on Jul 1, 2023
    Member
    More actions

    After Python 3.12 become EOL, extension developers can forget about PY_SSIZE_T_CLEAN completely.

    Python stdlib extensions still define the PY_SSIZE_T_CLEAN macro. Is it still useful? It's unclear to me.

    Also, the official documentation also requires to define the PY_SSIZE_T_CLEAN macro: https://docs.python.org/dev/extending/extending.html

    The first two lines of our file can be:
    
    #define PY_SSIZE_T_CLEAN
    #include <Python.h>
    
    (...)
    
    It is recommended to always define PY_SSIZE_T_CLEAN before including Python.h.
    
  6. methane commented on Jul 1, 2023

    @methane
    methane
    on Jul 1, 2023
    MemberAuthor
    More actions

    See right after the doc. I added the link to https://docs.python.org/dev/c-api/arg.html#arg-parsing-string-and-buffers

    And there is a note about it at link target.

    Note On Python 3.12 and older, the macro PY_SSIZE_T_CLEAN must be defined before including Python.h to use all # variants of formats (s#, y#, etc.) explained below. This is not necessary on Python 3.13 and later.

    I didn't remove the recommendation because user may want to support older Pythons.

    Python stdlib extensions still define the PY_SSIZE_T_CLEAN macro. Is it still useful? It's unclear to me.

    I didn't remove them to ease review and avoid conflicts. But I will remove them all.

  7. vstinner commented on Jul 1, 2023

    @vstinner
    vstinner
    on Jul 1, 2023
    Member
    More actions

    The (extension) doc should just explain that the macro was needed on Python 3.12 and older.

  8. methane
    added 2 commits that reference this issue on Jul 2, 2023

    gh-104922: remove PY_SSIZE_T_CLEAN (#106315)

    d5bd32f

    gh-104922: Doc: add note about PY_SSIZE_T_CLEAN (#106314)

    20b7c79
  9. carljm
    added a commit that references this issue on Jul 3, 2023

    Merge branch 'main' into modulelocals

    ac11740
  10. vstinner commented on Jan 16, 2024

    @vstinner
    vstinner
    on Jan 16, 2024
    Member
    More actions

    As a side effect, this change fixed the stable ABI: #71686. Thanks!

    Reacted by Erlend E. Aasland
  11. pmbarrett314
    added 11 commits that reference this issue on Nov 28, 2024

    Add declarations for private functions from pycore_modsupport

    9fc8f6b

    Add declarations for private functions from pycore_modsupport

    9402bb9

    Add declarations for private functions from pycore_modsupport

    48865ef

    Add declarations for private functions from pycore_modsupport

    008c9e5

    Add declarations for private functions from pycore_modsupport

    94ff109

    remove some stuff

    0a311fa

    Add declarations for private functions from pycore_modsupport

    07df212

    Add declarations for private functions from pycore_modsupport

    c45e94c

    Add declarations for private functions from pycore_modsupport

    c1d8aa6

    Add declarations for private functions from pycore_modsupport

    f88b54c

    Add declarations for private functions from pycore_modsupport

    bcfe45e
  12. stephanosio
    added 2 commits that reference this issue on Dec 30, 2024

    Add declarations for private functions from pycore_modsupport

    c46142d

    Add declarations for private functions from pycore_modsupport

    1c21781
  13. roccolate
    added a commit that references this issue on Aug 2, 2026

    Add declarations for private functions from pycore_modsupport

    2ece804
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

    topic-C-APItype-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.