From f1f840bbe57d7e738ad6079e778acb8848527efe Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Thu, 21 Jul 2022 21:45:51 +0200 Subject: [PATCH] fix usage of eval(repr(Editop)) and eval(repr(Opcode)) --- CHANGELOG.md | 3 +++ src/rapidfuzz/distance/_initialize_cpp.pyx | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 909b732..5503477 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ #### Changed - merge adjacent similar blocks in `rapidfuzz.distance.Opcodes` +#### Fixed +- fix usage of `eval(repr(Editop))` and `eval(repr(Opcode))` + ### [2.2.0] - 2022-07-19 #### Changed - added in-tree build backend to install cmake and ninja only when it is not installed yet diff --git a/src/rapidfuzz/distance/_initialize_cpp.pyx b/src/rapidfuzz/distance/_initialize_cpp.pyx index 70d2554..a30c198 100644 --- a/src/rapidfuzz/distance/_initialize_cpp.pyx +++ b/src/rapidfuzz/distance/_initialize_cpp.pyx @@ -211,7 +211,7 @@ cdef class Editop: raise IndexError('Editop index out of range') def __repr__(self): - return f"Editop(tag={self.tag}, src_pos={self.src_pos}, dest_pos={self.dest_pos})" + return f"Editop(tag='{self.tag}', src_pos={self.src_pos}, dest_pos={self.dest_pos})" cdef class Editops: """ @@ -408,7 +408,7 @@ cdef class Opcode: raise IndexError('Opcode index out of range') def __repr__(self): - return f"Opcode(tag={self.tag}, src_start={self.src_start}, src_end={self.src_end}, dest_start={self.dest_start}, dest_end={self.dest_end})" + return f"Opcode(tag='{self.tag}', src_start={self.src_start}, src_end={self.src_end}, dest_start={self.dest_start}, dest_end={self.dest_end})" cdef class Opcodes: """