Skip to content

Fix pyserial read_all return type#15797

Open
bibekmhj wants to merge 1 commit into
python:mainfrom
bibekmhj:fix/15619-pyserial-read-all-return-type
Open

Fix pyserial read_all return type#15797
bibekmhj wants to merge 1 commit into
python:mainfrom
bibekmhj:fix/15619-pyserial-read-all-return-type

Conversation

@bibekmhj
Copy link
Copy Markdown

Fixes #15619.

read_all was typed bytes | None but it just calls self.read(self.in_waiting) internally, and read is already typed as bytes (with that long comment above explaining why pyserial overrides the io.RawIOBase contract). pyserial's docs back this up too — "Equivalent to ser.read(ser.in_waiting). Returns: Bytes read from the port."

So just narrowed it to bytes to match.

@github-actions
Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pyserial: read_all cannot return None?

1 participant