Fokko commented on a change in pull request #3740: [AIRFLOW-2888] Remove 
shell=True and bash from task launch
URL: https://github.com/apache/incubator-airflow/pull/3740#discussion_r209462759
 
 

 ##########
 File path: airflow/task/task_runner/base_task_runner.py
 ##########
 @@ -106,7 +106,7 @@ def _read_task_logs(self, stream):
                           self._task_instance.job_id, 
self._task_instance.task_id,
                           line.rstrip('\n'))
 
-    def run_command(self, run_with, join_args=False):
+    def run_command(self, run_with=[], join_args=False):
 
 Review comment:
   This is a bad idea. @kaxil fixed some lately. But the `[]` is initialized 
just once in Python. Therefore if you change the object later on, it will be 
changed because it is by reference:
   
   ```
   MacBook-Pro-van-Fokko:~ fokkodriesprong$ python3
   Python 3.7.0 (default, Jun 29 2018, 20:13:13) 
   [Clang 9.1.0 (clang-902.0.39.2)] on darwin
   Type "help", "copyright", "credits" or "license" for more information.
   >>> def some_function(a=[]):
   ...     return a
   ... 
   >>> 
   >>> b = some_function()
   >>> b += 'vo'
   >>> 
   >>> some_function()
   ['v', 'o']
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to