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

This commit is contained in:
Aaron Gokaslan 2022-10-12 16:46:40 -04:00 committed by GitHub
parent 0927c4d19e
commit 8781daf6e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1382,7 +1382,7 @@ public:
private:
void advance() {
value = reinterpret_steal<object>(PyIter_Next(m_ptr));
if (PyErr_Occurred()) {
if (value.ptr() == nullptr && PyErr_Occurred()) {
throw error_already_set();
}
}