Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-186

When storing integers, type is selected according to value instead of type

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 1.10.1
    • None
    • None

    Description

      if isinstance(value, (int, long)):

      1. TODO this is a really ugly way to check for this...
        if value > 2 ** 64 / 2 - 1 or value < -2 ** 64 / 2:
        raise OverflowError("BSON can only handle up to 8-byte ints")
        if value > 2 ** 32 / 2 - 1 or value < -2 ** 32 / 2:
        return "\x12" + name + struct.pack("<q", value)
        return "\x10" + name + struct.pack("<i", value)

      This is a really ugly way and it does not allow to store long (>2**32) value, which was stored as zero and then $inc'ed.

      Attachments

        Issue Links

          Activity

            People

              bernie@mongodb.com Bernie Hackett
              raorn Alexey I. Froloff
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: