Skip to content

Commit 31e0650

Browse files
committed
Fix doc strings that are too long and generate error on windows
1 parent e628909 commit 31e0650

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

modules/python/generator/visp_python_bindgen/doc_parser.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,18 @@ def to_cstring(s: str) -> str:
8484
s = re.sub('\n\n\n+', '\n\n', s)
8585
s = re.sub('\\\\ +', '\\\\', s)
8686

87-
return f'''R"doc(
88-
{s}
89-
)doc"'''
87+
# On Windows, strings have a maximum length.
88+
per_string_limit = 8192
89+
current_char = 0
90+
result = ''
91+
while current_char < len(s):
92+
result += f'''R"doc(
93+
{s[current_char: min((current_char + per_string_limit), len(s))]})doc"
94+
95+
'''
96+
current_char += per_string_limit
97+
return result
98+
9099

91100
@dataclass
92101
class MethodDocSignature:

0 commit comments

Comments
 (0)