mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 12:40:15 +01:00
extmod/modselect: Properly track number of poll objects that are fd's.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -77,7 +77,26 @@ try:
|
||||
except OSError as er:
|
||||
print("OSError", er.errno)
|
||||
|
||||
# Register then unregister a socket (a native stream), then test
|
||||
# that the Python object is still pollable.
|
||||
s2 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
x.poll_state = _MP_STREAM_POLL_RD
|
||||
poller.register(s2)
|
||||
poller.unregister(s2)
|
||||
print_poll_output(poller.poll())
|
||||
|
||||
# Test registering and unregistering multiple times.
|
||||
for _ in range(2):
|
||||
poller.unregister(s)
|
||||
poller.unregister(x)
|
||||
poller.register(s2)
|
||||
poller.register(s, select.POLLIN)
|
||||
poller.register(x, select.POLLIN)
|
||||
poller.unregister(s2)
|
||||
print_poll_output(poller.poll())
|
||||
|
||||
# Clean up.
|
||||
poller.unregister(x)
|
||||
poller.unregister(s)
|
||||
|
||||
s2.close()
|
||||
s.close()
|
||||
|
||||
@@ -9,3 +9,9 @@ CustomPollable.ioctl 3 1
|
||||
[(<class 'CustomPollable'>, 1)]
|
||||
CustomPollable.ioctl 3 1
|
||||
OSError 1000
|
||||
CustomPollable.ioctl 3 1
|
||||
[(<class 'CustomPollable'>, 1)]
|
||||
CustomPollable.ioctl 3 1
|
||||
[(<class 'CustomPollable'>, 1)]
|
||||
CustomPollable.ioctl 3 1
|
||||
[(<class 'CustomPollable'>, 1)]
|
||||
|
||||
Reference in New Issue
Block a user