python / python/typeshed

`asyncio.Protocol.data_received` should also accept `bytearray` alongside `bytes`

Open
#12,606 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic: asyncio
Dominant language
Python
Stars
5.1k
Forks
2.1k
Avg merge
1d 19h
Merged PRs (30d)
82

Description

Asyncio's _ProactorReadPipeTransport can also feed bytearray objects in the data_received callback from asyncio.Protocol.

Shall I make a PR with a fix for this?

Related cpython issue: https://github.com/python/cpython/issues/123496 - I'm not sure whether or not it should be fixed in the stdlib instead.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the typeshed declaration for asyncio.Protocol.data_received with the runtime path shown in Lib/asyncio/proactor_events.py, especially _ProactorReadPipeTransport and the data_received call. Check the related CPython issue before deciding whether the correction belongs in typeshed, then update the annotation so bytearray is represented and verify the relevant stub checks pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.