Re: [Python-Dev] Error trying to access community buildbot page

2007-07-06 Thread Martin v. Löwis
Grig Gheorghiu schrieb:
> When I go to
> 
> http://www.python.org/dev/buildbot/community/all/
> 
> I get a 503 error "Service Temporarily Unavailable".
> 
> Can anybody shed some light?

The community buildbot had stopped working since the
last reboot, because the crontab line to restart it
at reboot was incorrect; nobody had noticed so far
(i.e. since June 21).

Regards,
Martin
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Fwd: [ python-Patches-1744382 ] Read Write lock

2007-07-06 Thread Yaakov Nemoy
Hi,

I submitted this patch a few days ago, and unfortunately have been
busy to reply, but now it's Friday :).


Patches item #1744382, was opened at 2007-06-27 20:08
Message generated for change (Comment added) made by loewis
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1744382&group_id=5470



The patch is unacceptable in its current form:
- it should be provided as a patch to threading.py, not as a separate
module
- it should have a name that follows "the convention", which seems to be
that
  it should have "reader" and "writer" in its name (or "rw"). See how C#
and
  Java do it (and other libraries you can find that provide such a
mechanism)
- it needs documentation
- it needs tests.



I can do the other three parts, but I am wondering, how do I write a
deterministic test unit for my patch?  How is it done with the
threading model in python in general?


Cheers,
Yaakov
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] 2.5.2 schedule?

2007-07-06 Thread Jack Howarth
   I was wondering if there is a schedule for the
release of a python 2.5.2 update? I don't see anything
like that on the www.python.org web site. Thanks in
advance for any information.
  Jack
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] PEP 366 - Relative imports from main modules

2007-07-06 Thread Josiah Carlson

"Brett Cannon" <[EMAIL PROTECTED]> wrote:
> On 7/5/07, Phillip J. Eby <[EMAIL PROTECTED]> wrote:
> > At 11:53 AM 7/5/2007 +0200, Guido van Rossum wrote:
> > >I see no big problems with this, except I wonder if in the end it
> > >wouldn't be better to *always* define __package_name__ instead of only
> > >when it's in main? And then perhaps rename it to __package__? Done
> > >properly it could always be used for relative imports, rather than
> > >parsing __module__ to find the package. Then you won't even need the
> > >error handler.
> >
> > +1 for __package__, and putting it everywhere.  Relative import
> > should use it first if present, falling back to use of __name__.
> 
> +1 from me as well.

This would solve some issues I'm currently having with relative imports. 
+1

 - Josiah

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Fwd: [ python-Patches-1744382 ] Read Write lock

2007-07-06 Thread Mike Klaas
On 6-Jul-07, at 6:45 AM, Yaakov Nemoy wrote:

>
> I can do the other three parts, but I am wondering, how do I write a
> deterministic test unit for my patch?  How is it done with the
> threading model in python in general?

I don't know how it is done in general, but for reference, here are  
some of the unittests for my read/write lock class:

 def testReadCount(self):
 wrlock = ReadWriteLock()
 read, write = wrlock.reader, wrlock.writer

 self.assertEqual(wrlock.readerCount, 0)
 read.acquire()
 self.assertEqual(wrlock.readerCount, 1)
 read.acquire()
 self.assertEqual(wrlock.readerCount, 2)
 read.release()
 self.assertEqual(wrlock.readerCount, 1)
 read.release()
 self.assertEqual(wrlock.readerCount, 0)

 def testContention(self):
 wrlock = ReadWriteLock()
 read, write = wrlock.reader, wrlock.writer

 class Writer(Thread):
 gotit = False
 def run(self):
 write.acquire()
 self.gotit = True
 write.release()
 writer = Writer()

 self.assertEqual(wrlock.readerCount, 0)
 read.acquire()
 self.assertEqual(wrlock.readerCount, 1)
 writer.start()
 self.assertFalse(writer.gotit)

 read.acquire()
 self.assertEqual(wrlock.readerCount, 2)
 self.assertFalse(writer.gotit)

 read.release()
 self.assertEqual(wrlock.readerCount, 1)
 self.assertFalse(writer.gotit)

 read.release()
 self.assertEqual(wrlock.readerCount, 0)
 time.sleep(.1)
 self.assertTrue(writer.gotit)

 def testWRAcquire(self):
 wrlock = ReadWriteLock()
 read, write = wrlock.reader, wrlock.writer

 self.assertEqual(wrlock.readerCount, 0)
 write.acquire()
 write.acquire()
 write.release()
 write.release()

 read.acquire()
 self.assertEqual(wrlock.readerCount, 1)
 read.acquire()
 self.assertEqual(wrlock.readerCount, 2)
 read.release()
 self.assertEqual(wrlock.readerCount, 1)
 read.release()
 self.assertEqual(wrlock.readerCount, 0)
 write.acquire()
 write.release()

 def testOwnAcquire(self):
 wrlock = ReadWriteLock()
 read, write = wrlock.reader, wrlock.writer

 class Writer(Thread):
 gotit = False
 def run(self):
 write.acquire()
 self.gotit = True
 write.release()
 writer = Writer()

 self.assertEqual(wrlock.readerCount, 0)
 read.acquire()
 self.assertEqual(wrlock.readerCount, 1)
 writer.start()
 self.assertFalse(writer.gotit)

 # can acquire the write lock if only
 # this thread has the read lock
 write.acquire()
 write.release()

 read.acquire()
 self.assertEqual(wrlock.readerCount, 2)
 self.assertFalse(writer.gotit)

 read.release()
 self.assertEqual(wrlock.readerCount, 1)
 self.assertFalse(writer.gotit)

 read.release()
 self.assertEqual(wrlock.readerCount, 0)
 time.sleep(.1)
 self.assertTrue(writer.gotit)


 def testDeadlock(self):
 wrlock = ReadWriteLock()
 read, write = wrlock.reader, wrlock.writer

 errors = []

 # a situation which can readily deadlock if care isn't taken
 class LockThread(threading.Thread):
 def __init__(self):
 threading.Thread.__init__(self)
 self.q = Queue.Queue()
 def run(self):
 while True:
 task, lock, delay = self.q.get()
 if not task:
 break
 time.sleep(delay)
 if task == 'acquire':
 for delay in waittime(maxTime=5.0):
 if lock.acquire(False):
 break
 time.sleep(delay)
 else:
 errors.append("Couldn't acquire %s" % str 
(lock))
 else:
 lock.release()

 thrd = LockThread()
 thrd.start()

 thrd.q.put(('acquire', read, 0))
 time.sleep(.2)
 read.acquire()
 thrd.q.put(('acquire', write, 0))
 thrd.q.put(('release', write, .5))
 thrd.q.put(('release', read, 0))
 write.acquire()
 time.sleep(0.0)
 write.release()
 read.release()

 # end
 thrd.q.put((None, None, None))
 thrd.join()

 self.assertFalse(errors, "Errors: %s" % errors)

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscrib

Re: [Python-Dev] Fwd: [ python-Patches-1744382 ] Read Write lock

2007-07-06 Thread Jean-Paul Calderone
On Fri, 6 Jul 2007 10:47:16 -0700, Mike Klaas <[EMAIL PROTECTED]> wrote:
>On 6-Jul-07, at 6:45 AM, Yaakov Nemoy wrote:
>
>>
>> I can do the other three parts, but I am wondering, how do I write a
>> deterministic test unit for my patch?  How is it done with the
>> threading model in python in general?
>
>I don't know how it is done in general, but for reference, here are
>some of the unittests for my read/write lock class:
>
> [snip]
>
> read.release()
> self.assertEqual(wrlock.readerCount, 0)
> time.sleep(.1)
> self.assertTrue(writer.gotit)

Not exactly deterministic.  Instead of a flag attribute, try using an Event or
a Condition.  Either of these will let you know exactly when the necessary
operation has completed.

Jean-Paul
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] 2.5.2 schedule?

2007-07-06 Thread Brett Cannon
On 7/6/07, Jack Howarth <[EMAIL PROTECTED]> wrote:
>I was wondering if there is a schedule for the
> release of a python 2.5.2 update? I don't see anything
> like that on the www.python.org web site. Thanks in
> advance for any information.

There is no schedule at the moment, no.  It is up to the release
manager (Anthony Baxter) and python-dev to decide if another release
is necessary soon or not.

Having said that, there will very likely be a 2.5 release shortly
after 2.6 is out the door.

-Brett
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Adding NetworkIOError for bug 1706815

2007-07-06 Thread Gregory P. Smith
On Thu, Jul 05, 2007 at 12:05:01PM +0200, Guido van Rossum wrote:
> On 7/5/07, Gregory P. Smith <[EMAIL PROTECTED]> wrote:
> >On Wed, Jul 04, 2007 at 11:03:42AM +0200, Guido van Rossum wrote:
> >> Why not simply inherit socket.error from EnvironmentError?
> >
> >True, that would be simpler; is it enough?  If we avoid adding the new
> >exception, I really think it should inherit from IOError, not
> >EnviromnentError because sockets are I/O.  urllib2.URLError was
> >already a child of IOError; doing the same to to socket.error makes
> >sense.
> 
> OTOH, when os.read() returns an error, os.error (OSError) is raised.
> Is that not I/O?
> 
> IMO this is all hairsplitting, and the exact inheritance hierarchy for
> these doesn't matter much -- nobody is going to write a handler that
> treats OSError or socket.error different than IOError.

Ah.  Given all that, the point of a NetworkIOError is moot.  I had
assumed read would raise an IOError but hadn't read the code.  Looks
like fileobject.c's file_read() raises IOError as I expected but
posixmodule.c's read() raises OSError (fair enough, its the os module).

Since socket objects are treated like file objects in many cases I
think IOError would be a more appropriate parent than
EnvironmentError.  There was a case at work recently that started me
down the path of looking at this where code caught IOError but not
socket.error.

Any objects to me just having socket.error inherit from IOError?

> >PS for the person complaining that the url didn't work.  blame
> >   sourceforge and go look the bug up by id yourself.  nothing i can
> >   do about that.
> 
> Try python.org/sf/1706815
> 
> --Guido

ooo handy.  thanks.

-Greg

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com