Azure / azure-functions-python-worker

Python worker for Azure Functions.
http://aka.ms/azurefunctions
MIT License
331 stars 100 forks source link

fix: added optional context param for tasks #1523

Open hallvictoria opened 3 days ago

hallvictoria commented 3 days ago

Description

Python 3.11+ introduced a context parameter that can be passed when creating a task. This change enables the ContextEnabledTask class to accept this parameter. Since the param is only available for 3.11+, there is a conditional check inside the ContextEnabledTask`` init() method to send the param based on python version.

Added tests for creating a task with context (3.11+), creating a task without context (all versions), and creating a ContextEnabledTask.

Fixes https://github.com/Azure/azure-functions-python-worker/issues/1508


PR information

Quality of Code and Contribution Guidelines