Skip to content

Commit

Permalink
allows system cython packages to work
Browse files Browse the repository at this point in the history
  • Loading branch information
dimpase committed Oct 10, 2023
1 parent 9459c5d commit 89a6f9f
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions build/pkgs/cython/patches/5690.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
diff --git a/Cython/Debugger/DebugWriter.py b/Cython/Debugger/DebugWriter.py
index 8b1fb75b027..2c3c310fc64 100644
--- a/Cython/Debugger/DebugWriter.py
+++ b/Cython/Debugger/DebugWriter.py
@@ -18,6 +18,21 @@
etree = None

from ..Compiler import Errors
+from ..Compiler.StringEncoding import EncodedString
+
+
+def is_valid_tag(name):
+ """
+ Names like '.0' are used internally for arguments
+ to functions creating generator expressions,
+ however they are not identifiers.
+
+ See https://github.com/cython/cython/issues/5552
+ """
+ if isinstance(name, EncodedString):
+ if name.startswith(".") and name[1:].isdecimal():
+ return False
+ return True


class CythonDebugWriter(object):
@@ -39,14 +54,17 @@ def __init__(self, output_dir):
self.start('cython_debug', attrs=dict(version='1.0'))

def start(self, name, attrs=None):
- self.tb.start(name, attrs or {})
+ if is_valid_tag(name):
+ self.tb.start(name, attrs or {})

def end(self, name):
- self.tb.end(name)
+ if is_valid_tag(name):
+ self.tb.end(name)

def add_entry(self, name, **attrs):
- self.tb.start(name, attrs)
- self.tb.end(name)
+ if is_valid_tag(name):
+ self.tb.start(name, attrs)
+ self.tb.end(name)

def serialize(self):
self.tb.end('Module')

0 comments on commit 89a6f9f

Please sign in to comment.