Skip to content

runtime.serial_bytes_available should return count of bytes #9031

@RetiredWizard

Description

@RetiredWizard

CircuitPython version

Adafruit CircuitPython 9.0.0-alpha.6-1-gfcfe2018bd on 2023-12-14; LILYGO T-DECK with ESP32S3
Adafruit CircuitPython 9.0.0-rc.0-dirty on 2024-03-08; M5 Stack Cardputer with ESP32S3
Adafruit CircuitPython 8.1.0-beta.2 on 2023-04-26; VCC-GND YD-ESP32-S3 (N16R8) with ESP32S3
Adafruit CircuitPython 8.2.9-9-g325ae7c6fd on 2024-02-13; Pimoroni Pico dv Base with rp2040

Code/REPL

print(type(runtime.serial_bytes_available))

Behavior

<class 'bool'>

Description

I thought this function returned the integer number of bytes available at one point, however all the boards/versions I've checked seem to return a simple boolean.

I'm not sure it makes sense to change the functionality as it's possible it could be a breaking change and the current behavior has apparently been in place since 8.x but then the documentation should probably be updated.

serial_bytes_available: int
Returns the whether any bytes are available to read on the USB serial input. Allows for polling to see whether to call the built-in input() or wait. (read-only)

Additional information

No response

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions