[ 
https://issues.apache.org/jira/browse/PROTON-2091?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16914651#comment-16914651
 ] 

ASF GitHub Bot commented on PROTON-2091:
----------------------------------------

astitcher commented on issue #188: PROTON-2091: fix `len(queue)` in 
python/examples and reformat for PEP8
URL: https://github.com/apache/qpid-proton/pull/188#issuecomment-524470568
 
 
   Please remove it - this is meant to be example code. No other example has 
test code included.
   
   If you really think we need to include unit tests for something that you 
think is complex enough to need it then use a testing tool that can extract 
unit tests from comments and put the unit test comment with the class/function 
that is being tested.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> [python] example broker never removes empty queues
> --------------------------------------------------
>
>                 Key: PROTON-2091
>                 URL: https://issues.apache.org/jira/browse/PROTON-2091
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: python-binding
>    Affects Versions: proton-c-0.29.0
>            Reporter: Jiri Daněk
>            Priority: Trivial
>
> {code:python:title=python/examples/broker.py}
>     def unsubscribe(self, consumer):
>          if consumer in self.consumers:
>             self.consumers.remove(consumer)
>          return len(self.consumers) == 0 and (self.dynamic or 
> self.queue.count == 0)
> {code}
> Here, {{self.queue.count == 0}} can never be {{True}} (because method 
> reference != integer). This means that broker will never drop the {{Queue}} 
> object.
> Functionality wise, the impact of this is insignificant, given the uses of 
> the code (stand-in for real broker when running simple messaging examples).
> It has compatibility implications, however, because {{self.queue.count}} is a 
> Python 2.7 addition and on Python 2.6 accessing undefined property will raise 
> exception and crash the broker.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to