From ad6fa88e53bd70d37b18b8beb49e57c8a344b99b Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Wed, 22 Jul 2020 21:49:27 -0700 Subject: [PATCH] Expect name to still be a string after disambiguation Check that encode('ascii') doesn't make it zero-length, but don't actually return the encoded form. --- masque/file/gdsii.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/masque/file/gdsii.py b/masque/file/gdsii.py index 0be8e3e..c91c061 100644 --- a/masque/file/gdsii.py +++ b/masque/file/gdsii.py @@ -119,7 +119,7 @@ def build(patterns: Union[Pattern, List[Pattern]], # Now create a structure for each pattern, and add in any Boundary and SREF elements for pat in patterns_by_id.values(): - structure = gdsii.structure.Structure(name=pat.name) + structure = gdsii.structure.Structure(name=pat.name.encode('ASCII')) lib.append(structure) structure += _shapes_to_elements(pat.shapes) @@ -385,7 +385,7 @@ def _subpatterns_to_refs(subpatterns: List[SubPattern] for subpat in subpatterns: if subpat.pattern is None: continue - encoded_name = subpat.pattern.name + encoded_name = subpat.pattern.name.encode('ASCII') # Note: GDS mirrors first and rotates second mirror_across_x, extra_angle = normalize_mirror(subpat.mirrored) @@ -514,5 +514,5 @@ def disambiguate_pattern_names(patterns: Sequence[Pattern], if len(encoded_name) > max_name_length: raise PatternError('Pattern name "{!r}" length > {} after encode,\n originally "{}"'.format(encoded_name, max_name_length, pat.name)) - pat.name = encoded_name + pat.name = suffixed_name used_names.append(suffixed_name)