Rafael Zanella added the comment:

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.

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2149>
__________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to