aparo / pyes

Python connector for ElasticSearch - the pythonic way to use ElasticSearch
BSD 3-Clause "New" or "Revised" License
607 stars 270 forks source link

Add Python 3.x bool() support #501

Closed beckjake closed 8 years ago

beckjake commented 8 years ago

This fixes a small issue in python 3.x. On line 293 of pyes.ES.__del__, the magicmethod for bool in Python 3 wasn't defined, so the "if self.bulker" check always passes, so every time a pyes.ES object is garbage collected a message is logged at error level and a useless flush_bulk(True) is called. I think this is what's behind issue 458.

I also fixed the 2 other places that defined __nonzero__ but not __bool__ while I was at it.