Skip to content

Commit 9e337ee

Browse files
Merge pull request #391 from darnuria/gtid-cpy-ctor
Avoid reparsing a Gtid to copy in sub/add
2 parents 7328e9a + c9b69dc commit 9e337ee

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pymysqlreplication/gtid.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import re
44
import struct
55
import binascii
6+
from copy import deepcopy
67
from io import BytesIO
78

89
def overlap(i1, i2):
@@ -165,7 +166,7 @@ def __add__(self, other):
165166
raise Exception('Attempt to merge different SID'
166167
'%s != %s' % (self.sid, other.sid))
167168

168-
result = Gtid(str(self))
169+
result = deepcopy(self)
169170

170171
for itvl in other.intervals:
171172
result.__add_interval(itvl)
@@ -175,7 +176,7 @@ def __add__(self, other):
175176
def __sub__(self, other):
176177
"""Remove intervals. Do not raise, if different SID simply
177178
ignore"""
178-
result = Gtid(str(self))
179+
result = deepcopy(self)
179180
if self.sid != other.sid:
180181
return result
181182

0 commit comments

Comments
 (0)