pyo3/pyo3-ffi/src
Adam Reichold bd7aed4b12 Add implementation of Iterator::size_hint for PyIterator
When the Python iterator backing `PyIterator` has a `__length_hint__` special
method, we can use this as a lower bound for Rust's `Iterator::size_hint` to
e.g. support pre-allocation of collections.

This is implemented using `PyObject_LengthHint` which is not available in the
stable ABI and hence so is `Iterator::size_hint`. This should be fine since this
is an optimization in any case and the stable ABI is expected to have slightly
worse performance overall.
2023-07-09 10:16:20 +02:00
..
cpython ci: add Python 3.12-dev jobs 2023-06-11 21:57:17 +01:00
abstract_.rs fix SystemError raised from PyUnicodeDecodeError_Create on PyPy 3.10 2023-07-05 11:10:02 +01:00
bltinmodule.rs move ffi module to separate crate 2022-01-31 13:27:16 +01:00
boolobject.rs Add implementation of Iterator::size_hint for PyIterator 2023-07-09 10:16:20 +02:00
buffer.rs python-3.11: support buffer API on abi3 2022-02-06 22:46:45 +00:00
bytearrayobject.rs Remove cfg addr_of made unnecessary by MSRV bump. 2023-06-05 11:12:06 +02:00
bytesobject.rs Remove cfg addr_of made unnecessary by MSRV bump. 2023-06-05 11:12:06 +02:00
ceval.rs fix FFI definition Py_EnterRecursiveCall 2023-07-05 22:52:41 +01:00
code.rs move ffi module to separate crate 2022-01-31 13:27:16 +01:00
codecs.rs move ffi module to separate crate 2022-01-31 13:27:16 +01:00
compile.rs ffi: many fixes caught by pyo3-ffi-check 2022-06-02 16:32:07 +01:00
complexobject.rs Remove cfg addr_of made unnecessary by MSRV bump. 2023-06-05 11:12:06 +02:00
context.rs Remove cfg addr_of made unnecessary by MSRV bump. 2023-06-05 11:12:06 +02:00
datetime.rs datetime: support timezone bindings 2022-07-13 22:05:17 +01:00
descrobject.rs fix const-ness of some FFI name & doc members 2023-03-10 16:02:52 +00:00
dictobject.rs add PyDict::get_item_with_error for PyPy 2023-06-25 19:26:08 +01:00
enumobject.rs move ffi module to separate crate 2022-01-31 13:27:16 +01:00
fileobject.rs move ffi module to separate crate 2022-01-31 13:27:16 +01:00
fileutils.rs move ffi module to separate crate 2022-01-31 13:27:16 +01:00
floatobject.rs Remove cfg addr_of made unnecessary by MSRV bump. 2023-06-05 11:12:06 +02:00
import.rs Add macro append_to_inittab 2022-05-24 07:42:15 +01:00
intrcheck.rs move ffi module to separate crate 2022-01-31 13:27:16 +01:00
iterobject.rs Remove cfg addr_of made unnecessary by MSRV bump. 2023-06-05 11:12:06 +02:00
lib.rs docs: remove workarounds for #[doc = concat!(...)] following msrv bump 2023-06-08 21:04:49 +01:00
listobject.rs Remove cfg addr_of made unnecessary by MSRV bump. 2023-06-05 11:12:06 +02:00
longobject.rs Remove cfg addr_of made unnecessary by MSRV bump. 2023-06-05 11:12:06 +02:00
marshal.rs move ffi module to separate crate 2022-01-31 13:27:16 +01:00
memoryobject.rs Remove cfg addr_of made unnecessary by MSRV bump. 2023-06-05 11:12:06 +02:00
methodobject.rs Remove cfg addr_of made unnecessary by MSRV bump. 2023-06-05 11:12:06 +02:00
modsupport.rs mangle exported functions for PyPy 2023-03-10 07:27:38 +11:00
moduleobject.rs Remove cfg addr_of made unnecessary by MSRV bump. 2023-06-05 11:12:06 +02:00
object.rs Remove cfg addr_of made unnecessary by MSRV bump. 2023-06-05 11:12:06 +02:00
objimpl.rs mangle exported functions for PyPy 2023-03-10 07:27:38 +11:00
osmodule.rs move ffi module to separate crate 2022-01-31 13:27:16 +01:00
pyarena.rs move ffi module to separate crate 2022-01-31 13:27:16 +01:00
pycapsule.rs Remove cfg addr_of made unnecessary by MSRV bump. 2023-06-05 11:12:06 +02:00
pyerrors.rs fix SystemError raised from PyUnicodeDecodeError_Create on PyPy 3.10 2023-07-05 11:10:02 +01:00
pyframe.rs Update pyframe.rs 2022-05-28 22:45:50 -04:00
pyhash.rs ffi: many fixes to pypy definitions 2022-06-04 12:47:40 +01:00
pylifecycle.rs move ffi module to separate crate 2022-01-31 13:27:16 +01:00
pymem.rs move ffi module to separate crate 2022-01-31 13:27:16 +01:00
pyport.rs move ffi module to separate crate 2022-01-31 13:27:16 +01:00
pystate.rs add PyState_*Module definitions for PyPy 2023-07-04 08:57:50 +01:00
pystrtod.rs move ffi module to separate crate 2022-01-31 13:27:16 +01:00
pythonrun.rs ffi: many fixes to pypy definitions 2022-06-04 12:47:40 +01:00
rangeobject.rs Remove cfg addr_of made unnecessary by MSRV bump. 2023-06-05 11:12:06 +02:00
setobject.rs Remove cfg addr_of made unnecessary by MSRV bump. 2023-06-05 11:12:06 +02:00
sliceobject.rs Remove cfg addr_of made unnecessary by MSRV bump. 2023-06-05 11:12:06 +02:00
structmember.rs fix const-ness of some FFI name & doc members 2023-03-10 16:02:52 +00:00
structseq.rs fix const-ness of some FFI name & doc members 2023-03-10 16:02:52 +00:00
sysmodule.rs move ffi module to separate crate 2022-01-31 13:27:16 +01:00
traceback.rs Remove cfg addr_of made unnecessary by MSRV bump. 2023-06-05 11:12:06 +02:00
tupleobject.rs Remove cfg addr_of made unnecessary by MSRV bump. 2023-06-05 11:12:06 +02:00
typeslots.rs python-3.11: support buffer API on abi3 2022-02-06 22:46:45 +00:00
unicodeobject.rs ci: add Python 3.12-dev jobs 2023-06-11 21:57:17 +01:00
warnings.rs Export warning classes and add PyErr::warn_explicit() (#2742) 2022-11-17 19:30:48 +01:00
weakrefobject.rs Remove cfg addr_of made unnecessary by MSRV bump. 2023-06-05 11:12:06 +02:00