pyo3/newsfragments
JRRudy1 5d47c4ae4c
Added ToPyObject and IntoPy<PyObject> impls for PyBackedStr. (#4205)
* Added `ToPyObject` and `Into<PyObject>` impls for `PyBackedStr`.

* Create 4205.added.md

* Added attributes limiting the `ToPyObject` and `IntoPy<PyObject>` impls to the case where `cfg(any(Py_3_10, not(Py_LIMITED_API)))`. When this cfg does not apply, the conversion is less trivial since the `storage` is actually `PyBytes`, not `PyString`.

* Fixed imports format.

* Updated the `ToPyObject` and `IntoPy<PyObject>` impls to support the `cfg(not(any(Py_3_10, not(Py_LIMITED_API))))` case by converting the `PyBytes` back to `PyString`.

* Added `ToPyObject` and `IntoPy<PyObject>` impls for `PyBackedBytes`.

* Added tests for the `PyBackedBytes` conversion impls.

* Updated newsfragment entry to include the `PyBackedBytes` impls.

* Changed the `IntoPy` and `ToPyObject` impls for `PyBackedBytes` to produce `PyBytes` regardless of the backing variant. Updated tests to demonstrate this.

* retrigger checks

* Updated `PyBackedStr` conversion tests to extract the result as a `PyBackedStr` instead of `&str` since the latter is not supported under some `cfg`'s.

* Fixed `IntoPy<PyObject> for PyBackedBytes` impl to create `bytes` for both storage types as intended. Updated test to properly catch the error.

---------

Co-authored-by: jrudolph <jrudolph@anl.gov>
2024-06-01 21:09:14 +00:00
..
.gitignore use towncrier to generate CHANGELOG 2022-09-08 07:58:53 +01:00
3761.changed.md Change the types of PySliceIndices and `PySlice::indices (#3761) 2024-04-18 07:33:07 +00:00
3835.added.md Add weakref Python types (#3835) 2024-05-31 19:13:50 +00:00
3966.packaging.md Update heck requirement from 0.4 to 0.5 (#3966) 2024-04-18 10:22:34 +00:00
4061.packaging.md build(deps): update chrono-tz requirement from >= 0.6, < 0.9 to >= 0.6, < 0.10 (#4061) 2024-04-18 08:58:51 +00:00
4072.added.md feat: support pyclass on tuple enums (#4072) 2024-05-17 02:59:00 +00:00
4078.changed.md deprecate implicit default for trailing optional arguments (#4078) 2024-05-10 10:34:58 +00:00
4079.added.md Allow use of scientific notation on rust decimal (#4079) 2024-04-14 20:07:17 +00:00
4086.fixed.md fix declarative module compile error with create_exception! (#4086) 2024-04-16 20:12:18 +00:00
4095.added.md Remove deferred reference count increments and make the global reference pool optional (#4095) 2024-05-11 14:48:45 +00:00
4095.changed.md Remove deferred reference count increments and make the global reference pool optional (#4095) 2024-05-11 14:48:45 +00:00
4098.changed.md add #[track_caller] to all Py/Bound/Borrowed methods which panic (#4098) 2024-04-19 11:44:36 +00:00
4100.changed.md change PyAnyMethods::dir to be fallible (#4100) 2024-04-19 19:35:52 +00:00
4104.fixed.md fix vectorcall argument handling (#4104) 2024-04-22 08:56:39 +00:00
4116.fixed.md Disable PyUnicode_DATA on PyPy (#4116) 2024-04-26 06:00:13 +00:00
4117.fixed.md handle #[pyo3(from_py_with = ...)] on dunder (__magic__) methods (#4117) 2024-05-04 07:39:40 +00:00
4129.changed.md Update MSRV to 1.63 (#4129) 2024-04-28 16:11:28 +00:00
4148.added.md Add num-rational support for Python's fractions.Fraction type (#4148) 2024-05-09 15:37:53 +00:00
4158.added.md allow constructor customization of complex enum variants (#4158) 2024-05-09 21:08:23 +00:00
4184.packaging.md ci: start testing on 3.13-dev (#4184) 2024-05-25 22:41:26 +00:00
4197.added.md adding new getter for type obj (#4197) 2024-05-25 22:39:48 +00:00
4205.added.md Added ToPyObject and IntoPy<PyObject> impls for PyBackedStr. (#4205) 2024-06-01 21:09:14 +00:00
4206.added.md add pyclass hash option (#4206) 2024-06-01 14:20:20 +00:00
4210.added.md add pyclass eq option (#4210) 2024-05-31 14:13:30 +00:00
4210.changed.md add pyclass eq option (#4210) 2024-05-31 14:13:30 +00:00
4214.added.md Added From<Bound<'py, T>> impl for PyClassInitializer<T>. (#4214) 2024-05-28 01:49:52 +00:00