Re: [Python-Dev] popen test case inquiry in r55735 using PCBuild8
> All, > > I wanted to pass this one around before opening an issue on it. > When running the unit test for popen via rt.bat (in PCBuild8), > I received the following error: > > === BEGIN ERROR === > > C:\Documents and > Settings\joe\Desktop\Development\Python\trunk\PCbuild8>rt test_popen > Deleting .pyc/.pyo files ... > 43 .pyc deleted, 0 .pyo deleted > > C:\Documents and > Settings\joe\Desktop\Development\Python\trunk\PCbuild8>win32Re > lease\python.exe -E -tt ../lib/test/regrtest.py test_popen > test_popen > test test_popen failed -- Traceback (most recent call last): >File "C:\Documents and Settings\joe\Desktop\Development\Python\... I can't reproduce this. I expect you will find it is due to the space in the filename of your Python directory, via cmd.exe's documented behaviour with quote characters. A patch that allows the test suite to work in such an environment would be welcome, but I think you might end up needing access to GetShortPathName() rather than CreateProcess(). Cheers, Mark ___ 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] popen test case inquiry in r55735 using PCBuild8
Mark, Sounds good, I will get patching tonight. Any thoughts on CreateProcessW ? Joseph Armbruster On 6/4/07, Mark Hammond <[EMAIL PROTECTED]> wrote: > All, > > I wanted to pass this one around before opening an issue on it. > When running the unit test for popen via rt.bat (in PCBuild8), > I received the following error: > > === BEGIN ERROR === > > C:\Documents and > Settings\joe\Desktop\Development\Python\trunk\PCbuild8>rt test_popen > Deleting .pyc/.pyo files ... > 43 .pyc deleted, 0 .pyo deleted > > C:\Documents and > Settings\joe\Desktop\Development\Python\trunk\PCbuild8>win32Re > lease\python.exe -E -tt ../lib/test/regrtest.py test_popen > test_popen > test test_popen failed -- Traceback (most recent call last): >File "C:\Documents and Settings\joe\Desktop\Development\Python\... I can't reproduce this. I expect you will find it is due to the space in the filename of your Python directory, via cmd.exe's documented behaviour with quote characters. A patch that allows the test suite to work in such an environment would be welcome, but I think you might end up needing access to GetShortPathName() rather than CreateProcess(). Cheers, Mark ___ 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] What exception should Thread.start() raise?
The threading module contains buggy code: class Thread(_Verbose): ... def start(self): assert self.__initialized, "Thread.__init__() not called" assert not self.__started, "thread already started" ... If you run such code with python -O, weird stuff may happen when you call mythread.start() multiple times. -O removes assert statements so the code won't fail with an AssertionError which would be expected. So what real exception should Thread.start() raise? I have suggested adding an IllegalStateError modelled after java's IllegalStateException, but that idea was rejected. So what exception should be raised here, is it a RuntimeError? -- mvh Björn ___ 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] What exception should Thread.start() raise?
On 6/4/07, BJörn Lindqvist <[EMAIL PROTECTED]> wrote:
> The threading module contains buggy code:
>
> class Thread(_Verbose):
> ...
> def start(self):
> assert self.__initialized, "Thread.__init__() not called"
> assert not self.__started, "thread already started"
> ...
>
> If you run such code with python -O, weird stuff may happen when you
> call mythread.start() multiple times. -O removes assert statements so
> the code won't fail with an AssertionError which would be expected.
>
> So what real exception should Thread.start() raise? I have suggested
> adding an IllegalStateError modelled after java's
> IllegalStateException, but that idea was rejected. So what exception
> should be raised here, is it a RuntimeError?
If you want to be fully backwards compatible, you could just write this like::
def start(self):
if not self.__initialized:
raise AssertionError("Thread.__init__() not called")
if self.__started:
raise AssertionError("thread already started")
But I doubt anyone is actually catching the AssertionError, so
changing the error type would probably be okay.
STeVe
--
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
--- Bucky Katt, Get Fuzzy
___
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] What exception should Thread.start() raise?
On 6/4/07, Steven Bethard <[EMAIL PROTECTED]> wrote:
> On 6/4/07, BJörn Lindqvist <[EMAIL PROTECTED]> wrote:
> > The threading module contains buggy code:
> >
> > class Thread(_Verbose):
> > ...
> > def start(self):
> > assert self.__initialized, "Thread.__init__() not called"
> > assert not self.__started, "thread already started"
> > ...
> >
> > If you run such code with python -O, weird stuff may happen when you
> > call mythread.start() multiple times. -O removes assert statements so
> > the code won't fail with an AssertionError which would be expected.
> >
> > So what real exception should Thread.start() raise? I have suggested
> > adding an IllegalStateError modelled after java's
> > IllegalStateException, but that idea was rejected. So what exception
> > should be raised here, is it a RuntimeError?
>
> If you want to be fully backwards compatible, you could just write this like::
>
> def start(self):
> if not self.__initialized:
> raise AssertionError("Thread.__init__() not called")
> if self.__started:
> raise AssertionError("thread already started")
>
> But I doubt anyone is actually catching the AssertionError, so
> changing the error type would probably be okay.
Anything that causes an "assert" to fail is technically using
"undefined" behavior. I am in favor of changing this case to
RuntimeError, which is the error Python usually uses for state
problems.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
___
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] svn viewer confused
Choosing a revision, such as http://svn.python.org/view/python/trunk/Objects/?rev=55606&sortby=date&view=log does not lead to the correct generated page; it either times out or generates a much older changelog. ___ 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
