Skip to content

Commit

Permalink
Merge pull request #110 from itasualint/avoid_overflow_warning
Browse files Browse the repository at this point in the history
fix: avoid overflow issues
  • Loading branch information
long2ice authored Dec 5, 2024
2 parents 0183ef4 + 98e26ec commit 509e51d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions asyncmy/connection.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1099,10 +1099,9 @@ cdef class MySQLResult:
self.field_count = first_packet.read_length_encoded_integer()
await self._get_descriptions()

# Apparently, MySQLdb picks this number because it's the maximum
# value of a 64bit unsigned integer. Since we're emulating MySQLdb,
# we set it to this instead of None, which would be preferred.
self.affected_rows = 18446744073709551615
# MySQLdb used 18446744073709551615 to indicate an undefined state.
# We now use -1 for the same purpose to avoid overflow issues.
self.affected_rows = -1

def _read_ok_packet(self, first_packet):
ok_packet = OKPacketWrapper(first_packet)
Expand Down

0 comments on commit 509e51d

Please sign in to comment.