python-trio / python-trio/trio
More careful validation of cancel scope deadline values
Open
Nobody has claimed this yet.
polish
- Dominant language
- Python
- Stars
- 7.3k
- Forks
- 431
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 6
Description
Right now, assigning to the cancel scope .deadline attribute does:
self._deadline = float(new_deadline)
so that means that we at least know that scope.deadline = "asdf" or scope.deadline = None will fail. However, surprisingly, it allows code like:
scope.deadline = "1.2e3" # a string is a float?1?
scope.deadline = float("nan") # uh not sure what will happen here
We should perhaps validate these values more carefully.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the cancel scope .deadline attribute assignment described in the issue and inspect how deadline values are currently converted. Determine which values should be accepted or rejected, then add coverage for those cases; done means invalid or unsafe values are handled consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100