Skip to content

Fix missing std::sync::atomic::Ordering import for targets without atomic64#5808

Merged
Tpt merged 3 commits intoPyO3:mainfrom
rara64:main
Feb 14, 2026
Merged

Fix missing std::sync::atomic::Ordering import for targets without atomic64#5808
Tpt merged 3 commits intoPyO3:mainfrom
rara64:main

Conversation

@rara64
Copy link
Contributor

@rara64 rara64 commented Feb 13, 2026

This PR resolves an issue introduced in commit 5589b17 where builds for targets without 64-bit atomics will fail with an undeclared type error.

std::sync::atomic::Ordering should be imported unconditionally in the use std::{ ... } block.

Build output from armel (32-bit architecture):

Compiling pyo3 v0.28.0 (/pyo3)
Compiling pyo3-macros v0.28.0 (/pyo3/pyo3-macros)
error[E0433]: failed to resolve: use of undeclared type `Ordering`
   --> src/impl_/pymodule.rs:125:21
    |
125 |                     Ordering::SeqCst,
    |                     ^^^^^^^^ use of undeclared type `Ordering`
    |
help: consider importing one of these enums
    |
3   + use std::cmp::Ordering;
    |
3   + use std::sync::atomic::Ordering;
    |
3   + use portable_atomic::Ordering;
    |

error[E0433]: failed to resolve: use of undeclared type `Ordering`
   --> src/impl_/pymodule.rs:126:21
    |
126 |                     Ordering::SeqCst,
    |                     ^^^^^^^^ use of undeclared type `Ordering`
    |
help: consider importing one of these enums
    |
3   + use std::cmp::Ordering;
    |
3   + use std::sync::atomic::Ordering;
    |
3   + use portable_atomic::Ordering;
    |

For more information about this error, try `rustc --explain E0433`.
error: could not compile `pyo3` (lib) due to 2 previous errors

Affected releases:

  • PyO3 0.28.0

@alex alex enabled auto-merge February 13, 2026 19:38
@alex
Copy link
Contributor

alex commented Feb 13, 2026

Ooops, I think there's some cfg twiddling needing

@rara64
Copy link
Contributor Author

rara64 commented Feb 13, 2026

Ooops, I think there's some cfg twiddling needing

Yep, I'm on it.

auto-merge was automatically disabled February 13, 2026 20:01

Head branch was pushed to by a user without write access

@Tpt Tpt enabled auto-merge February 13, 2026 20:39
@Tpt Tpt mentioned this pull request Feb 13, 2026
@Tpt Tpt added this pull request to the merge queue Feb 14, 2026
Merged via the queue into PyO3:main with commit 7c75510 Feb 14, 2026
80 of 82 checks passed
davidhewitt pushed a commit that referenced this pull request Feb 14, 2026
…atomic64 (#5808)

* Fix missing `std::sync::atomic::Ordering` import for targets without atomic64

* Add changelog for PR #5808

* Fix unused import: `sync::atomic::Ordering`
davidhewitt pushed a commit that referenced this pull request Feb 14, 2026
…atomic64 (#5808)

* Fix missing `std::sync::atomic::Ordering` import for targets without atomic64

* Add changelog for PR #5808

* Fix unused import: `sync::atomic::Ordering`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants