Skip to content

[pyserial] Correct optional timeout and threaded write types - #16798

Open
iamabhisheknag wants to merge 3 commits into
python:mainfrom
iamabhisheknag:fix/pyserial-timeout-types
Open

iamabhisheknag wants to merge 3 commits into
python:mainfrom
iamabhisheknag:fix/pyserial-timeout-types

Conversation

@iamabhisheknag

Copy link
Copy Markdown
Contributor

Match the blocking timeout contract and threaded write forwarding: allow None timeout values/results and preserve optional write results from serial implementations.

AI assistance: OpenAI coding assistant (GPT-6).

@github-actions

This comment has been minimized.

def __init__(self, serial_instance: Serial, protocol_factory: Callable[[], _P]) -> None: ...
def stop(self) -> None: ...
def write(self, data: ReadableBuffer) -> int: ...
def write(self, data: ReadableBuffer) -> int | None: ...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this calls Serial.write and the three variants are annotated as returning int | None, I don't think that's true? When tracing the code it seems to always return int (or throw) for all three variants.

@github-actions

Copy link
Copy Markdown
Contributor

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

This branch has not been deployed

No deployments
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.

2 participants