Skip to content

Commit 5bbf554

Browse files
Axel Vialadarnuria
authored andcommitted
Use deepcopy instead of reparsing the Gtid.
1 parent 3ca6914 commit 5bbf554

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pymysqlreplication/gtid.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# -*- coding: utf-8 -*-
2-
32
import re
43
import struct
54
import binascii
5+
from copy import deepcopy
66
from io import BytesIO
77

88
def overlap(i1, i2):
@@ -165,7 +165,7 @@ def __add__(self, other):
165165
raise Exception('Attempt to merge different SID'
166166
'%s != %s' % (self.sid, other.sid))
167167

168-
result = Gtid(str(self))
168+
result = deepcopy(self)
169169

170170
for itvl in other.intervals:
171171
result.__add_interval(itvl)
@@ -175,7 +175,7 @@ def __add__(self, other):
175175
def __sub__(self, other):
176176
"""Remove intervals. Do not raise, if different SID simply
177177
ignore"""
178-
result = Gtid(str(self))
178+
result = deepcopy(self)
179179
if self.sid != other.sid:
180180
return result
181181

@@ -276,6 +276,7 @@ def __ge__(self, other):
276276
return self.intervals >= other.intervals
277277

278278

279+
279280
class GtidSet(object):
280281
"""Represents a set of Gtid"""
281282
def __init__(self, gtid_set):

0 commit comments

Comments
 (0)