Hello community, here is the log from the commit of package python3-pymongo for openSUSE:Factory checked in at 2015-11-23 07:30:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python3-pymongo (Old) and /work/SRC/openSUSE:Factory/.python3-pymongo.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python3-pymongo" Changes: -------- --- /work/SRC/openSUSE:Factory/python3-pymongo/python3-pymongo.changes 2015-11-04 15:34:21.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.python3-pymongo.new/python3-pymongo.changes 2015-11-23 07:30:15.000000000 +0100 @@ -1,0 +2,8 @@ +Sun Nov 22 00:41:47 UTC 2015 - [email protected] + +- update to version 3.1.1: + * Version 3.1.1 fixes a few issues reported since the release of + 3.1, including a regression in error handling for oversize command + documents and interrupt handling issues in the C extensions. + +------------------------------------------------------------------- Old: ---- pymongo-3.1.tar.gz New: ---- pymongo-3.1.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python3-pymongo.spec ++++++ --- /var/tmp/diff_new_pack.Llaf3n/_old 2015-11-23 07:30:16.000000000 +0100 +++ /var/tmp/diff_new_pack.Llaf3n/_new 2015-11-23 07:30:16.000000000 +0100 @@ -17,7 +17,7 @@ Name: python3-pymongo -Version: 3.1 +Version: 3.1.1 Release: 0 Url: http://github.com/mongodb/mongo-python-driver Summary: Python driver for MongoDB ++++++ pymongo-3.1.tar.gz -> pymongo-3.1.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymongo-3.1/PKG-INFO new/pymongo-3.1.1/PKG-INFO --- old/pymongo-3.1/PKG-INFO 2015-11-03 00:02:08.000000000 +0100 +++ new/pymongo-3.1.1/PKG-INFO 2015-11-18 01:41:24.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pymongo -Version: 3.1 +Version: 3.1.1 Summary: Python driver for MongoDB <http://www.mongodb.org> Home-page: http://github.com/mongodb/mongo-python-driver Author: Bernie Hackett @@ -199,6 +199,7 @@ Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Database diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymongo-3.1/bson/_cbsonmodule.c new/pymongo-3.1.1/bson/_cbsonmodule.c --- old/pymongo-3.1/bson/_cbsonmodule.c 2015-10-20 19:44:05.000000000 +0200 +++ new/pymongo-3.1.1/bson/_cbsonmodule.c 2015-11-18 01:29:59.000000000 +0100 @@ -1485,6 +1485,9 @@ Py_DECREF(value); } Py_DECREF(iter); + if (PyErr_Occurred()) { + return 0; + } /* write null byte and fill in length */ if (!buffer_write_bytes(buffer, &zero, 1)) { @@ -2245,27 +2248,31 @@ * Calling _error clears the error state, so fetch it first. */ PyErr_Fetch(&etype, &evalue, &etrace); - InvalidBSON = _error("InvalidBSON"); - if (InvalidBSON) { - if (!PyErr_GivenExceptionMatches(etype, InvalidBSON)) { - /* - * Raise InvalidBSON(str(e)). - */ - Py_DECREF(etype); - etype = InvalidBSON; - if (evalue) { - PyObject *msg = PyObject_Str(evalue); - Py_DECREF(evalue); - evalue = msg; + /* Dont reraise anything but PyExc_Exceptions as InvalidBSON. */ + if (PyErr_GivenExceptionMatches(etype, PyExc_Exception)) { + InvalidBSON = _error("InvalidBSON"); + if (InvalidBSON) { + if (!PyErr_GivenExceptionMatches(etype, InvalidBSON)) { + /* + * Raise InvalidBSON(str(e)). + */ + Py_DECREF(etype); + etype = InvalidBSON; + + if (evalue) { + PyObject *msg = PyObject_Str(evalue); + Py_DECREF(evalue); + evalue = msg; + } + PyErr_NormalizeException(&etype, &evalue, &etrace); + } else { + /* + * The current exception matches InvalidBSON, so we don't + * need this reference after all. + */ + Py_DECREF(InvalidBSON); } - PyErr_NormalizeException(&etype, &evalue, &etrace); - } else { - /* - * The current exception matches InvalidBSON, so we don't need - * this reference after all. - */ - Py_DECREF(InvalidBSON); } } /* Steals references to args. */ @@ -2313,17 +2320,19 @@ PyObject *InvalidBSON; PyErr_Fetch(&etype, &evalue, &etrace); - InvalidBSON = _error("InvalidBSON"); - if (InvalidBSON) { - Py_DECREF(etype); - etype = InvalidBSON; - - if (evalue) { - PyObject *msg = PyObject_Str(evalue); - Py_DECREF(evalue); - evalue = msg; + if (PyErr_GivenExceptionMatches(etype, PyExc_Exception)) { + InvalidBSON = _error("InvalidBSON"); + if (InvalidBSON) { + Py_DECREF(etype); + etype = InvalidBSON; + + if (evalue) { + PyObject *msg = PyObject_Str(evalue); + Py_DECREF(evalue); + evalue = msg; + } + PyErr_NormalizeException(&etype, &evalue, &etrace); } - PyErr_NormalizeException(&etype, &evalue, &etrace); } PyErr_Restore(etype, evalue, etrace); Py_DECREF(dict); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymongo-3.1/doc/changelog.rst new/pymongo-3.1.1/doc/changelog.rst --- old/pymongo-3.1/doc/changelog.rst 2015-10-20 19:44:05.000000000 +0200 +++ new/pymongo-3.1.1/doc/changelog.rst 2015-11-18 01:29:59.000000000 +0100 @@ -1,6 +1,21 @@ Changelog ========= +Changes in Version 3.1.1 +------------------------ + +Version 3.1.1 fixes a few issues reported since the release of 3.1, including a +regression in error handling for oversize command documents and interrupt +handling issues in the C extensions. + +Issues Resolved +............... + +See the `PyMongo 3.1.1 release notes in JIRA`_ for the list of resolved issues +in this release. + +.. _PyMongo 3.1.1 release notes in JIRA: https://jira.mongodb.org/browse/PYTHON/fixforversion/16211 + Changes in Version 3.1 ---------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymongo-3.1/pymongo/__init__.py new/pymongo-3.1.1/pymongo/__init__.py --- old/pymongo-3.1/pymongo/__init__.py 2015-11-02 22:18:00.000000000 +0100 +++ new/pymongo-3.1.1/pymongo/__init__.py 2015-11-18 01:30:39.000000000 +0100 @@ -70,7 +70,7 @@ ALL = 2 """Profile all operations.""" -version_tuple = (3, 1) +version_tuple = (3, 1, 1) def get_version_string(): if isinstance(version_tuple[-1], str): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymongo-3.1/pymongo/message.py new/pymongo-3.1.1/pymongo/message.py --- old/pymongo-3.1/pymongo/message.py 2015-10-30 21:15:13.000000000 +0100 +++ new/pymongo-3.1.1/pymongo/message.py 2015-11-18 01:29:59.000000000 +0100 @@ -40,6 +40,9 @@ MAX_INT32 = 2147483647 MIN_INT32 = -2147483648 +# Overhead allowed for encoded command documents. +_COMMAND_OVERHEAD = 16382 + _INSERT = 0 _UPDATE = 1 _DELETE = 2 @@ -553,6 +556,19 @@ request_id, self.sock_info.address, self.op_id) +def _raise_document_too_large(operation, doc_size, max_size): + """Internal helper for raising DocumentTooLarge.""" + if operation == "insert": + raise DocumentTooLarge("BSON document too large (%d bytes)" + " - the connected server supports" + " BSON document sizes up to %d" + " bytes." % (doc_size, max_size)) + else: + # There's nothing intelligent we can say + # about size for update and remove + raise DocumentTooLarge("command document too large") + + def _do_batched_insert(collection_name, docs, check_keys, safe, last_error_args, continue_on_error, opts, ctx): @@ -608,11 +624,8 @@ raise if too_large: - raise DocumentTooLarge("BSON document too large (%d bytes)" - " - the connected server supports" - " BSON document sizes up to %d" - " bytes." % - (encoded_length, ctx.max_bson_size)) + _raise_document_too_large( + "insert", encoded_length, ctx.max_bson_size) message_length = begin_loc + encoded_length data.seek(begin_loc) @@ -641,7 +654,7 @@ max_write_batch_size = ctx.max_write_batch_size # Max BSON object size + 16k - 2 bytes for ending NUL bytes. # Server guarantees there is enough room: SERVER-10643. - max_cmd_size = max_bson_size + 16382 + max_cmd_size = max_bson_size + _COMMAND_OVERHEAD ordered = command.get('ordered', True) @@ -715,15 +728,9 @@ enough_documents = (idx >= max_write_batch_size) if enough_data or enough_documents: if not idx: - if operation == _INSERT: - raise DocumentTooLarge("BSON document too large (%d bytes)" - " - the connected server supports" - " BSON document sizes up to %d" - " bytes." % (len(value), - max_bson_size)) - # There's nothing intelligent we can say - # about size for update and remove - raise DocumentTooLarge("command document too large") + write_op = "insert" if operation == _INSERT else None + _raise_document_too_large( + write_op, len(value), max_bson_size) result = send_message() results.append((idx_offset, result)) if ordered and "writeErrors" in result: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymongo-3.1/pymongo/network.py new/pymongo-3.1.1/pymongo/network.py --- old/pymongo-3.1/pymongo/network.py 2015-10-30 21:15:13.000000000 +0100 +++ new/pymongo-3.1.1/pymongo/network.py 2015-11-18 01:29:59.000000000 +0100 @@ -38,7 +38,7 @@ def command(sock, dbname, spec, slave_ok, is_mongos, read_preference, codec_options, check=True, allowable_errors=None, address=None, - check_keys=False, listeners=None): + check_keys=False, listeners=None, max_bson_size=None): """Execute a command over the socket, or raise socket.error. :Parameters: @@ -54,6 +54,7 @@ - `address`: the (host, port) of `sock` - `check_keys`: if True, check `spec` for invalid keys - `listeners`: An instance of :class:`~pymongo.monitoring.EventListeners` + - `max_bson_size`: The maximum encoded bson size for this server """ name = next(iter(spec)) ns = dbname + '.$cmd' @@ -67,8 +68,13 @@ if publish: start = datetime.datetime.now() - request_id, msg, _ = message.query(flags, ns, 0, -1, spec, - None, codec_options, check_keys) + request_id, msg, size = message.query(flags, ns, 0, -1, spec, + None, codec_options, check_keys) + + if (max_bson_size is not None + and size > max_bson_size + message._COMMAND_OVERHEAD): + message._raise_document_too_large( + name, size, max_bson_size + message._COMMAND_OVERHEAD) if publish: encoding_duration = datetime.datetime.now() - start diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymongo-3.1/pymongo/pool.py new/pymongo-3.1.1/pymongo/pool.py --- old/pymongo-3.1/pymongo/pool.py 2015-10-30 21:15:13.000000000 +0100 +++ new/pymongo-3.1.1/pymongo/pool.py 2015-11-18 01:29:59.000000000 +0100 @@ -198,7 +198,7 @@ return command(self.sock, dbname, spec, slave_ok, self.is_mongos, read_preference, codec_options, check, allowable_errors, self.address, - check_keys, self.listeners) + check_keys, self.listeners, self.max_bson_size) except OperationFailure: raise # Catch socket.error, KeyboardInterrupt, etc. and close ourselves. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymongo-3.1/pymongo.egg-info/PKG-INFO new/pymongo-3.1.1/pymongo.egg-info/PKG-INFO --- old/pymongo-3.1/pymongo.egg-info/PKG-INFO 2015-11-03 00:02:07.000000000 +0100 +++ new/pymongo-3.1.1/pymongo.egg-info/PKG-INFO 2015-11-18 01:41:24.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pymongo -Version: 3.1 +Version: 3.1.1 Summary: Python driver for MongoDB <http://www.mongodb.org> Home-page: http://github.com/mongodb/mongo-python-driver Author: Bernie Hackett @@ -199,6 +199,7 @@ Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Database diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymongo-3.1/setup.py new/pymongo-3.1.1/setup.py --- old/pymongo-3.1/setup.py 2015-11-02 22:17:47.000000000 +0100 +++ new/pymongo-3.1.1/setup.py 2015-11-18 01:30:24.000000000 +0100 @@ -26,7 +26,7 @@ from distutils.errors import DistutilsPlatformError, DistutilsExecError from distutils.core import Extension -version = "3.1" +version = "3.1.1" f = open("README.rst") try: @@ -299,6 +299,7 @@ "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Database"], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymongo-3.1/test/test_collection.py new/pymongo-3.1.1/test/test_collection.py --- old/pymongo-3.1/test/test_collection.py 2015-10-30 21:15:13.000000000 +0100 +++ new/pymongo-3.1.1/test/test_collection.py 2015-11-18 01:29:59.000000000 +0100 @@ -35,11 +35,13 @@ from pymongo.collection import Collection, ReturnDocument from pymongo.command_cursor import CommandCursor from pymongo.cursor import CursorType -from pymongo.errors import (DuplicateKeyError, +from pymongo.errors import (DocumentTooLarge, + DuplicateKeyError, InvalidDocument, InvalidName, InvalidOperation, OperationFailure) +from pymongo.message import _COMMAND_OVERHEAD from pymongo.operations import IndexModel from pymongo.read_preferences import ReadPreference from pymongo.results import (InsertOneResult, @@ -659,6 +661,17 @@ self.assertFalse(result.acknowledged) wait_until(lambda: 0 == db.test.count(), 'delete 2 documents') + def test_command_document_too_large(self): + large = '*' * (self.client.max_bson_size + _COMMAND_OVERHEAD) + coll = self.db.test + self.assertRaises( + DocumentTooLarge, coll.insert_one, {'data': large}) + # update_one and update_many are the same + self.assertRaises( + DocumentTooLarge, coll.replace_one, {}, {'data': large}) + self.assertRaises( + DocumentTooLarge, coll.delete_one, {'data': large}) + def test_find_by_default_dct(self): db = self.db db.test.insert_one({'foo': 'bar'})
