Skip to content

Scaffolding for cpython-api crate - #63

Open
cjames23 wants to merge 4 commits into
Rust-for-CPython:3.x-rust-in-cpythonfrom
pythonomenology:cpython-api-scaffold
Open

cjames23 wants to merge 4 commits into
Rust-for-CPython:3.x-rust-in-cpythonfrom
pythonomenology:cpython-api-scaffold

Conversation

@cjames23

Copy link
Copy Markdown

Adds in the scaffolding for the cpython-api crate. This is the first PR for #51 as groundwork.

@emmatyping emmatyping left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thank you for working on this! I think this is a great start, we just need to wait on #52 for the c_api module.

Comment thread Modules/cpython-api/src/lib.rs Resolved
Comment thread Modules/_base64/src/lib.rs Outdated

impl BorrowedBuffer {
fn from_object(obj: &PyObject) -> Result<Self, ()> {
fn from_object(obj: *mut PyObject) -> Result<Self, ()> {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for updating this! We should probably remove the _base64 module eventually, but I guess for now it's a nice test that the build still works.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I was actually going to ask you about the _base64 module, this was just something I found when starting to do the work that was going to break otherwise.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yeah we originally added it to get the build working. I think it would be fine if you removed it here if you'd prefer.

@emmatyping emmatyping left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

One minor suggestion but otherwise looks great, thank you!

Comment on lines +11 to +16
[lints.rust]
unsafe_op_in_unsafe_fn = "deny"

[lints.clippy]
undocumented_unsafe_blocks = "deny"
missing_safety_doc = "deny"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do we want the same policy across all Rust crates: unsafe operations must be explicit, unsafe blocks documented, and unsafe public APIs must explain their safety requirements?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes, I think so, with the possible exception of cpython-sys since that is all bindings.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I agree with Emma.

Co-authored-by: Emma Smith <emma@emmatyping.dev>
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