hfzvc opened a new issue, #25778:
URL: https://github.com/apache/airflow/issues/25778
### Apache Airflow version
2.3.3
### What happened
While moving to Airflow 2.x our team noticed a strange thing occur in a
recent DAG we were converting to Airflow 2.x code.
When using `PythonOperator`s and setting `provide_context: False`, Airflow
Webserver will raise an AirflowException that invalid arguments were passed to
`PythonOperator`.
If we set `provide_context: True`, this error goes away with no complaint
from the DAG.
### What you think should happen instead
As the update.md for Airflow 2.x states that `provide_context` is now
removed from `PythonOperators`, whether the value is set to `True` or `False`
should be irrelevant? That is an error should be raised either way, as the
argument would be technically an invalid argument irrespective of the value set.
### How to reproduce
```
dag = DAG("irrelevant_args", schedule_interval=None,
start_date=datetime(2022, 3, 8))
PythonOperator(task_id='Task_A', python_callable=lambda x: x, op_args=[],
dag=dag, provide_context=True) # This is fine
PythonOperator(task_id='Task_B', python_callable=lambda x: x, op_args=[],
dag=dag, provide_context=False) # This will raise a DAG Import Error in
webserver
```
### Operating System
Debian GNU/Linux 11 (bullseye)
### Versions of Apache Airflow Providers
N/A
### Deployment
Docker-Compose
### Deployment details
_No response_
### Anything else
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]