Skip to content

pyatomic include statement shouldn't use "cpython/*" but just "*" #129296

Closed

Description

@timprepscius

Bug report

Bug description:

I'm looking at (and using) a build generated from:

  git clone --depth 1 https://github.com/python/cpython.git --branch v3.13.1

  pushd cpython

    ./configure --enable-optimizations --prefix=$(pwd)/install
    make -j4
    make install

  popd

in the file: cpython/install/include/python3.13/cpython/pyatomic.h

there is the statement

#if _Py_USE_GCC_BUILTIN_ATOMICS
#  define Py_ATOMIC_GCC_H
#  include "cpython/pyatomic_gcc.h"
#  undef Py_ATOMIC_GCC_H
#elif __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_ATOMICS__)
#  define Py_ATOMIC_STD_H
#  include "cpython/pyatomic_std.h"
#  undef Py_ATOMIC_STD_H
#elif defined(_MSC_VER)
#  define Py_ATOMIC_MSC_H
#  include "cpython/pyatomic_msc.h"
#  undef Py_ATOMIC_MSC_H
#else
#  error "no available pyatomic implementation for this platform/compiler"
#endif

these includes say: include, relative to me (quotation), the file cpython/pyatomic_gcc.h

But there is no file "cpython/pyatomic_gcc.h" relative to the cypthon/pyatomic.h

I can of course compensate by putting a:
ln -s . cypthon
in that cpython directory

The fix is to change "cpython/pyatomic_gcc.h" to "pyatomic_gcc.h"
where quotation = "relative to me"

CPython versions tested on:

3.13

Operating systems tested on:

No response

Linked PRs

Activity

  1. added
    buildThe build process and cross-build
    3.13only security fixes
    3.14bugs and security fixes
    on Jan 26, 2025
  2. ZeroIntensity commented on Jan 26, 2025

    @ZeroIntensity
    Member

    The compiler should be falling back to the include path regardless--there's no actual compile error in practice, is there?

    cc @colesbury

  3. added a commit that references this issue on Jan 26, 2025
  4. colesbury commented on Jan 28, 2025

    @colesbury
    Contributor

    Yeah, I'm not sure there's any problem in practice, but it seems like we might as well fix it, and @zanieb already put up a PR.

    There's one more place in Include/cpython with a similar pattern:

    # include "cpython/pthread_stubs.h"

  5. zanieb commented on Jan 28, 2025

    @zanieb
    Contributor

    I have no attachment to the change, though it does seem more consistent with the other library includes. Want me to add that one to the existing pull request or just put another one up?

  6. added a commit that references this issue on Jan 29, 2025
  7. vstinner commented on Jan 29, 2025

    @vstinner
    Member

    Thanks @timprepscius for the bug report and thanks @zanieb for the fix!

  8. added a commit that references this issue on Feb 28, 2025
  9. added 2 commits that reference this issue on Feb 28, 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

    3.13only security fixes3.14bugs and security fixesbuildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions