Skip to content

Commit ec24925

Browse files
author
Paweł Andruszkiewicz
committed
Fix runtime issues with Python 3.13
Fixed config_parser.py: MySQLRawConfigParser extends Python's RawConfigParser, and overwrites one of its methods. This class was rewritten in Python 3.13, and some of the internal implementation has changed. Fixed Json_shell.incomplete_python, Python 3.13 has changed how errors are printed, they used to be printed in chunks, now the whole lines are printed. Change-Id: Id1ddefa61260ac3453988ea041b125e3c6d50ee5
1 parent d6b7e56 commit ec24925

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

python/packages/mysql_gadgets/common/config_parser.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,8 @@ def _read(self, fp, fpname):
367367
# Use dict comprehension syntax compatible with Python 2.6:
368368
# inline_prefixes = {p: -1 for p in
369369
# self._inline_comment_prefixes}
370-
inline_prefixes = dict(
371-
(p, -1) for p in self._inline_comment_prefixes)
370+
inline_prefixes = self._inline_comment_prefixes if hasattr(self, '_inline_comment_prefixes') else self._prefixes.inline
371+
inline_prefixes = dict((p, -1) for p in inline_prefixes)
372372
while comment_start == sys.maxsize and inline_prefixes:
373373
next_prefixes = {}
374374
for prefix, index in inline_prefixes.items():
@@ -381,7 +381,8 @@ def _read(self, fp, fpname):
381381
comment_start = min(comment_start, index)
382382
inline_prefixes = next_prefixes
383383
# strip full line comments
384-
for prefix in self._comment_prefixes:
384+
comment_prefixes = self._comment_prefixes if hasattr(self, '_comment_prefixes') else self._prefixes.full
385+
for prefix in comment_prefixes:
385386
if line.strip().startswith(prefix):
386387
comment_start = 0
387388
break

unittest/json_shell_t.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,14 @@ def sample(data):
220220
221221
sample("some text"
222222
)*",
223-
"{\"error\":\"SyntaxError\"}"},
223+
"{\"error\":\"SyntaxError"},
224224
{R"*(
225225
def sample(data):
226226
print(data)
227227
228228
sample("some text)
229229
)*",
230-
"\"error\":\"SyntaxError\"}"}};
230+
"\"error\":\"SyntaxError"}};
231231

232232
for (const auto &input : invalid_inputs) {
233233
shcore::JSON_dumper doc;

0 commit comments

Comments
 (0)