
https://github.com/cython/cython/pull/5690 https://github.com/cython/cython/pull/5725 Both are merged in cython 3.0.3, however that release breaks scipy.
139 lines
4.3 KiB
Diff
139 lines
4.3 KiB
Diff
Taken from https://github.com/cython/cython/pull/5690
|
|
|
|
From d0139394794c207956c972e90ce59f33ef1fd709 Mon Sep 17 00:00:00 2001
|
|
From: Oleksandr Pavlyk <oleksandr.pavlyk@intel.com>
|
|
Date: Fri, 8 Sep 2023 14:30:06 -0500
|
|
Subject: [PATCH 1/4] Skip building trees for nodes with invalid tag name
|
|
|
|
This change attempts to exclude arguments with invalid tag names
|
|
from being inserted into the TreeBuilder
|
|
---
|
|
Cython/Debugger/DebugWriter.py | 18 ++++++++++++++----
|
|
1 file changed, 14 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/Cython/Debugger/DebugWriter.py b/Cython/Debugger/DebugWriter.py
|
|
index 8b1fb75b027..dbe7cf55671 100644
|
|
--- a/Cython/Debugger/DebugWriter.py
|
|
+++ b/Cython/Debugger/DebugWriter.py
|
|
@@ -20,6 +20,13 @@
|
|
from ..Compiler import Errors
|
|
|
|
|
|
+def is_valid_tag(name):
|
|
+ if hasattr(name, "startswith"):
|
|
+ if name.startswith(".") and name[1:].isnumeric():
|
|
+ return False
|
|
+ return True
|
|
+
|
|
+
|
|
class CythonDebugWriter(object):
|
|
"""
|
|
Class to output debugging information for cygdb
|
|
@@ -39,14 +46,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')
|
|
|
|
From 1ea76c1adc3f5ab003a6ad9513ce25e5e7620388 Mon Sep 17 00:00:00 2001
|
|
From: Oleksandr Pavlyk <oleksandr.pavlyk@intel.com>
|
|
Date: Fri, 8 Sep 2023 15:18:21 -0500
|
|
Subject: [PATCH 2/4] Use type checking is is_valid_tag for efficiency
|
|
|
|
Documented the purpose of is_valid_tag function in its docstring.
|
|
---
|
|
Cython/Debugger/DebugWriter.py | 10 +++++++++-
|
|
1 file changed, 9 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/Cython/Debugger/DebugWriter.py b/Cython/Debugger/DebugWriter.py
|
|
index dbe7cf55671..57ada84ac2e 100644
|
|
--- a/Cython/Debugger/DebugWriter.py
|
|
+++ b/Cython/Debugger/DebugWriter.py
|
|
@@ -18,10 +18,18 @@
|
|
etree = None
|
|
|
|
from ..Compiler import Errors
|
|
+from ..Compiler.StringEncoding import EncodedString
|
|
|
|
|
|
def is_valid_tag(name):
|
|
- if hasattr(name, "startswith"):
|
|
+ """
|
|
+ Names like '.0' are used internally for arguments
|
|
+ to functions creating generator expressions,
|
|
+ however they are not identifiers.
|
|
+
|
|
+ See gh-5552
|
|
+ """
|
|
+ if isinstance(name, EncodedString):
|
|
if name.startswith(".") and name[1:].isnumeric():
|
|
return False
|
|
return True
|
|
|
|
From 4f0cf58ef1176af6c66e492428b78a4da37c41dc Mon Sep 17 00:00:00 2001
|
|
From: scoder <stefan_ml@behnel.de>
|
|
Date: Sat, 9 Sep 2023 11:28:47 +0200
|
|
Subject: [PATCH 3/4] Fix minor issues.
|
|
|
|
---
|
|
Cython/Debugger/DebugWriter.py | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/Cython/Debugger/DebugWriter.py b/Cython/Debugger/DebugWriter.py
|
|
index 57ada84ac2e..46db48a6bd8 100644
|
|
--- a/Cython/Debugger/DebugWriter.py
|
|
+++ b/Cython/Debugger/DebugWriter.py
|
|
@@ -27,10 +27,10 @@ def is_valid_tag(name):
|
|
to functions creating generator expressions,
|
|
however they are not identifiers.
|
|
|
|
- See gh-5552
|
|
+ See https://github.com/cython/cython/issues/5552
|
|
"""
|
|
if isinstance(name, EncodedString):
|
|
- if name.startswith(".") and name[1:].isnumeric():
|
|
+ if name.startswith(".") and name[1:].isdecimal():
|
|
return False
|
|
return True
|
|
|
|
|
|
From 0d13568946f5865a55340db09310accd2323f6bf Mon Sep 17 00:00:00 2001
|
|
From: scoder <stefan_ml@behnel.de>
|
|
Date: Sat, 9 Sep 2023 12:22:21 +0200
|
|
Subject: [PATCH 4/4] Remove trailing whitespace.
|
|
|
|
---
|
|
Cython/Debugger/DebugWriter.py | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/Cython/Debugger/DebugWriter.py b/Cython/Debugger/DebugWriter.py
|
|
index 46db48a6bd8..2c3c310fc64 100644
|
|
--- a/Cython/Debugger/DebugWriter.py
|
|
+++ b/Cython/Debugger/DebugWriter.py
|
|
@@ -25,7 +25,7 @@ def is_valid_tag(name):
|
|
"""
|
|
Names like '.0' are used internally for arguments
|
|
to functions creating generator expressions,
|
|
- however they are not identifiers.
|
|
+ however they are not identifiers.
|
|
|
|
See https://github.com/cython/cython/issues/5552
|
|
"""
|