Skip to content

Implement function accessors for Python function object - #6351

Open
clin1234 wants to merge 11 commits into
PyO3:mainfrom
clin1234:patch-13
Open

Implement function accessors for Python function object#6351
clin1234 wants to merge 11 commits into
PyO3:mainfrom
clin1234:patch-13

Conversation

@clin1234

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread pyo3-ffi/src/cpython/funcobject.rs Outdated
// skipped PyStaticMethod_New

#[inline]
pub unsafe fn PyFunction_GET_CODE(func: *mut PyObject) -> *mut PyObject {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it would be worth having private fn _PyFunction_CAST which does the assert and cast like the 3.15 implementation of these.

@codspeed-hq

codspeed-hq Bot commented Aug 24, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 141 untouched benchmarks
⏩ 6 skipped benchmarks1


Comparing clin1234:patch-13 (97ab000) with main (a30ced8)

Open in CodSpeed

Footnotes

  1. 6 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Comment thread pyo3-ffi-check/macro/src/lib.rs Outdated
@clin1234

Copy link
Copy Markdown
Contributor Author

Build docs on 3.14 ubuntu is failing on this command: cargo doc --lib --no-default-features --features=full --no-deps --workspace --exclude=pyo3-macros --exclude=pyo3-macros-backend:

  error: unreachable call
     --> src/conversions/std/num.rs:179:73
      |
  179 |                     .map_err(|e| exceptions::PyOverflowError::new_err(e.to_string()))
      |                                                                       - ^^^^^^^^^ unreachable call
      |                                                                       |
      |                                                                       any code following this expression is unreachable
  ...
  339 | int_fits_c_long!(i64);
      | --------------------- in this macro invocation
      |
      = note: `-D unreachable-code` implied by `-D warnings`
      = help: to override `-D warnings` add `#[allow(unreachable_code)]`
      = note: this error originates in the macro `int_fits_c_long` (in Nightly builds, run with -Z macro-backtrace for more info)

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