Skip to content

Conversation

@Eclips4
Copy link

@Eclips4 Eclips4 commented Nov 17, 2025

No description provided.

@Eclips4 Eclips4 requested a review from emmatyping as a code owner November 17, 2025 15:11
# depends on the headers through cpython-sys
rule="$objs: cpython-sys \$(srcdir)/Cargo.toml \$(srcdir)/Cargo.lock \$(srcdir)/$srcdir/$manifest $prefixed_srcs \$(PYTHON_HEADERS)"
rule="$rule; cargo build --lib --locked --package ${mods} --profile \$(CARGO_PROFILE)"
rule="$rule; CARGO_TARGET_DIR=\$(abs_builddir)/target PYTHON_BUILD_DIR=\$(abs_builddir) cargo build --lib --locked --package ${mods} --profile \$(CARGO_PROFILE) --manifest-path \$(srcdir)/Cargo.toml"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this because some platforms build CPython outside the main source tree

Comment on lines +114 to +120
#[cfg(py_gil_disabled)]
pub const PyObject_HEAD_INIT: PyObject = {
let mut obj: PyObject = unsafe { std::mem::MaybeUninit::zeroed().assume_init() };
obj.ob_flags = _Py_STATICALLY_ALLOCATED_FLAG as _;
obj
};

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A temporary work around to make it build for free-threaded build

Comment on lines +89 to +99
def list_rust_modules(names: set[str]) -> None:
if not os.path.isdir(MODULES_PATH):
return
for entry in os.scandir(MODULES_PATH):
if not entry.is_dir():
continue
if entry.name == "cpython-sys":
continue
cargo_toml = os.path.join(entry.path, "Cargo.toml")
if os.path.isfile(cargo_toml):
names.add(entry.name)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don’t actually need this in this PR, but we’ll eventually need something like it

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be fine! We can always modify it later as needed.

Copy link
Owner

@emmatyping emmatyping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@emmatyping emmatyping merged commit c9deee6 into emmatyping:rust-in-cpython Nov 17, 2025
11 checks passed
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.

2 participants