Skip to content

docs: document when Bound::new returns Err - #6457

Open
SatvikMishra08 wants to merge 1 commit into
PyO3:mainfrom
SatvikMishra08:docs/5485-bound-new-errors
Open

SatvikMishra08 wants to merge 1 commit into
PyO3:mainfrom
SatvikMishra08:docs/5485-bound-new-errors

Conversation

@SatvikMishra08

Copy link
Copy Markdown

Summary

Bound::new returns PyResult, but rustdoc did not explain when it can be Err.

Adds an # Errors section documenting the usual failure modes from the PyClassInitializer / create_class_object path:

  • base type missing tp_new → PyTypeError ("base type without tp_new")
  • tp_new / allocation returning null → PyErr::fetch (commonly MemoryError or another exception raised during init)

Keeps the existing # Examples block intact.

Fixes #5485

Test plan

  • cargo doc -p pyo3 --no-deps (or docs CI) renders # Errors on Bound::new without broken intra-doc links

This branch has not been deployed

No deployments
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.

Document when Bound::new can return an Err

1 participant