return in finally can swallow exceptions

Open
#414 6 comments 3 reactions 1 assignee View on GitHub

@auvipy is already working on this.

Since Mar 20, 2025.

Assessment

This issue has not been assessed yet.

Description

In three places in your codebase, you have a return statement in a finally block, which would swallow any in-flight exception:

https://github.com/celery/billiard/blob/366ac5f9a708a64fc48f94da465189f9309288ab/billiard/connection.py#L349
https://github.com/celery/billiard/blob/366ac5f9a708a64fc48f94da465189f9309288ab/billiard/connection.py#L351
https://github.com/celery/billiard/blob/366ac5f9a708a64fc48f94da465189f9309288ab/billiard/pool.py#L1856

This means that if a BaseException (such as KeyboardInterrupt) is raised from the try body, or any exception is raised from an except: clause, it will not propagate on as expected.

See also https://docs.python.org/3/tutorial/errors.html#defining-clean-up-actions.

Dominant language
Python
Stars
436
Forks
273
Avg merge
4d 19h
Merged PRs (30d)
5

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from celery/billiard

All issues in celery/billiard

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.