vsergeev / python-periphery

A pure Python 2/3 library for peripheral I/O (GPIO, LED, PWM, SPI, I2C, MMIO, Serial) in Linux.
MIT License
519 stars 139 forks source link

gpio: properly accept timeout=None in GPIO.poll() #34

Closed ukleinek closed 4 years ago

ukleinek commented 4 years ago

Calling poll of an epoll instance with timeout being None triggers a TypeError:

$ python -c 'import select; select.epoll().poll(timeout=None)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: a float is required

Fix this by passing -1 as timeout if None is given which has the semantic of wait indefinitely.

Closes: https://github.com/vsergeev/python-periphery/issues/29