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 — <lock.h> filename is too generic · Issue #136759 · python/cpython

<lock.h> filename is too generic #136759

New issue
Copy link
New issue
Copy link
Closed
Closed
<lock.h> filename is too generic#136759
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

@geofft
geofft
opened on Jul 18, 2025
Issue body actions

Bug report

Bug description:

Starting with CPython 3.13, there is now a file lock.h in the Python include directory (not in a further subdirectory). This causes problems when building with other projects or third-party libraries that already have a file named lock.h. See, for instance, mit-athena/python-afs#6 which is building Cython bindings to OpenAFS, which also has an include file of that same name. The compilation environment seems to search CPython's headers before OpenAFS's, meaning that #include <lock.h> now incorrectly picks up CPython's.

To be fair, there are a number of other generic header names too (object.h, import.h, warnings.h, etc.), and also to be fair, <lock.h> is too generic a name for OpenAFS to use, too, especially since it installs to /usr/include/lock.h. But many of the other Python includes have been around since the 1990s, and so people have already dealt with avoiding conflicts with those names, and conversely AFS's lock.h dates from the 1990s (or earlier) too.

It looks like something similar was done for buffer.h -> pybuffer.h in #31201.

Would a PR to rename the top-level include to e.g. pylock.h (either leaving cpython/lock.h alone, or renaming it too) be accepted? As far as I can tell, the file name of lock.h is an implementation detail of the public interface Python.h, and not itself a public interface.

On a more general note, is it worth trying to change things to make the installed header directory contain only Python.h and no other files?

cc @colesbury and @vstinner who might be interested

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs

  • gh-136759: Rename lock.h to pylock.h #137041
  • [3.14] gh-136759: rename lock.h to pylock.h (GH-137041) #137072
  • [3.13] gh-136759: rename lock.h to pylock.h (GH-137041) #137075
  • [3.13] gh-136759: revert rename lock.h to pylock.h (GH-137041) (#137075) #137166

Activity

  1. geofft
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Jul 18, 2025
  2. StanFromIreland
    added
    type-featureA feature request or enhancementA feature request or enhancement
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    and removed
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Jul 18, 2025
  3. geofft commented on Jul 18, 2025

    @geofft
    geofft
    on Jul 18, 2025
    ContributorAuthor
    More actions

    I would very mildly argue this is a bug in that it's a regression: a third-party extension that built fine on Python 3.12 doesn't build on 3.13+ and there's no obvious way to make it build. But I don't feel super strongly about it. :)

    Reacted by Itamar Oren
  4. colesbury commented on Jul 18, 2025

    @colesbury
    colesbury
    on Jul 18, 2025
    Contributor
    More actions

    Yes, let's rename lock.h to pylock.h. Let's also rename cpython/lock.h to cpython/pylock.h for consistency.

    Reacted by Antonio Spadaro
  5. kumaraditya303
    added a commit that references this issue on Jul 24, 2025

    gh-136759: rename `lock.h` to `pylock.h` (#137041)

    ec02db5
  6. miss-islington
    added a commit that references this issue on Jul 24, 2025

    pythongh-136759: rename `lock.h` to `pylock.h` (pythonGH-137041)

    4183f54
  7. kumaraditya303
    added a commit that references this issue on Jul 24, 2025

    [3.13] gh-136759: rename `lock.h` to `pylock.h` (GH-137041) (#137075)

    74503ac
  8. kumaraditya303
    closed this as completedon Jul 25, 2025
  9. kumaraditya303
    added a commit that references this issue on Jul 28, 2025

    Revert "[3.13] pythongh-136759: rename `lock.h` to `pylock.h` (python…

    b3f790f
  10. kumaraditya303
    reopened this on Jul 28, 2025
  11. kumaraditya303 commented on Jul 28, 2025

    @kumaraditya303
    kumaraditya303
    on Jul 28, 2025
    Contributor
    More actions

    Unfortunately the PR would have to reverted back for 3.13 and likely won't make it into 3.14 as @zooba explained at #137075 (comment)

  12. kumaraditya303
    added a commit that references this issue on Jul 28, 2025

    [3.13] gh-136759: revert rename `lock.h` to `pylock.h` (GH-137041) (#…

    3f57d9b
  13. dehnert
    added a commit that references this issue on Aug 3, 2025

    python-afs: Compatibility with Python 3.13

    6ea4835
  14. taegyunkim
    added a commit that references this issue on Aug 4, 2025

    pythongh-136759: rename `lock.h` to `pylock.h` (python#137041)

    b88f3d9
  15. Agent-Hellboy
    added a commit that references this issue on Aug 19, 2025

    pythongh-136759: rename `lock.h` to `pylock.h` (python#137041)

    f9b4e6b
  16. StanFromIreland commented on Sep 17, 2025

    @StanFromIreland
    StanFromIreland
    on Sep 17, 2025
    Member
    More actions

    Closing as revert was completed and 3.14 backport was closed.

  17. StanFromIreland
    closed this as completedon Sep 17, 2025
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.