[issue11140] threading.Lock().release() raises _thread.error, not RuntimeError

2011-03-01 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Hello,

 Shouldn't this be fixed in _dummy_thread too?
 
 Attached patch contains fix + test.

Oops, thanks for noticing.

 (Unfortunately, I was not able to run the tests with my patch:
 `python3.2 -m test.regrtest test_dummy_thread` tests my 'system'
 version, not my svn checkout.

You must run ./python instead and it should work.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11140
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11140] threading.Lock().release() raises _thread.error, not RuntimeError

2011-03-01 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

_dummy_thread patch committed in r88699, thank you!

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11140
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11140] threading.Lock().release() raises _thread.error, not RuntimeError

2011-02-28 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Patch committed in r88682, thank you!

--
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11140
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11140] threading.Lock().release() raises _thread.error, not RuntimeError

2011-02-27 Thread Filip GruszczyƄski

Filip GruszczyƄski grusz...@gmail.com added the comment:

Test for releasing unacquired lock and aliasing exception.

--
keywords: +patch
nosy: +gruszczy
Added file: http://bugs.python.org/file20936/11140.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11140
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11140] threading.Lock().release() raises _thread.error, not RuntimeError

2011-02-07 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

I would rather make _thread.error an alias of RuntimeError. That way, we can 
reconcile the docs and the code without breaking compatibility.
Also, importing _thread won't be necessary to catch errors raised in threading 
objects.

--
nosy: +gregory.p.smith, pitrou
stage:  - needs patch
title: Error in the documentation of threading.Lock().release() - 
threading.Lock().release() raises _thread.error, not RuntimeError
type:  - behavior
versions: +Python 3.3 -Python 2.6, Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11140
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11140] threading.Lock().release() raises _thread.error, not RuntimeError

2011-02-07 Thread aaugustin

aaugustin aymeric.augus...@polyconseil.fr added the comment:

I agree with your solution. Unfortunately, I do not know how you would redefine 
ThreadError to extend RuntimeError in a C extension.

_thread.error is created line 741 in trunk/Modules/threadmodule.c:
ThreadError = PyErr_NewException(thread.error, NULL, NULL);


dummy_thread.error is created lin 21 in trunk/Lib/dummy_thread.py:
class error(Exception):
...

Changing this to RuntimeException is trivial.


I don't think there are other implementations of threading in the Python source 
but I'd appreciate if someone more familiar with the interpreter could confirm.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11140
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11140] threading.Lock().release() raises _thread.error, not RuntimeError

2011-02-07 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 aaugustin aymeric.augus...@polyconseil.fr added the comment:
 
 I agree with your solution. Unfortunately, I do not know how you would
 redefine ThreadError to extend RuntimeError in a C extension.
 
 _thread.error is created line 741 in trunk/Modules/threadmodule.c:
 ThreadError = PyErr_NewException(thread.error, NULL, NULL);

I was not proposing to extend it, just to alias it:

ThreadError = PyExc_RuntimeError;
Py_INCREF(ThreadError);

That said, extending is quite trivial if the behaviour is not changed:

ThreadError = PyErr_NewException(thread.error, PyExc_RuntimeError,
NULL);

(see
http://docs.python.org/dev/c-api/exceptions.html#PyErr_NewException)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11140
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com