Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task.replace(...) does not return None #166

Closed
alecbarber opened this issue Nov 25, 2024 · 2 comments · Fixed by #165
Closed

Task.replace(...) does not return None #166

alecbarber opened this issue Nov 25, 2024 · 2 comments · Fixed by #165
Labels
bug Something isn't working

Comments

@alecbarber
Copy link
Contributor

The following example raises a spurious mypy error:

from celery import Celery, Task

app = Celery()

@app.task(bind=True)
def maybe_replace(task: Task, replace: bool) -> int:
    if replace:
        return task.replace(maybe_replace.s(replace=False))   # error: "replace" of "Task" does not return a value (it only ever returns None)
    else:
        return 10
@sbdchd sbdchd added the bug Something isn't working label Nov 25, 2024
@kodiakhq kodiakhq bot closed this as completed in #165 Nov 25, 2024
@kodiakhq kodiakhq bot closed this as completed in 28e067c Nov 25, 2024
@sbdchd
Copy link
Owner

sbdchd commented Nov 26, 2024

Thank you!

@alecbarber
Copy link
Contributor Author

No worries!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants