diff options
author | Matt Kangas <matt.kangas@mongodb.com> | 2014-11-13 09:02:02 -0500 |
---|---|---|
committer | Matt Kangas <matt.kangas@mongodb.com> | 2014-11-13 11:20:38 -0500 |
commit | f31a38be3ce39267382e59b4fe74be1129b96679 (patch) | |
tree | ae73a6cf7320ffa471c65e0b718a59a5270a2e92 /src/third_party/wiredtiger/lang | |
parent | a6be8c0d9cee8c3a87a26f3d5e0fb6f58632bf43 (diff) | |
download | mongo-f31a38be3ce39267382e59b4fe74be1129b96679.tar.gz |
Import wiredtiger-wiredtiger-2.4.0-325-gb4df6ce.tar.gz from wiredtiger branch develop
Diffstat (limited to 'src/third_party/wiredtiger/lang')
-rw-r--r-- | src/third_party/wiredtiger/lang/python/wiredtiger/packing.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/third_party/wiredtiger/lang/python/wiredtiger/packing.py b/src/third_party/wiredtiger/lang/python/wiredtiger/packing.py index a79bf6bffbd..3ad4623e2f1 100644 --- a/src/third_party/wiredtiger/lang/python/wiredtiger/packing.py +++ b/src/third_party/wiredtiger/lang/python/wiredtiger/packing.py @@ -109,10 +109,11 @@ def pack(fmt, *values): result += '\0' * size # Note: no value, don't increment i elif f in 'Ssu': - if f == 'S' and '\0' in values[i]: - l = values[i].find('\0') + val = values[i] + if f == 'S' and '\0' in val: + l = val.find('\0') else: - l = len(values[i]) + l = len(val) if havesize: if l > size: l = size @@ -120,7 +121,10 @@ def pack(fmt, *values): havesize = size = 1 elif f == 'u' and offset != len(fmt) - 1: result += pack_int(l) - result += values[i][:l] + if type(val) is unicode and f in 'Ss': + result += str(val[:l]) + else: + result += val[:l] if f == 'S' and not havesize: result += '\0' elif size > l: |