Commit 8781daf6 by Aaron Gokaslan Committed by GitHub

chore: Optimize iterator advance() call (#4237)

parent 0927c4d1
...@@ -1382,7 +1382,7 @@ public: ...@@ -1382,7 +1382,7 @@ public:
private: private:
void advance() { void advance() {
value = reinterpret_steal<object>(PyIter_Next(m_ptr)); value = reinterpret_steal<object>(PyIter_Next(m_ptr));
if (PyErr_Occurred()) { if (value.ptr() == nullptr && PyErr_Occurred()) {
throw error_already_set(); throw error_already_set();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment