bpo-32259: Make a TypeError message when unpack non-iterable more specific. by serhiy-storchaka · Pull Request #4903 · python/cpython (original) (raw)

Ah, you're right, sorry.

My point was that you've added a test every time an object is unpacked, which happens a lot. I guess the only way around that is to move this test to after the it == NULL test, and change the text of the error if it's a TypeErrror and if the conditions on this line hold. I'm not sure if it's worth that to avoid the PySequence_Check() call, though. Maybe a quick micro-benchmark would say it's nothing to worry about. I'm not in front of a "real" computer to test, though.