Simplified p.poll handling

Fixes #5570