diff --git a/docs/changelog.rst b/docs/changelog.rst index 222fee63..157ed902 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -139,12 +139,25 @@ Fixes 0.2.3 behaviour of defaulting to Kqueue in this case, but still prefer :func:`select.poll` if it is available. +* `#545 `_: an optimization + introduced in `#493 `_ caused a + 64-bit integer to be assigned to a 32-bit field on ARM 32-bit targets, + causing runs to fail. + + +Core Library +~~~~~~~~~~~~ + +* `ca63c26e `_: + :meth:`mitogen.core.Latch.put`'s `obj` argument was made optional. + Thanks! ~~~~~~~ Mitogen would not be possible without the support of users. A huge thanks for bug reports, testing, features and fixes in this release contributed by +`Fabian Arrotin `_, and `Petr Enkov `_. diff --git a/docs/conf.py b/docs/conf.py index 3708a943..a6bc2cbc 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -6,7 +6,7 @@ import mitogen VERSION = '%s.%s.%s' % mitogen.__version__ author = u'David Wilson' -copyright = u'2018, David Wilson' +copyright = u'2019, David Wilson' exclude_patterns = ['_build'] extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinxcontrib.programoutput'] html_show_sourcelink = False diff --git a/mitogen/core.py b/mitogen/core.py index cfdf996b..25732896 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -2140,7 +2140,7 @@ class Latch(object): return rsock, wsock COOKIE_MAGIC, = struct.unpack('L', b('LTCH') * (struct.calcsize('L')//4)) - COOKIE_FMT = 'Llll' + COOKIE_FMT = '>Qqqq' # #545: id() and get_ident() may exceed long on armhfp. COOKIE_SIZE = struct.calcsize(COOKIE_FMT) def _make_cookie(self): @@ -2240,11 +2240,14 @@ class Latch(object): finally: self._lock.release() - def put(self, obj): + def put(self, obj=None): """ Enqueue an object, waking the first thread waiting for a result, if one exists. + :param obj: + Object to enqueue. Defaults to :data:`None` as a convenience when + using :class:`Latch` only for synchronization. :raises mitogen.core.LatchError: :meth:`close` has been called, and the object is no longer valid. """ diff --git a/tests/bench/throughput.py b/tests/bench/throughput.py index 896ee9ac..42604826 100644 --- a/tests/bench/throughput.py +++ b/tests/bench/throughput.py @@ -9,6 +9,7 @@ import time import mitogen import mitogen.service +import ansible_mitogen.affinity def prepare(): @@ -45,6 +46,8 @@ def run_test(router, fp, s, context): @mitogen.main() def main(router): + ansible_mitogen.affinity.policy.assign_muxprocess() + bigfile = tempfile.NamedTemporaryFile() fill_with_random(bigfile, 1048576*512) diff --git a/tests/serialization_test.py b/tests/serialization_test.py index 23c4a2d9..6cf5f8b7 100644 --- a/tests/serialization_test.py +++ b/tests/serialization_test.py @@ -8,11 +8,23 @@ from mitogen.core import b import testlib +class EvilObject(object): + pass + + def roundtrip(v): msg = mitogen.core.Message.pickled(v) return mitogen.core.Message(data=msg.data).unpickle() +class EvilObjectTest(testlib.TestCase): + def test_deserialization_fails(self): + msg = mitogen.core.Message.pickled(EvilObject()) + e = self.assertRaises(mitogen.core.StreamError, + lambda: msg.unpickle() + ) + + class BlobTest(testlib.TestCase): klass = mitogen.core.Blob