Add itertools.chain.__setstate__#3779
Conversation
|
@nonzerofloat you may forgot to set |
|
Generally git do not allow commits without an email registered. That's perhaps because the commit's email is not consistent with my account's email. I have fixed. Correct lint errors. |
vm/src/stdlib/itertools.rs
Outdated
| impl IterNextIterable for PyItertoolsChain {} | ||
| impl IterNext for PyItertoolsChain { | ||
| fn next(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<PyIterReturn> { | ||
| let iterables = zelf.iterables.read(); |
There was a problem hiding this comment.
This change may cause dead-lock
There was a problem hiding this comment.
Can you give me more detailed explanation for deadlock? I suspect the place is suitable. Deadlock is unexpected.
There was a problem hiding this comment.
Guess we have a chain with self-editing iterable on __iter__. Previously, we locked iterable only before and after get_iter, it is safe.
After change, this line will hold the lock for entire loop. Any write operation in get_iter will be permanently blocked.
|
The implementation of |
|
Oh, this is done in #4232 Thanks @dannasman ! And thank you for contributing @nonzerofloat |
| fn setstate(&self, state: PyTupleRef, vm: &VirtualMachine) -> PyResult<()> { | ||
| let args = state.as_slice(); | ||
| if args.is_empty() { | ||
| let msg = String::from("function takes at leat 1 arguments (0 given)"); |
No description provided.