Parcourir la source

Fall back to the native implementation of _merge_entries on pypy,
since otherwise it causes segfaults (for as of yet unknown reasons).

Jelmer Vernooij il y a 10 ans
Parent
commit
a2acfdaf32
2 fichiers modifiés avec 9 ajouts et 1 suppressions
  1. 5 0
      NEWS
  2. 4 1
      dulwich/diff_tree.py

+ 5 - 0
NEWS

@@ -10,6 +10,11 @@
   * Strip newline from final ACKed SHA while fetching packs.
     (Michael Edgar)
 
+  * The C implementation of `dulwich._diff_tree._merge_entries` is broken
+    on pypy and causes it to segfault. Avoid importing it and fall back
+    to the native implementation for now.
+    (Jelmer Vernooij)
+
  IMPROVEMENTS
 
   * Add porcelain 'receive-pack' and 'upload-pack'. (Jelmer Vernooij)

+ 4 - 1
dulwich/diff_tree.py

@@ -590,6 +590,9 @@ _merge_entries_py = _merge_entries
 _count_blocks_py = _count_blocks
 try:
     # Try to import C versions
-    from dulwich._diff_tree import _is_tree, _merge_entries, _count_blocks
+    from dulwich._diff_tree import _is_tree, _count_blocks
+    import sys
+    if not '__pypy__' in sys.builtin_module_names:
+        from dulwich._diff_tree import _merge_entries
 except ImportError:
     pass