This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author zanella
Recipients amaury.forgeotdarc, benjamin.peterson, rbp, rhettinger, zanella
Date 2008-02-23.19:39:45
SpamBayes Score 0.00039955153
Marked as misclassified No
Message-id <1203795586.8.0.276404509385.issue2149@psf.upfronthosting.co.za>
In-reply-to
Content
Just to exemplify:
"""
from threading import Thread
import time
import Queue

class C:
  def __int__(self):
    return 3
  
  #def __del__(self): print "collected..." # won't happen since q holds
a reference to it

c = C()
q = Queue.Queue(c)

# Not dynamic
print "maxsize: ", q.maxsize

# Not full() with instance
print c > 0
print len(q.queue) == q.maxsize

class T(Thread):
  def __init__(self, q):
    self._q = q
    Thread.__init__(self)
  
  def run(self):
    #For sme bizarre motive
    self._q.maxsize = 5

#Ends up being infinite most of the times
t = T(q)

for i in xrange(1000):
  q.put_nowait(i)
  if i == 1: # otherwise the "and len(self.queue) == self.maxsize" will fail
    t.start()
    time.sleep(1)

t.join()
"""

I guess rhettinger is right, there's no issue here, anyone that decides
to change the maxsize afterwards should know what is doing.

The only "possible" problem I'm able to see is someone passing an object
wich has __int__() and expecting it to be used.
History
Date User Action Args
2008-02-23 19:39:47zanellasetspambayes_score: 0.000399552 -> 0.00039955153
recipients: + zanella, rhettinger, amaury.forgeotdarc, benjamin.peterson, rbp
2008-02-23 19:39:46zanellasetspambayes_score: 0.000399552 -> 0.000399552
messageid: <1203795586.8.0.276404509385.issue2149@psf.upfronthosting.co.za>
2008-02-23 19:39:46zanellalinkissue2149 messages
2008-02-23 19:39:45zanellacreate