Skip to content

Commit

Permalink
add a patch for dealing with buggy cython tracing on 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed Nov 24, 2024
1 parent da60057 commit 2bebb38
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
3 changes: 3 additions & 0 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ source:
sha256: 4b37ebd25ada4059b0dc9e0893e70dde5df83485329a068ef04580e70892a65d
patches:
- patches/0001-skip-beam-density-test.patch
# for some reason cython 0.29 picks a non-default (and broken on 3.12)
# profile=True for _one_ particular file; suppress it
- patches/0002-explicitly-set-profile-False-in-levenshtein.pyx.patch # [py>=312]

build:
number: 0
Expand Down
13 changes: 11 additions & 2 deletions recipe/patches/0001-skip-beam-density-test.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
From fe0ff9eb662d596e462ab9f0f34e42a8df10cffc Mon Sep 17 00:00:00 2001
From: Adriane Boyd <adrianeboyd@gmail.com>
Date: Wed, 30 Mar 2022 15:59:16 +0200
Subject: [PATCH 1/2] skip beam density test

---
spacy/tests/parser/test_nn_beam.py | 1 +
1 file changed, 1 insertion(+)

diff --git a/spacy/tests/parser/test_nn_beam.py b/spacy/tests/parser/test_nn_beam.py
index 4ba020ef0..7942dfa7f 100644
index f852e5cda..97a4deafb 100644
--- a/spacy/tests/parser/test_nn_beam.py
+++ b/spacy/tests/parser/test_nn_beam.py
@@ -128,6 +128,7 @@ def test_beam_parse(examples, beam_width):
@@ -129,6 +129,7 @@ def test_beam_parse(examples, beam_width):
parser(doc)


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
From b50b84a8575089023169b0d85ce62b3712c0f3b6 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <h.vetinari@gmx.com>
Date: Sun, 24 Nov 2024 19:54:31 +1100
Subject: [PATCH 2/2] explicitly set profile=False in levenshtein.pyx

---
spacy/matcher/levenshtein.pyx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/spacy/matcher/levenshtein.pyx b/spacy/matcher/levenshtein.pyx
index e394f2cf4..81849d9ab 100644
--- a/spacy/matcher/levenshtein.pyx
+++ b/spacy/matcher/levenshtein.pyx
@@ -1,4 +1,4 @@
-# cython: binding=True, infer_types=True
+# cython: binding=True, infer_types=True, profile=False
from cpython.object cimport PyObject
from libc.stdint cimport int64_t

0 comments on commit 2bebb38

Please sign in to comment.