* deprecate GIL Refs in function arguments
* fix deprecated gil refs in function arguments
* add notes on deprecations limitations to migration guide
* Apply suggestions from code review
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
* review: Icxolu
* fix proto method extract failure for option
* fix gil refs in examples
---------
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
* deprecate `wrap_pyfunction` with `py` argument
The Python token in `wrap_pyfunction` is not handled automatically by
`WrapPyFunctionArg`, for backwards compatibility. This uses deref
specialization to deprecate this variant.
* merge `Extractor`s
* add deprecation ui test, revert closure variant due to test failure
* fix nightly
* add `FromPyObjectBound` adjustment for `&str` without GIL Refs
* review: alex, Icxolu feedback
* add newsfragment
* add newsfragment for `FromPyObject` trait change
* make some examples compatible with abi3 < 3.10
* seal `FromPyObjectBound`
* fixup chrono_tz conversion
* deprecate `&PyModule` as `#[pymodule]` argument type
* cleanup
* add ui tests
* fix deprecations in tests
* fix maturin and setuptools-rust starters
* run `deprecated` ui test only when `gil-refs` as disabled
* deprecate the use of `PyCell` in favor of `Bound` and `Py`
* update `FromPyObject` for `T: PyClass + Clone` impl
* move `PyCell` deprecation to the `gil-refs` feature gate and add a migration note
* docs: update Python function section of the guide
* update `pass_module` types
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Use single-arg form for `#[pymodule]` functions in docs and tests
* Update guide/src/function.md
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
* Add test of two-argument module function
* Fix new test
---------
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
* Support Bound in pymodule and pyfunction macros
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Remove spurious $ character
Co-authored-by: Matthew Neeley <mneeley@gmail.com>
* Rework PyCFunction::new_bound signatures
This allows us to remove the awkward `PyFunctionArgumentsBound` enum.
* Use BoundRef instead of BoundModule
* support argument deduction for `wrap_pyfunction_bound!`
* support `wrap_pyfunction!` with `Bound` input/output
* Fix docs link to `wrap_pyfunction_bound!`
* Revert back to wrap_pyfunction!
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
Co-authored-by: Matthew Neeley <mneeley@gmail.com>
* deprecate `PyCell::new` in favor of `Py::new` or `Bound::new`
* update deprecation warning
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Implement PyErr::value_bound
* Use PyErr::value_bound in conversions
* Implement PyErr::from_value_bound
* Remove unnecessary clone
* Return a reference from PyErr::value_bound
* Avoid clone in PyErr::from_value_bound
* Use PyErr::from_value_bound instead of from_value
* Remove unnecessary .as_borrowed() calls
* Remove unused import
* Simplify UnraisableCapture.hook
* Use Bound::from_owned_ptr_or_opt in fn cause
* Update PyErrState::lazy to take Py<PyAny>
This is easier to work with elsewhere than `&PyAny` or
`Bound<'py, PyAny>`.
* Add Bound PyUnicodeDecodeError constructors
* Update PyErr::from_value_bound to take Bound
* Simplify PyErr::from_value
* Simplify PyErr::value
* Remove unnecessary reference
* Simplify Pyerr::cause implementation
* Simplify PyUnicodeDecodeError::new_bound
* port `Python::import` to `Bound` API
* tidy up imports in tests/test_datetime_import.rs
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Implement PyErr::get_type_bound
* Update docs for PyErr::get_type_bound
* Fix doctest for cloning PyErr
* Import the whole prelude in docs example
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Remove unnecessary self lifetime
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Remove more unnecessary self lifetimes
* Use variables to avoid dangling pointers
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Avoid using ffi in fn ptype on Py_3_12
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Add missing imports to fn ptype
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Update debugging.md
Added clarification. --pretty no longer works, and it breaks even on nightly at least on cargo 1.78.0-nightly (cdf84b69d 2024-02-02) and
rustc 1.78.0-nightly (256b6fb19 2024-02-06).
* Update guide/src/debugging.md
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Update building_and_distribution.md
Link to README not working.
* Update guide/src/building_and_distribution.md
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>