ENH: Make handle_data overwritable by subclasses.

Cherry-picked from #1133.