瀏覽代碼

fix: Avoid mutable default input argument

Cristian 5 年之前
父節點
當前提交
db523c9d82
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      archivebox/main.py

+ 4 - 1
archivebox/main.py

@@ -526,11 +526,14 @@ def add(urls: Union[str, List[str]],
         overwrite: bool=False,
         init: bool=False,
         out_dir: Path=OUTPUT_DIR,
-        extractors: list=[]) -> List[Link]:
+        extractors: list=None) -> List[Link]:
     """Add a new URL or list of URLs to your archive"""
 
     assert depth in (0, 1), 'Depth must be 0 or 1 (depth >1 is not supported yet)'
 
+    if extractors is None:
+        extractors = []
+
     if init:
         run_subcommand('init', stdin=None, pwd=out_dir)