Skip to content

introduce PyIterator::from_bound_object#3702

Merged
davidhewitt merged 1 commit intoPyO3:mainfrom
davidhewitt:bound-iterator-constructor
Jan 2, 2024
Merged

introduce PyIterator::from_bound_object#3702
davidhewitt merged 1 commit intoPyO3:mainfrom
davidhewitt:bound-iterator-constructor

Conversation

@davidhewitt
Copy link
Copy Markdown
Member

Follows the standard pattern we're now going for to introduce a new bound constructor while deprecating the old one.

This isn't mergeable until after #3694

pub(crate) fn from_object2<'py>(obj: &Bound<'py, PyAny>) -> PyResult<Bound<'py, PyIterator>> {
/// Constructs a `PyIterator` from a Python iterable object.
///
/// Equivalent to Python's built-in `iter` function.
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 an intra doc link to PyAnyMethods::iter would be nice as this is usually the more convenient form compared to calling this directly.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed 👍

@davidhewitt davidhewitt force-pushed the bound-iterator-constructor branch from d034f61 to 783e98b Compare January 2, 2024 14:11
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Jan 2, 2024

CodSpeed Performance Report

Merging #3702 will improve performances by 11.66%

Comparing davidhewitt:bound-iterator-constructor (783e98b) with main (5ea2e5c)

Summary

⚡ 1 improvements
✅ 77 untouched benchmarks

Benchmarks breakdown

Benchmark main davidhewitt:bound-iterator-constructor Change
extract_int_downcast_fail 266.1 ns 238.3 ns +11.66%

@davidhewitt davidhewitt enabled auto-merge January 2, 2024 15:13
@davidhewitt davidhewitt added this pull request to the merge queue Jan 2, 2024
Merged via the queue into PyO3:main with commit eceb28b Jan 2, 2024
@davidhewitt davidhewitt deleted the bound-iterator-constructor branch January 2, 2024 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI-skip-changelog Skip checking changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants