-
-
Notifications
You must be signed in to change notification settings - Fork 487
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allows system cython packages to work
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |