[issue17804] streaming struct unpacking

Antoine Pitrou report at bugs.python.org
Sun Apr 21 00:15:32 CEST 2013


Antoine Pitrou added the comment:

> - I'm no expert on the C API, but in s_iter_unpack do you not need to
> check for failure of PyType_GenericAlloc before calling
> PyObject_GetBuffer?

Yes, good catch.

> - I'm not a fan of separate iter_ functions (and there seemed to be a
> general move away from them elsewhere in Python3; obviously here we
> have to maintain backwards compat though). Perhaps a boolean keyword
> "asiter" arg to the regular unpack() instead?

We generally consider it bad API design when a parameter changes the
return *type* of the function. "iter_unpack" may not be terrific as a
name but it describes the semantics quite clearly (and it's not too
annoying to type).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17804>
_______________________________________


More information about the Python-bugs-list mailing list