From 8dc79d1b3066950835bb416a40ed9bd5256c3908 Mon Sep 17 00:00:00 2001 From: Bernie Hackett Date: Wed, 20 Aug 2014 11:10:04 -0700 Subject: [PATCH] PYTHON-346 - Use a tuple for decoder options. This is just a cleanup of the existing decoder. I tried using a namedtuple but that imposed up to a 17% perf hit (a regular tuple imposed no measureable perf hit). We may be able to avoid that problem with a new API that accepts decoder options in a specific class instead of creating the instance in the decoder itself. --- bson/__init__.py | 104 ++++++++++++++++++++--------------------------- 1 file changed, 43 insertions(+), 61 deletions(-) diff --git a/bson/__init__.py b/bson/__init__.py index 73b8a647e..c375d7d57 100644 --- a/bson/__init__.py +++ b/bson/__init__.py @@ -91,9 +91,7 @@ BSONMIN = b"\xFF" # Min key BSONMAX = b"\x7F" # Max key -def _get_int(data, position, as_class=None, - tz_aware=False, uuid_subtype=OLD_UUID_SUBTYPE, - compile_re=True, unsigned=False): +def _get_int(data, position, dummy, unsigned=False): format = unsigned and "I" or "i" try: value = struct.unpack("<%s" % format, data[position:position + 4])[0] @@ -159,13 +157,13 @@ else: _make_name = _make_c_string_check -def _get_number(data, position, as_class, tz_aware, uuid_subtype, compile_re): +def _get_number(data, position, dummy): num = struct.unpack("