Merge remote-tracking branch 'origin/dmw'

* origin/dmw:
  core: increase cookie field lengths to 64-bit; closes #545.
  tests: ensure serialization restrictions are in effect
  tests/bench: set process affinity in throughput.py.
  docs: update copyright year.
  docs: update Changelog.
  core: Make Latch.put(obj=) optional.
pull/564/head
David Wilson 7 years ago
commit 1397c0eec3

@ -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 <https://github.com/dw/mitogen/issues/545>`_: an optimization
introduced in `#493 <https://github.com/dw/mitogen/issues/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 <https://github.com/dw/mitogen/commit/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 <https://github.com/arrfab>`_, and
`Petr Enkov <https://github.com/enkov>`_.

@ -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

@ -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.
"""

@ -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)

@ -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

Loading…
Cancel
Save