[Utils] Remove deprecated PyZMQ call from Python ZMQ example #12588

pull kosciej wants to merge 1 commits into bitcoin:master from kosciej:zmq_example_fix changing 2 files +2 −2
  1. kosciej commented at 5:21 am on March 3, 2018: contributor

    PyZMQ 17.0.0 has deprecated and removed zmq.asyncio.install() call with advice to use asyncio native run-loop instead of zmq specific.

    This caused exception when running the contrib/zmq/zmq_sub*.py examples.

    This commit simply follows the advice and fixes mentioned examples.

  2. Remove deprecated PyZMQ call from Python ZMQ example
    PyZMQ 17.0.0 has deprecated and removed zmq.asyncio.install() call
    with advice to use asyncio native run-loop instead of zmq specific.
    
    This caused exception when running the contrib/zmq/zmq_sub*.py examples.
    
    This commit simply follows the advice.
    6058766de4
  3. kosciej renamed this:
    Remove deprecated PyZMQ call from Python ZMQ example
    [Utils] Remove deprecated PyZMQ call from Python ZMQ example
    on Mar 3, 2018
  4. fanquake added the label Scripts and tools on Mar 3, 2018
  5. randolf commented at 5:41 am on March 4, 2018: contributor
    @kosciej I tried to find documentation describing this change, but Google didn’t quite get me there. Do you happen to have a link to the documentation that describes this change? Thanks.
  6. kosciej commented at 9:19 am on March 4, 2018: contributor

    @randolf Changelog for PyZMQ 17.0.0 describes this change in poor wording:

    Allow pyzmq asyncio/tornado integration to run without installing zmq_poll() implementation. The following methods and classes are deprecated and no longer required:

    0zmq.eventloop.ioloop.install()
    1zmq.eventloop.ioloop.IOLoop
    2zmq.asyncio.install()
    3zmq.asyncio.ZMQEventLoop
    

    However, in the code of PyZMQ 17 the call to zmq.asyncio.install() is not only deprecated but also returns None:

     0def _deprecated():
     1    if _deprecated.called:
     2        return
     3    _deprecated.called = True
     4    import warnings
     5    warnings.warn("ZMQEventLoop and zmq.asyncio.install are deprecated in pyzmq 17. Special eventloop integration is no longer needed.", DeprecationWarning, stacklevel=3)
     6_deprecated.called = False
     7
     8
     9def install():
    10    """DEPRECATED: No longer needed in pyzmq 17"""
    11    _deprecated()
    

    Even the documentation of PyZMQ no longer mentions zmq.asyncio.install() method.

    This makes the example unusable in most recent version of PyZMQ.

    I can add the condition for newest PyZMQ (and later) to choose right implementation of run-loop, but for the sake of brevity of example I think it’s not necessary.

  7. laanwj commented at 3:14 pm on March 5, 2018: member
    I think this is fine, the example doesn’t have to accommodate for every single version. utACK.
  8. fanquake commented at 6:02 pm on March 6, 2018: member
    utACK 6058766
  9. laanwj merged this on Mar 6, 2018
  10. laanwj closed this on Mar 6, 2018

  11. laanwj referenced this in commit d74b01db0c on Mar 6, 2018
  12. PastaPastaPasta referenced this in commit a38648c911 on Jul 13, 2019
  13. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-27 00:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me