Bernie Hackett
cbc81ee793
PYTHON-1536 - PyMongo no longer supports PyPy3 < 3.5
2018-07-03 12:44:40 -07:00
Bernie Hackett
749c1a2f0b
PYTHON-1467 - PyMongo no longer supports Python 2.6
2018-07-02 15:15:43 -07:00
Bernie Hackett
ccbd857838
PYTHON-1506 - Add CodecOptions examples
2018-06-25 23:13:15 -04:00
stephan-hof
e113a338e9
Improve the check for legal utf8 in the bson module.
...
Now python and bson have the same understanding of legal utf8.
2018-06-24 19:59:16 -07:00
Shane Harvey
ea8cb6c209
PYTHON-1329 Send/receive commands as OP_MSG
...
Don't use $query with OP_MSG.
Support compression with OP_MSG.
2018-06-21 15:46:48 -07:00
Shane Harvey
e4317d286b
PYTHON-1508 Retryable commit/abort, has_error_label api
...
Retryable commitTransaction/abortTransaction.
Retry writes after certain writeConcernErrors.
Add has_error_label api.
Update unacknowledged write concern error messge.
Resync transaction tests and update test runner.
2018-06-07 14:39:52 -07:00
Bernie Hackett
61850357a0
PYTHON-1521 - Use FNV-1a for ObjectId machine bytes
2018-05-31 12:26:53 -07:00
Shane Harvey
5ff33a2a37
PYTHON-1554 Fix datetime decoding memory leak
2018-05-22 13:42:59 -07:00
Bernie Hackett
ba7c95a9df
PYTHON-1462 - Import ABCs from collections.abc
2018-02-12 19:42:44 -08:00
Shane Harvey
1a784e1afb
PYTHON-1466 Silence minor complaints from Coverity
...
Remove useless NULL check as GETSTATE cannot return NULL after
successful initialization.
2018-02-12 11:31:48 -08:00
Bernie Hackett
507f954ed4
Update copyright dates
2017-12-01 17:23:39 -08:00
Bernie Hackett
de801be529
Silence various complaints from Coverity
2017-11-30 15:02:20 -08:00
Shane Harvey
a4f58cce53
PYTHON-1404 Avoid copying RawBSONDocument.raw.
2017-11-10 15:45:04 -08:00
Bernie Hackett
2719464837
PYTHON-1352 - Move BSON type map docs from bson.son.SON to bson
2017-11-08 11:24:28 -08:00
Bernie Hackett
410027c057
PYTHON-1387 - Improve detection of object_pairs_hook support
2017-09-30 09:28:09 -07:00
gzcf
9051b65510
PYTHON-1299 fix Regex __eq__ method ( #337 )
2017-09-29 10:57:21 -07:00
Shane Harvey
e775295ab5
PYTHON-1367 Ignore uuid_representation when decoding BSON binary subtype 4.
2017-09-12 17:20:14 -07:00
Anthony Sottile
41be71f09f
Trim trailing whitespace
2017-08-31 22:26:39 -07:00
A. Jesse Jiryu Davis
de54cafff5
Unused import
2017-08-25 15:24:16 -04:00
Shane Harvey
b7893b7ec4
3.5 changelog and documentation fixes.
2017-08-08 09:32:09 -07:00
Shane Harvey
6e022e0636
PYTHON-1297 Improve documentation for Extended JSON.
2017-08-07 17:14:34 -07:00
Shane Harvey
47ab8c3187
PYTHON-1343 Use unsigned long to encode Timestamps.
...
The time and increment portions of a Timestamp are unsigned 32-bit integers
which are not guaranteed to fit inside a long.
2017-08-04 11:33:49 -07:00
Shane Harvey
054a01aaff
PYTHON-1297 Implement Extended JSON Spec 2.0
...
Add JSONOptions.json_mode to control encoding Relaxed and Canonical
Extended JSON.
Add json_util.LEGACY_JSON_OPTIONS to encode PyMongo 3.4's default JSON output.
Deprecate json_util.STRICT_JSON_OPTIONS.
Move Decimal128 spec tests to bson_corpus runner.
2017-08-03 10:30:24 -07:00
Shane Harvey
6a11888a9c
PYTHON-1330 Decode JSON binary type 0 to Python 3 bytes.
2017-07-31 13:16:46 -07:00
A. Jesse Jiryu Davis
217f90bab6
PYTHON-1284 Don't copy CodecOptions in RawBSONDocument
2017-07-01 09:07:58 -04:00
Bernie Hackett
02e606608e
PYTHON-1213 - Make decimal128 work with cdecimal
2017-04-04 17:01:50 -07:00
Bernie Hackett
2fe8d7cf69
PYTHON-1244 - Fix signed/unsigned comparison
2017-02-27 16:14:47 -08:00
Luke Lovett
74c0d55314
PYTHON-1214 - Implement the extended JSON specification.
2017-02-22 10:32:29 -08:00
Bernie Hackett
21b6a47ce9
PYTHON-1202 - Fix time64 compilation with -std=c99
...
Python 2.6 on Solaris 11 is built with -std=c99. That causes
build issues for our time64 code, which needs localtime_r and
tzset. Including Python.h in time64.c provides the necessary magic.
2017-02-17 13:55:50 -08:00
Bernie Hackett
afa14fb3a2
Link to python-bsonjs on pypi
2016-11-29 09:31:27 -08:00
Shane Harvey
0abcb7a683
Advertise python-bsonjs in json_util and FAQ documentation
2016-11-28 17:36:40 -08:00
Bernie Hackett
8ae717d0df
Always check for errors after calling PyLong/Int_AsLong
2016-10-26 16:48:24 -07:00
Petr Messner
8712009f5a
Fix ref count management when building _element_to_dict result tuple
2016-10-20 15:46:00 -07:00
Bernie Hackett
c0767a551a
PYTHON-1153 - Make docs build and test under python 3
2016-09-26 15:49:59 -07:00
Bernie Hackett
1a45a0fa08
Changelog for PyMongo 3.4
2016-09-16 14:31:20 -07:00
Shane Harvey
888d0fab1f
PYTHON-1135 Replace JSONOptions.strict_date with JSONOptions.datetime_representation
2016-09-12 11:11:30 -07:00
Luke Lovett
d37bb4aabf
Merge branch 'patch-1' of https://github.com/cjgibson/mongo-python-driver into 34dev
2016-09-09 15:07:59 -07:00
Christian Gibson
bca7e3b994
Updating class reference in comment.
2016-09-09 17:55:20 -04:00
Bernie Hackett
7933d5a95f
PYTHON-1068 - Update Decimal128 for latest spec changes
2016-08-29 15:07:07 -07:00
Bernie Hackett
82db71e1e8
PYTHON-1068 - Support for BSON Decimal128
2016-08-29 15:07:07 -07:00
Luke Lovett
b6c74cf33d
PYTHON-1106 - Implement BSON corpus test suite.
2016-08-24 11:01:45 -07:00
Luke Lovett
6692e8877a
PYTHON-1131 - Fix inconsistent handling of scope, unicode support for Code.
2016-08-19 15:22:19 -07:00
Shane Harvey
6e2ecc1817
PYTHON-1111 JSONOptions.document_class requires simplejson in Python2.6
2016-08-01 10:05:16 -07:00
Shane Harvey
57d1ccde2f
PYTHON-1111 Add JSONOptions for dumps and loads
...
PYTHON-767 Support JSON strict mode $date output
PYTHON-1039 Support JSON strict mode $numberLong output
PYTHON-1103 Support JSON strict mode UUID output
PYTHON-1111 Support custom document class in loads
PYTHON-1111 Support tz_aware and tzinfo in loads
Refactor milliseconds to datetime conversions
2016-07-27 11:32:59 -07:00
Shane Harvey
5afd19922a
PYTHON-1111 Add JSONOptions for dumps and loads
2016-07-22 12:10:29 -07:00
Bernie Hackett
c4e8d22544
PYTHON-1025 - C extensions big endian support
2016-06-24 17:54:24 -07:00
Bernie Hackett
53a7bea492
PYTHON-1022 - Drop support for Python 3.2
...
This change removes the u() helper from bson.py3compat
and all of its uses in the driver and tests. PyPy3 continues
to be supported since, even though it is based on python 3.2.5,
it has always supported the u string prefix.
The README and install docs are now explicit about PyPy(3) support.
2016-06-15 10:05:43 -07:00
Bernie Hackett
59d8fdadc1
PYTHON-1058 - Support decoding datetime.isoformat format for $date
...
This change also adds support for the (+|-)HH offset format.
2016-05-20 13:12:47 -07:00
Bernie Hackett
49c847f9b5
Fix a few issues discovered by coverity scan
2016-02-01 17:05:28 -08:00
Bernie Hackett
6a14d70120
PYTHON-1044 - Fix up unknown BSON type handing
2016-01-28 11:21:34 -08:00
Luke Lovett
e4d3392f90
PYTHON-472 - Add a RawBSONDocument class that decodes its comprising bytes only on-demand.
...
This provides an API for inserting and returning raw BSON.
2015-11-18 15:00:09 -08:00
Luke Lovett
c63c0f1d91
PYTHON-1013 - Only reraise PyExc_Exceptions as InvalidBSON in C extensions.
2015-11-17 11:07:39 -08:00
aherlihy
af0daa4fc4
PYTHON-1010 write_dict now checks the error indicator when exiting iteration loop
2015-11-13 10:58:23 -05:00
Bernie Hackett
c0df9955f4
Changelog for 3.1
2015-10-12 12:28:31 -07:00
Bernie Hackett
8a21411c33
Silence pointless compiler warnings
2015-09-29 18:57:57 -07:00
Bernie Hackett
c327913cbf
Fix issues found in coverity scan
2015-09-29 17:29:59 -07:00
Luke Lovett
3321b66d34
PYTHON-977 - Fix __hash__ method on BSON types that inherit from Python builtin types.
...
In Python 2, objects automatically inherit the __hash__ of their parent
class. In Python 3, objects that override __eq__ do not automatically inherit
__hash__, so these objects were not hashable under Python 3. Additionally,
mutable BSON types and types that overide __eq__ but did not explicitly define
__hash__ had broken __hash__ methods under Python 2. This commit unifies the
hashing behavior between Python versions and fixes the __hash__ methods such
that two BSON objects hash the same only if they are equal.
N.B.: bson.code.Code and bson.regex.Regex are no longer hashable under Python 2
because they are mutable.
2015-09-04 14:45:24 -07:00
Luke Lovett
f62dbc15bd
PYTHON-969 - Check return value from PyObject_Call before using it in PyObject_GetAttrString.
2015-07-22 16:43:34 -07:00
Luke Lovett
880394fe99
PYTHON-222 - Add a 'tzinfo' attribute to CodecOptions that specifies a timezone to which to decode datetime objects.
2015-07-09 13:32:23 -07:00
aherlihy
39308c4b2f
PYTHON-721 - Add unicode_decode_error_handler to CodecOptions.
2015-07-09 15:08:02 -04:00
Bernie Hackett
3716b449cc
PYTHON-871 - Fix encoding of defaultdict.
2015-03-27 14:35:09 -07:00
Bernie Hackett
76530ccd72
PYTHON-870 - Fix two unlikely reference leaks.
2015-03-26 13:00:40 -07:00
Bernie Hackett
aec685b374
Fix up copyright dates.
2015-03-25 11:55:02 -07:00
Bernie Hackett
bba49fd618
PYTHON-864 - Support RFC-3339 offset format for $date.
2015-03-20 16:23:55 -07:00
Bernie Hackett
c87424e7af
PYTHON-856 - as_class -> document_class
...
This commit changes the name of the as_class option
in CodecOptions to document_class, to match the name
of the MongoClient option.
2015-03-09 14:32:42 -07:00
Bernie Hackett
6bacdaafaa
PYTHON-851 - Clean up MongoClient properties.
2015-03-08 20:23:07 -07:00
Bernie Hackett
7164ba2f41
PYTHON-839 - Better validation error messages.
2015-02-25 10:14:29 -08:00
Bernie Hackett
839893939e
PYTHON-821 - Deprecated legacy API.
...
This commit deprecates insert, update, save, and remove. Each
now raises DeprecationWarning at stacklevel 2. This change also
updates all tutorials and example documentation to use the new
CRUD API, tests the deprecations, and fixes up a few more tests
that were still using the legacy API.
2015-02-20 15:41:45 -08:00
A. Jesse Jiryu Davis
9da835ab3d
PYTHON-825 BSON API changes and internal options handling.
...
This change resolves four issues:
PYTHON-826 The new codec_options submodule is moved from pymongo to bson.
PYTHON-827 Use codec_options in BSON APIs.
Functions and methods of the bson module that accepted the options as_class,
tz_aware, and uuid_subtype now accept a codec_options parameter instead.
For example, the function definition for bson.decode_all changes from this:
def decode_all(data, as_class=dict, tz_aware=True,
uuid_subtype=OLD_UUID_SUBTYPE)
to:
def decode_all(data, codec_options=CodecOptions())
The following functions are changed:
- decode_all
- decode_iter
- decode_file_iter
The following methods are changed:
- BSON.encode
- BSON.decode
This is a breaking change for any application that uses the BSON API directly
and changes any of the named parameter defaults. No changes are required for
applications that use the default values for these options. The behavior
remains the same.
PYTHON-828 Internal BSON module changes to support CodecOptions
The pure Python BSON module passes around a CodecOptions instance instead of
as_class, tz_aware, and uuid_subtype. C extensions pass these values around in
a struct.
PYTHON-801 Rename uuid_subtype to uuid_representation.
2015-02-05 23:09:23 -06:00
A. Jesse Jiryu Davis
a2c13090d8
PYTHON-826 Move codec_options submodule from pymongo to bson.
2015-02-02 09:38:49 -05:00
Bernie Hackett
a3fb2462bb
PYTHON-801 - Remove BaseObject.uuid_subtype
2014-12-29 07:34:07 -08:00
Bernie Hackett
7e4ebde147
PYTHON-801 - Add STANDARD and PYTHON_LEGACY to bson.binary
...
And use them in place of UUID_SUBTYPE and OLD_UUID_SUBTYPE. This
change also cleans up and clarifies the documentation for
JAVA_LEGACY and CSHARP_LEGACY. None of these are binary subtypes,
but instead UUID representations in the Python, C#, and Java drivers.
2014-12-24 09:52:58 -08:00
A. Jesse Jiryu Davis
2ba730722b
PYTHON-526 Remove 'compile_re' option.
...
PyMongo now never attempts to compile BSON regular expressions as Python native
regular expressions.
2014-12-05 14:06:38 -05:00
A. Jesse Jiryu Davis
2c6483b348
Rely on standard json module.
...
Now that we've dropped Python 2.4 and 2.5, we know the standard json module is
available.
2014-12-03 16:32:41 -05:00
Bernie Hackett
db4ab8d769
Use _UNPACK_INT in new BSON helpers.
2014-11-24 13:30:34 -08:00
Bernie Hackett
4e20ab3ca5
Document uuid_subtype parameter for BSON.encode/decode.
2014-11-24 13:14:39 -08:00
Bernie Hackett
c28975c395
Document to uuid_subtype parameter for decoders.
2014-11-24 13:14:39 -08:00
Bernie Hackett
6fd3d3926e
Fix up docs for decode_(file_)iter.
2014-11-24 13:14:39 -08:00
Bernie Hackett
c6b9892c30
Allow decode_(file_)iter to use C extensions.
2014-11-24 13:14:39 -08:00
Bernie Hackett
6c82488b77
Add compile_re support to decode_(file_)iter.
2014-11-24 13:14:39 -08:00
Heewa Barfchin
b948b08854
Add generator versions of decode_all in bson.
...
When decoding large collections of bson documents, the python representation
of dicts are time and space costly, so it's sometimes useful to generate and
consume the documents iteratively. This patch adds two new functions to do
that: decode_iter and decode_file_iter. The first is given all the bson data,
but yields one document at a time, while the second reads from a file object
enough to yield one document at a time (to avoid reading in an entire file).
2014-11-24 13:14:39 -08:00
Bernie Hackett
5aee3e1b31
PYTHON-791 - Fix JSON support for Timestamp.
2014-11-21 14:35:48 -08:00
A. Jesse Jiryu Davis
710227237a
PYTHON-789 Clarify valid ObjectId input (3.0-dev).
2014-11-20 23:18:41 -05:00
A. Jesse Jiryu Davis
08dccbba46
Remove ancient version annotations.
...
Delete "versionchanged" and "versionadded" directives that predate 2.0.
2014-10-31 14:15:24 -04:00
A. Jesse Jiryu Davis
fd8dd020bc
PYTHON-703 Remove slow SON.__contains__ method.
...
__setitem__ must now check self.__keys to avoid setting keys twice during
"copy.copy(son_obj)".
2014-10-24 13:19:43 -04:00
Don Mitchell
b8c944f118
Allow destructive ops during son iteration
...
and let python handle (identical to iter on list)
2014-10-24 13:19:33 -04:00
Don Mitchell
4093c06726
Don't unnecessarily copy the key list
...
Conflicts:
doc/contributors.rst
test/test_son.py
2014-10-24 13:19:20 -04:00
A. Jesse Jiryu Davis
f91c3d61cb
Use with-statements to acquire locks.
...
We can use with-statements now that we've dropped support
for Python 2.4.
2014-10-02 10:07:43 -04:00
Bernie Hackett
9c8852d93f
PYTHON-760 - BSONInt64 -> Int64
2014-09-23 11:43:41 -07:00
Bernie Hackett
6595657128
PYTHON-759 - Support $date as ISO-8601 or $numberLong
2014-09-17 14:02:18 -07:00
Bernie Hackett
5c4b2499eb
PYTHON-346 - Use codecs for all string decoding/encoding.
2014-09-03 15:05:14 -07:00
Bernie Hackett
c6a1a2c384
PYTHON-346 - Type lookup and caching improvements.
2014-09-03 13:53:22 -07:00
Bernie Hackett
d3e74639f6
PYTHON-346 - Add _encode_mapping, cache subtypes.
2014-08-29 15:23:22 -07:00
Bernie Hackett
1accea6fc2
PYTHON-226 - Optimize ObjectId creation from BSON
...
This change optimizes creating an instance of ObjectId
from a 12 byte bytes instance. It gets us most of the way
to what was requested in the ticket without creating a
separate subtype just for decoding.
There are also a number of changes to clean up the module
in general and silence pylint complaints.
2014-08-28 21:07:14 -07:00
Bernie Hackett
6e2f8a2773
PYTHON-346 - Remove buffer copies.
2014-08-28 10:55:45 -07:00
Bernie Hackett
f76618d45f
Clean up an unnecessary constant definition.
2014-08-22 16:00:31 -07:00
Bernie Hackett
852b2d36f8
PYTHON-346 - Eliminate second _bson_to_dict return value
...
This has been unnecessary for many releases.
2014-08-22 15:35:56 -07:00
Bernie Hackett
e6809e8132
PYTHON-346 - Eliminate unnecessary datetime.replace call
2014-08-22 14:45:04 -07:00
Bernie Hackett
3e059f76d7
PYTHON-346 - Optimize decoding of most types.
...
This change provides perf improvements for decoding
most types in pure python. Like the previous changes
for encoding, the biggest improvements are seen decoding
BSON arrays to python lists - over 150% using pypy.
2014-08-22 11:40:49 -07:00
Bernie Hackett
adb37e2802
PYTHON-346 - Relocate _make_c_string and friends.
2014-08-21 15:34:20 -07:00
Bernie Hackett
09722a9b6b
PYTHON-346 - Cleanup style and silence a host of pylint complaints.
2014-08-20 13:21:02 -07:00
Bernie Hackett
e68fdf2b62
PYTHON-505 - Fix C extension build with VC++.
2014-08-20 13:15:26 -07:00
Bernie Hackett
74f55a283a
PYTHON-346 - Eliminate _get_int unsigned option
...
This cleans up a few pylint complaints and provides a
small perf improvement.
2014-08-20 11:30:12 -07:00
Bernie Hackett
8dc79d1b30
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.
2014-08-20 11:10:04 -07:00
Luke Lovett
17fb3a2a02
PYTHON-505 Allow C extensions to encode any mapping type, not just dicts.
2014-08-13 16:16:25 +00:00
Bernie Hackett
4aa3f9f855
PYTHON-346 - Fix DBRef encoding under jython2.7
...
Jython doesn't support struct.pack_into for bytearray.
2014-07-22 17:38:10 -07:00
Bernie Hackett
799b11f2aa
PYTHON-346 - Fix unhashable types issue in python 3.4.
2014-07-22 16:45:21 -07:00
Bernie Hackett
2d8fc71cf3
PYTHON-707 - Fix -Werror=declaration-after-statement
2014-07-22 16:35:50 -07:00
Luke Lovett
22702866c4
PYTHON-707 Update bson.son.SON's documentation in light of new BSONInt64 type.
2014-07-22 22:55:41 +00:00
Bernie Hackett
88372990d9
PYTHON-346 - Reimplement pure python BSON encoder.
...
This is the first step in rewriting the pure python BSON
module. These changes provide measurable improvements for
all types including up to a 95% improvement in encoding
performance for lists/tuples.
2014-07-22 15:42:23 -07:00
Luke Lovett
2277ee3531
PYTHON-707 Encode BSONInt64 in C extensions.
2014-07-21 17:40:37 +00:00
Luke Lovett
35c7445a67
PYTHON-708 Support $undefined and $numberLong extended JSON types.
2014-07-18 16:46:35 +00:00
Luke Lovett
5136bb723c
PYTHON-707 Add a BSONInt64 type.
2014-07-18 14:59:21 +00:00
Bernie Hackett
6e3da18114
PYTHON-525 - Cluster monitoring python 3 support.
2014-07-02 11:51:34 -07:00
A. Jesse Jiryu Davis
468bec6c32
Revert "PYTHON-710, simplify SON's equality operator."
...
This reverts commit 551e1e3edf .
The change did not work as expected in Jython.
2014-06-19 14:11:45 -04:00
A. Jesse Jiryu Davis
551e1e3edf
PYTHON-710, simplify SON's equality operator.
2014-06-18 19:09:25 -04:00
A. Jesse Jiryu Davis
4aad6bc6b8
PYTHON-710, SON.to_dict shouldn't change original data.
2014-06-18 19:09:19 -04:00
A. Jesse Jiryu Davis
504c5a9889
PYTHON-712 ObjectId.is_valid(None) should be False.
2014-06-18 17:02:07 -04:00
Bernie Hackett
10b0622bce
PYTHON-698 - Try encoding types with broken __getattr__ methods
2014-05-16 16:07:53 -07:00
Jaroslav Semančík
b362cc3454
Fixed wrong Python object name for UTC
2014-05-01 11:31:54 -07:00
Bernie Hackett
2b79325d3b
PYTHON-686 - Remove a bunch of references to 2.4 and 2.5
2014-04-24 12:40:29 -07:00
Bernie Hackett
939fe8ec70
Remove workaround for python issue7380.
...
The bug was fixed in python 3.1, which we no longer support.
2014-04-24 11:58:59 -07:00
Bernie Hackett
0a55f923c4
PYTHON-686 - Finish updating docs related to python 3.
...
Mostly removing references to 2to3, which we no longer use.
2014-04-24 10:35:20 -07:00
Bernie Hackett
b26459cd6a
Remove useless uuid module checks.
...
These were only needed for python 2.4 which does
not provide a uuid module.
2014-04-24 10:09:21 -07:00
Bernie Hackett
bd8d4a3b10
PYTHON-673 - Use bytes and remove binary_type
...
The binary_type alias was added to support python
2.4 and 2.5, which we no longer support.
2014-04-23 13:25:00 -07:00
Luke Lovett
4d6d1e067b
PYTHON-676 python 2/3 single-source for the test module
2014-04-23 18:37:02 +00:00
Luke Lovett
69ce42c5a0
PYTHON-675 python 2/3 single-source for the gridfs module
2014-04-23 18:37:02 +00:00
Luke Lovett
d494105aa4
PYTHON-674 python 2/3 single-source for the pymongo module
2014-04-23 18:26:18 +00:00
Bernie Hackett
2e4259f333
PYTHON-673 - Fix a json_util issue in python 3.x
2014-04-22 13:34:37 -07:00
Bernie Hackett
0e9f6692f1
PYTHON-673 - Add a few things back to py3compat temporarily
2014-04-22 13:14:42 -07:00
Luke Lovett
d4a94d30fd
PYTHON-673 python 2/3 single-source for the bson module
2014-04-17 21:29:15 +00:00
Bernie Hackett
f1264ccc93
Remove unused constant.
...
Silences a clang warning.
2014-03-14 09:13:46 -07:00
A. Jesse Jiryu Davis
2fa1750b07
Update copyright notices and company name.
2014-01-31 09:36:46 -05:00
Bernie Hackett
21d0bd0ff8
Fix json_util example PYTHON-602
2014-01-30 17:12:56 -08:00
Kyle Erf
e100ddcb20
PYTHON-623: do not allow sending _ids with a key starting with $
2014-01-14 12:51:37 -08:00
Bernie Hackett
f423c079d9
Fix a few documentation issues.
2014-01-14 10:06:16 -08:00
Bernie Hackett
3a197c8467
Fix GridOutCursor iteration in py3 PYTHON-310
2014-01-13 18:14:13 -08:00
A. Jesse Jiryu Davis
2f67eff07e
Note that we can't preserve key order in json_util.dumps in Python 2.4, PYTHON-602.
2013-12-14 12:33:46 -05:00
A. Jesse Jiryu Davis
c672b8c3cb
Python 3 compatibility when json-encoding regexes, PYTHON-602.
2013-12-14 12:33:37 -05:00
A. Jesse Jiryu Davis
ca53fee347
Simplify json_util.default
2013-12-13 18:21:26 -05:00
A. Jesse Jiryu Davis
51deead4ff
Preserve order in json_util.dumps, PYTHON-602.
2013-12-13 18:21:26 -05:00
A. Jesse Jiryu Davis
4b5ba70724
Support new bson.regex.Regex instances in json_util.dumps, PYTHON-500.
2013-12-13 18:21:26 -05:00
A. Jesse Jiryu Davis
07c4b0b048
Note Python 3’s re.UNICODE behavior, and fix test_regex_from_native for Python 3.
2013-12-08 22:26:15 -05:00
A. Jesse Jiryu Davis
ebbabe8f6d
Markup in docstring, PYTHON-500.
2013-12-07 15:41:38 -05:00
A. Jesse Jiryu Davis
d625ff2bc9
Rename Regex.compile() to try_compile() and add a warning, add from_native(), PYTHON-500.
2013-12-07 15:37:12 -05:00
A. Jesse Jiryu Davis
489f941d44
Implement rich comparison for Timestamps, PYTHON-609.
2013-12-06 13:39:54 -05:00
A. Jesse Jiryu Davis
c972894953
Implement rich comparison operators for MinKey and MaxKey, PYTHON-604.
2013-12-04 20:38:23 -05:00
Bernie Hackett
b2d1034989
Use commands for write operations PYTHON-554
2013-11-25 18:21:04 -08:00
Bernie Hackett
2371f32894
Clean up str/bytes/unicode encoding in C.
...
Minor perf improvements included.
2013-11-18 14:54:10 -08:00
A. Jesse Jiryu Davis
caacb76131
Python 3 compatibility. PYTHON-494
2013-10-21 21:38:49 -04:00
A. Jesse Jiryu Davis
72a90b75c6
Wrap all BSON-decoding errors in InvalidBSON exception. PYTHON-494
2013-10-21 20:41:13 -04:00
A. Jesse Jiryu Davis
eec82f782b
Default compile_re to True in _cbson_decode_all. PYTHON-500
2013-10-21 20:41:13 -04:00
A. Jesse Jiryu Davis
cb4706f13e
Remove unused variable in _cbsonmodule.c
2013-10-20 20:59:19 -04:00
A. Jesse Jiryu Davis
e4cf504559
Option to not compile BSON regexes. PYTHON-500
...
Add a 'compile_re' parameter to Collection.find, Collection.find_one, and
json_util.loads. If it's False, regular expressions are encoded as a new class,
Regex, instead of passed to re.compile(). This allows PyMongo to handle regular
expressions that don't compile in Python but are valid in other contexts like
MongoDB queries.
2013-10-20 17:18:32 -04:00
Bernie Hackett
989a0f4f4d
Avoid unsigned overflow wrapping PYTHON-571
2013-10-15 17:25:16 -07:00
Bernie Hackett
2b1ea1fdeb
Fix _cbson DBPointer decoding in py3 PYTHON-586
2013-10-15 16:58:08 -07:00
Bernie Hackett
ef251aefb1
Fix some _cbson decoder issues on armel PYTHON-313
2013-10-15 11:37:13 -07:00
Bernie Hackett
37c09bcae8
Fix signed / unsigned comparison warnings
2013-10-08 18:07:43 -07:00
Bernie Hackett
ce59de1acc
Fix length check in python 3 PYTHON-571
2013-10-08 14:34:27 -07:00
behackett
ab4d63b658
Better handling of corrupt/invalid BSON PYTHON-571
2013-10-08 13:41:32 -07:00
behackett
033a7f1270
Fix json_util doctests.
2013-10-01 19:35:02 -07:00
A. Jesse Jiryu Davis
1338050380
Use PyInterpreterState_Next instead of interp->next.
2013-09-27 11:17:44 -04:00
behackett
2483775f0b
Silence C extension RuntimeWarning PYTHON-569
...
When encoding a document in C while running in a python sub interpreter
(e.g. mod_wsgi spawning sub interpreters) PyMongo would often have
to reload its cache of pure python types - ObjectId, Timestamp,
UUID, etc. - raising RuntimeWarning in the process. The reason this was
necessary is described in the mod_wsgi documentation here:
https://code.google.com/p/modwsgi/wiki/ApplicationIssues#Multiple_Python_Sub_Interpreters
With workarounds documented here:
http://api.mongodb.org/python/2.6.2/faq.html#does-pymongo-work-with-mod-wsgi
With this commit PyMongo will no longer use cached pure python types
when running in a sub interpreter. Instead it will look up pure python
types as needed (primarily when decoding BSON). This eliminates the
problem described in the mod_wsgi docs and eliminates the need for the
Runtime warning.
2013-09-16 17:24:37 -04:00
behackett
f47f8d69d0
Fix json_util example rendering.
2013-08-23 15:04:57 -07:00
A. Jesse Jiryu Davis
d133396162
Revert "Capture all BSON decode errors and wrap with InvalidBSON. PYTHON-494"
...
This reverts commit ba66a2dde7 .
2013-08-17 22:35:17 -04:00
Rock Li
5b7266d25b
INT2STRING to use Stack based solution
2013-08-16 09:52:28 -07:00
A. Jesse Jiryu Davis
a6f2848787
Fix ref undercount in BSON extension. PYTHON-494
2013-08-14 23:28:19 -04:00
A. Jesse Jiryu Davis
c57364621a
Work around a 2to3 bug more simply. PYTHON-494
2013-08-14 15:20:46 -04:00
A. Jesse Jiryu Davis
3d63d5884f
Work around a 2to3 bug more simply. PYTHON-494
2013-08-14 14:58:46 -04:00
A. Jesse Jiryu Davis
d863ccf458
Work around a 2to3 bug. PYTHON-494
2013-08-14 14:07:31 -04:00
A. Jesse Jiryu Davis
ba66a2dde7
Capture all BSON decode errors and wrap with InvalidBSON. PYTHON-494
2013-08-14 11:50:36 -04:00
behackett
3afd684224
Automatically split batch inserts PYTHON-414
...
With this change PyMongo will automatically
split large batch inserts into multiple messages
based on client.max_message_size (the largest
message mongod/s will accept).
2013-08-13 10:53:02 -07:00
behackett
bd3c23dd9d
Fix issues found by cpychecker.
2013-06-25 16:09:44 -07:00
behackett
013eb41036
Really fix the bug Coverity found earlier...
2013-06-24 18:59:06 -07:00
behackett
80b8cfeff0
Fix compiler warnings from Visual Studio.
2013-06-24 14:52:34 -07:00
Bernie Hackett
5e94a9257a
Fix llvm-gcc warnings.
...
This also corrects a previous change that
caused problems on python 2.4 and 32 bit systems.
2013-06-21 14:40:14 -07:00
Bernie Hackett
5113c7f111
Fix a bug Coverity found.
2013-06-11 14:51:34 -07:00
behackett
4e7ad0c564
Further C extension cleanup.
2013-06-11 13:46:48 -07:00
behackett
6c52ca3958
Fix clang warnings.
...
This fixes all compiler warnings under clang.
The major change is safely downcasting from
Py_ssize_t to int (BSON string lengths and document
size are signed int32). This change also includes
some code cleanup in the functions touched to fix
compiler warnings.
2013-06-09 14:10:10 -07:00
A. Jesse Jiryu Davis
9103755d06
Better error message when C extension raises InvalidStringData, PYTHON-533
2013-06-06 13:33:48 -05:00
behackett
43cda4470f
Clean up InvalidDocument/StringData handling.
2013-06-05 12:50:40 -07:00
behackett
517aec303c
Fix up REType reload.
2013-06-04 13:50:03 -07:00
behackett
0616907ea8
Fix parameter hiding.
2013-06-03 17:26:49 -07:00
behackett
49ab3cb206
Further DBRef cleanup.
2013-06-03 17:13:32 -07:00
A. Jesse Jiryu Davis
842e675299
Fix null pointer when decoding invalid DBRef PYTHON-532
2013-06-03 15:51:43 -07:00
Jorge Puente Sarrín
e1d71e8770
Minor typo on bson/json_util docstring
2013-05-12 23:35:19 -05:00
behackett
cd1589eaba
Mark RE_OPT_TABLE private.
2013-04-25 12:39:50 -07:00
behackett
176e39e74a
Fix misc. $options issues in json_util PYTHON-510
2013-04-24 18:27:38 -07:00
Bernie Hackett
c8f6d4aa03
ObjectId.__str__ should return str in 2.x.
...
This addresses the issue raised in pull request
155.
2013-02-09 13:13:45 -08:00
Ross Lawley
828aad3aad
Ensure deepcopy clones using the correct type - PYTHON-459
2013-01-08 09:53:39 +00:00
Bernie Hackett
168fdc61cd
Fix accuracy issues in datetime decoding PYTHON-392
2012-12-14 13:21:32 -08:00
Ross Lawley
a31cac0889
json_util fix format for binary type PYTHON-443
2012-12-05 16:23:33 +00:00
Bernie Hackett
7c67e5b7f4
Work around Jython dict equality issue PYTHON-441
...
See http://bugs.jython.org/issue1728
2012-11-23 10:00:53 -08:00
Ross Lawley
d2840d0d7a
SON equality fix PYTHON-441
...
Comparison to another SON is order-sensitive while comparison to a
regular dictionary is order-insensitive
2012-11-23 13:52:05 +00:00
Ross Lawley
29b9de45db
Added __ne__ for DBRefs PYTHON-440
2012-11-22 11:12:36 +00:00
Bernie Hackett
f812d1babb
Support copy of UUIDLegacy
2012-11-19 06:27:59 -08:00
Ross Lawley
d1dc11242e
Recurse when dumping DBRefs PYTHON-433
2012-11-09 08:56:23 +00:00
behackett
001d72b245
Support non-ascii hostnames in ObjectId PYTHON-430
2012-11-08 12:44:21 -08:00
Ross Lawley
a36b836cbd
Clone needs to handle regular expressions as well PYTHON-421
2012-11-08 09:08:24 +00:00
Bernie Hackett
ae3a534dfb
Fix pickling of Binary with Python 3.1 PYTHON-422
...
This works around http://bugs.python.org/issue7382
2012-10-25 09:43:14 -07:00
behackett
ef56eb12ef
Stop even more leaks when BSON decoding fails.
2012-10-12 17:52:39 -07:00
Bernie Hackett
90459a564c
Don't leak if decode_all fails.
2012-10-11 09:42:51 -07:00
Bernie Hackett
576f1638fd
Don't leak when BSON decoding fails.
2012-10-11 06:21:16 -07:00
behackett
dfaadd53e8
Doc updates for PyMongo 2.3
2012-08-16 15:52:14 -07:00
behackett
340efb9c01
MS VC++ compatibility PYTHON-387
2012-08-15 12:39:51 -07:00
behackett
638bb7fbdc
Support Java and C# UUID byte order PYTHON-387
2012-08-15 12:10:26 -07:00
behackett
d79c438d5d
Work around OSX 10.8 Python 2.5 bug PYTHON-389
...
See PYTHON-389 for more details.
2012-08-09 16:17:54 -07:00
behackett
036a3b1d00
Remove errant space.
2012-08-03 15:14:01 -07:00
behackett
c188836d64
Fallback to StringIO if cStringIO doesn't exist.
2012-08-03 14:28:53 -07:00
behackett
42028cb663
Minor doc updates and changelog for 2.3.
2012-07-31 15:29:21 -07:00
Ross Lawley
6db4dcac88
Merge branch 'PYTHON-360'
2012-07-24 09:47:52 +01:00
Bernie Hackett
a66304f7a2
Fix BSON size validation PYTHON-370
2012-07-23 08:11:03 -07:00
Bernie Hackett
8ef1bd5daf
Make C and Python _dict_to_bson consistent PYTHON-380
2012-07-23 07:37:04 -07:00
Ross Lawley
8367d49553
Added json helpers for Binary and Code types PYTHON-362
2012-07-18 10:44:34 +01:00
Ross Lawley
f2ea613400
Added is_valid classmethod to ObjectId
...
Refs PYTHON-360
2012-07-10 16:09:01 +01:00
Glenn Maynard
4ecbd22c19
Initialize ObjectId._inc to a random value.
...
This is required to prevent collisions on very large clusters. See
https://groups.google.com/forum/?fromgroups#!topic/mongodb-user/ajgO9wUxbos
for details. Other drivers also initialize this field to a random value.
2012-06-15 10:21:34 -07:00
Bernie Hackett
f4ec4be807
Avoid encoding errors with pickle.loads PYTHON-355.
...
This works around issues caused by applications that
use sys.setdefaultencoding to set an interpreter-wide
encoding other than ascii or utf8. This is only an
issue in python 2.x. In python 3.0 and 3.1
setdefaultencoding is a noop. It was completely
removed in python 3.2.
2012-05-30 09:56:03 -07:00
behackett
83745027f2
Fix compiler warnings on Windows.
...
These are no longer needed due to a previous change.
2012-04-20 12:51:09 -07:00
behackett
0ee7170cc2
It's 2012...
2012-04-19 12:40:38 -07:00
Chris Tompkinson
80e59ddd15
Add __ne__ method to bson/objectid.py
2012-04-12 15:12:47 +01:00
Bernie Hackett
640fca20c7
Change overlooked __cmp__ to __eq__ in son.SON.
2012-03-30 22:56:32 -07:00
A. Jesse Jiryu Davis
6aebf117f4
Fix bug serializing code objects w/ scope
2012-03-30 16:29:57 -04:00
behackett
27d5fe3331
Fix Windows build issues.
2012-03-29 15:29:09 -07:00
Bernie Hackett
9d463d2a4b
Minor: style.
2012-03-27 11:29:20 -07:00
Bernie Hackett
a09f880254
Python 3 - further C extension changes PYTHON-84
2012-03-23 20:12:59 -07:00
Bernie Hackett
ae58ae670e
Python 3 C extension changes PYTHON-84.
2012-03-23 12:53:56 -07:00
behackett
6b8786eb85
More bson module doc updates for python 3.
2012-03-21 17:22:36 -07:00
behackett
6bd0238629
ObjectId rich comparison operators and doc updates.
2012-03-21 15:39:07 -07:00
behackett
8cde67c330
Update bson module docs and comments for python 3.
2012-03-21 15:37:31 -07:00
behackett
7474f5cde8
Python 3 bson changes PYTHON-84
2012-03-20 13:56:15 -07:00
Bernie Hackett
2528e7d259
Attempt to fix code.Code encoding issue.
2012-02-13 21:10:25 -08:00
behackett
359ee6b3f1
Remove asctime64_r (and related) PYTHON-327
...
It's use of sprintf sets off security scanners.
We could have used snprintf instead following
glibc's implementation of asctime_r but we don't
actually use any of these functions in PyMongo so
seems easier and less contentious to just remove
them.
2012-02-10 12:28:04 -08:00
Ross Lawley
c67674bfa4
Removed deprecated methods
...
PYTHON-305
2012-02-08 15:58:09 -08:00
behackett
0c560a5cc4
Fix a few doc test failures.
2012-02-08 15:30:44 -08:00
Wouter Bolsterlee
0c78e29e08
Use _use_c variable in bson.has_c() function
...
Don't needlessly retry to import _cbson each time the (public)
bson.has_c() function is called. The internal _use_c variable
that is set when the module is loaded already contains the
needed information.
2012-02-08 15:17:11 -08:00
Wouter Bolsterlee
bfbe701998
Don't overwrite built-in id() function in example
2012-02-08 15:17:11 -08:00
behackett
4f579e6f92
Minor style fix.
2012-02-08 15:04:37 -08:00
Ross Lawley
486c3ce24a
PYTHON-318 - Fix for SON pickling protocol 2
...
Updated tests to check protocol pickling as well
2012-02-08 14:59:33 -08:00
Ross Lawley
271767f5b3
Can now store type 13 - JS without scope
...
Changes the default behaviour of bson.Code as now if
not passing scope it will convert to type 13 not 15.
2012-02-08 14:35:49 -08:00
Bernie Hackett
1bb91c49d5
Always default to OLD_UUID_SUBTYPE PYTHON-303
2011-12-23 15:58:41 -08:00
Ross Lawley
ea6ce59b94
Revert "Ensures UTC stays a singleton"
...
This reverts commit 088f6b6b57 .
2011-12-20 10:48:47 -08:00
Ross Lawley
72ef275f0b
Revert "Mark as safe for unpickling"
...
This reverts commit c5e41d6db5 .
2011-12-20 10:48:47 -08:00
Ross Lawley
716c7c8d46
Mark as safe for unpickling
2011-12-20 10:48:47 -08:00
Ross Lawley
aadd9e4eb4
Ensures UTC stays a singleton
2011-12-20 10:48:47 -08:00
Ross Lawley
8c68bde1f8
FixedOffset objects can now be copied / pickled
...
Defined __getinitargs__ so FixedOffset objects can
be copied / pickled.
2011-12-20 10:48:47 -08:00
Bernie Hackett
f3d8b86a26
Minor doc updates.
2011-12-17 18:29:59 -08:00
behackett
eb5959ee95
Default to Binary subtype 3 for UUIDs PYTHON-267
2011-12-06 11:58:43 -08:00
behackett
3c85a98edb
Support per-collection UUID subtype PYTHON-267
2011-11-10 18:53:08 -08:00
behackett
ff5de2c380
Work around a datetime bug in PyPy-1.5.
2011-09-19 15:32:04 -07:00
behackett
8bdb7821a9
Always decode to UUID PYTHON-267
2011-09-14 15:11:58 -07:00