Unverified Commit da3c253c authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

python312Packages.tree-sitter: enable tests (#377525)

parents 154a2c1a c31e83ec
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -28,6 +28,11 @@ buildPythonPackage rec {
    fetchSubmodules = true;
  };

  # see https://github.com/tree-sitter/py-tree-sitter/issues/330#issuecomment-2629403946
  patches = lib.optionals (stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isLinux) [
    ./segfault-patch.diff
  ];

  build-system = [ setuptools ];

  nativeCheckInputs = [
@@ -51,14 +56,11 @@ buildPythonPackage rec {
    "test_dot_graphs"
  ];

  # Segfaults explosively for some reason, but dependents seem to work?
  doCheck = !stdenv.hostPlatform.isAarch64;

  meta = with lib; {
  meta = {
    description = "Python bindings to the Tree-sitter parsing library";
    homepage = "https://github.com/tree-sitter/py-tree-sitter";
    changelog = "https://github.com/tree-sitter/py-tree-sitter/releases/tag/${src.tag}";
    license = licenses.mit;
    maintainers = with maintainers; [ fab ];
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ fab ];
  };
}
+13 −0
Original line number Diff line number Diff line
--- i/tree_sitter/core/lib/src/parser.c
+++ w/tree_sitter/core/lib/src/parser.c
@@ -2084,6 +2084,10 @@ void ts_parser_reset(TSParser *self) {
   self->parse_state = (TSParseState) {0};
 }
 
+// FIXME: see tree-sitter/py-tree-sitter#330
+#if __GNUC__ >= 14 && defined(__aarch64__) && defined(__OPTIMIZE__) && !defined(__OPTIMIZE_SIZE__)
+__attribute__((optimize(2)))
+#endif
 TSTree *ts_parser_parse(
   TSParser *self,
   const TSTree *old_tree,