Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
timprepscius opened this issue Jan 25, 2025 · 4 comments
Closed

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

timprepscius opened this issue Jan 25, 2025 · 4 comments
Labels
3.13 bugs and security fixes 3.14 bugs and security fixes build The build process and cross-build type-bug An unexpected behavior, bug, or error

Comments

@timprepscius
Copy link

timprepscius commented Jan 25, 2025

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

@timprepscius timprepscius added the type-bug An unexpected behavior, bug, or error label Jan 25, 2025
@ZeroIntensity ZeroIntensity added build The build process and cross-build 3.13 bugs and security fixes 3.14 bugs and security fixes labels Jan 26, 2025
@ZeroIntensity
Copy link
Member

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

cc @colesbury

@colesbury
Copy link
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"

@zanieb
Copy link
Contributor

zanieb commented Jan 28, 2025

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?

vstinner pushed a commit that referenced this issue Jan 29, 2025
Use relative includes in Include/cpython/pyatomic.h for
pyatomic_gcc.h, pyatomic_std.h and pyatomic_msc.h.

Do a similar change in Include/cpython/pythread.h for
pthread_stubs.h include.
@vstinner
Copy link
Member

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

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Feb 28, 2025
Use relative includes in Include/cpython/pyatomic.h for
pyatomic_gcc.h, pyatomic_std.h and pyatomic_msc.h.

Do a similar change in Include/cpython/pythread.h for
pthread_stubs.h include.
(cherry picked from commit 3a974e3)

Co-authored-by: Zanie Blue <[email protected]>
vstinner added a commit that referenced this issue Feb 28, 2025
gh-129296: Fix `pythread.h` include paths (#129320)

Use relative includes in Include/cpython/pythread.h for
pthread_stubs.h.

(cherry picked from commit 3a974e3)

Co-authored-by: Zanie Blue <[email protected]>
vstinner pushed a commit that referenced this issue Feb 28, 2025
gh-129296: Fix `pyatomic.h` include paths (GH-129320)

Use relative includes in Include/cpython/pyatomic.h for
pyatomic_gcc.h, pyatomic_std.h and pyatomic_msc.h.

Do a similar change in Include/cpython/pythread.h for
pthread_stubs.h include.
(cherry picked from commit 3a974e3)

Co-authored-by: Zanie Blue <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes 3.14 bugs and security fixes build The build process and cross-build type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

5 participants