You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/12/13 18:42:58 UTC

[GitHub] [airflow] jedcunningham commented on a change in pull request #20217: Lazy Jinja2 context

jedcunningham commented on a change in pull request #20217:
URL: https://github.com/apache/airflow/pull/20217#discussion_r768025196



##########
File path: airflow/utils/context.py
##########
@@ -124,6 +142,11 @@ def __reduce_ex__(self, protocol: int) -> Tuple[Any, ...]:
         items = [(key, self[key]) for key in self._context]
         return dict, (items,)
 
+    def __copy__(self) -> "Context":
+        new = type(self)(copy.copy(self._context))
+        new._deprecation_replacements = self._deprecation_replacements.copy()
+        return new
+
     def __getitem__(self, key: str) -> Any:
         with contextlib.suppress(KeyError):
             warnings.warn(_create_deprecation_warning(key, self._deprecation_replacements[key]), stacklevel=2)

Review comment:
       ```suggestion
               warnings.warn(_create_deprecation_warning(key, self._deprecation_replacements[key]))
   ```
   
   This is the culprit, as it issues the warning from `jinja2/runtime.py:154` instead.




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org