Re: [Python-Dev] Is this a bug?

2006-08-11 Thread Georg Brandl
Georg Brandl wrote: Is this considered a bug? Sure, deleting modules from sys.modules isn't quite common, but it happened to me on one occasion. Python 2.4.3 (#1, Jul 29 2006, 10:52:20) import logging import sys del logging del sys.modules['logging'] ^D Error in

[Python-Dev] PyThreadState_SetAsyncExc bug?

2006-08-11 Thread tomer filiba
while working on a library for raising exceptions in the context of another thread, i've come across a bug in PyThreadState_SetAsyncExc. if i raise an instance, sys.exc_info() confuses the exception value for the exception type, and the exception value is set None. if i raise the type itself, the

Re: [Python-Dev] Dict suppressing exceptions

2006-08-11 Thread Armin Rigo
Hi, On Thu, Aug 10, 2006 at 02:36:16PM -0700, Guido van Rossum wrote: On Thu, Aug 10, 2006 at 09:11:42PM +0200, Martin v. L?wis wrote: I'm in favour of having this __eq__ just return False. I don't think the warning is necessary, (...) +1 Can you explain why you believe that no

Re: [Python-Dev] Dict suppressing exceptions

2006-08-11 Thread M.-A. Lemburg
Armin Rigo wrote: Hi, On Thu, Aug 10, 2006 at 02:36:16PM -0700, Guido van Rossum wrote: On Thu, Aug 10, 2006 at 09:11:42PM +0200, Martin v. L?wis wrote: I'm in favour of having this __eq__ just return False. I don't think the warning is necessary, (...) +1 Can you explain why you believe

Re: [Python-Dev] SyntaxError: can't assign to function call

2006-08-11 Thread Neal Becker
Guido van Rossum wrote: On 8/10/06, James Y Knight [EMAIL PROTECTED] wrote: It makes just as much sense as assigning to an array access, and the semantics would be pretty similar. No. Array references (x[i]) and attribute references (x.a) represent locations. Function calls represent

Re: [Python-Dev] __index__ clipping

2006-08-11 Thread Travis E. Oliphant
Travis E. Oliphant wrote: Here is my C-API proposal 1) PyIndex_Check(obj) Similar to PyIter_Check(obj) as it just checks for whether or not the object can call nb_index. Actually implemented as a macro. 2) PyObject* PyNumber_Index(obj) Simple interface around nb_index that

Re: [Python-Dev] __index__ clipping

2006-08-11 Thread Nick Coghlan
Travis E. Oliphant wrote: Travis E. Oliphant wrote: Here is my C-API proposal 1) PyIndex_Check(obj) Similar to PyIter_Check(obj) as it just checks for whether or not the object can call nb_index. Actually implemented as a macro. 2) PyObject* PyNumber_Index(obj) Simple interface

Re: [Python-Dev] PyThreadState_SetAsyncExc bug?

2006-08-11 Thread Tim Peters
[tomer filiba] while working on a library for raising exceptions in the context of another thread, i've come across a bug in PyThreadState_SetAsyncExc. if i raise an instance, sys.exc_info() confuses the exception value for the exception type, and the exception value is set None. if i raise

Re: [Python-Dev] PyThreadState_SetAsyncExc bug?

2006-08-11 Thread tomer filiba
so it should be fixed, or at least checked for conformness by the code.-tomerOn 8/11/06, Tim Peters [EMAIL PROTECTED] wrote:[tomer filiba] while working on a library for raising exceptions in the context of another thread, i've come across a bug in PyThreadState_SetAsyncExc. if i raise an

Re: [Python-Dev] Dict suppressing exceptions

2006-08-11 Thread Michael Chermside
Guido writes: Alas, I have no idea what it does. Can you come up with an example that doesn't require enums and localization? Sorry. Here's the short version: Fact 1: Sometimes people create objects that raise exceptions when compared for equality. Maybe it's a bad idea to do this, and objects

Re: [Python-Dev] Dict suppressing exceptions

2006-08-11 Thread Guido van Rossum
On 8/11/06, Armin Rigo [EMAIL PROTECTED] wrote: Hi, On Thu, Aug 10, 2006 at 02:36:16PM -0700, Guido van Rossum wrote: On Thu, Aug 10, 2006 at 09:11:42PM +0200, Martin v. L?wis wrote: I'm in favour of having this __eq__ just return False. I don't think the warning is necessary, (...)

Re: [Python-Dev] SyntaxError: can't assign to function call

2006-08-11 Thread Guido van Rossum
On 8/11/06, Neal Becker [EMAIL PROTECTED] wrote: Guido van Rossum wrote: On 8/10/06, James Y Knight [EMAIL PROTECTED] wrote: It makes just as much sense as assigning to an array access, and the semantics would be pretty similar. No. Array references (x[i]) and attribute references

Re: [Python-Dev] Dict suppressing exceptions

2006-08-11 Thread M.-A. Lemburg
Guido van Rossum wrote: Marc-Andre, how's the patch coming along? I'm working on it. Since we only want equal compares to generate the warning, I have to add a rich compare function to Unicode objects. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source

Re: [Python-Dev] openSSL and windows binaries - license

2006-08-11 Thread Martin v. Löwis
Greg Ewing schrieb: That can't be right, because it would mean that anyone who runs a program that contains a patented algorithm, even one bought or otherwise obtained from someone else, would need to individually negotiate a licence with the patent owner. That clearly doesn't happen. No,

Re: [Python-Dev] Dict suppressing exceptions

2006-08-11 Thread Martin v. Löwis
Guido van Rossum schrieb: Me too, and that's what we'll do in py3k. But in 2.5, we're bound by the decisions we made in 1999-2000 about unicode. (Unless Martin has a convincing reason not to have a warning?) Only the general anti-warning argument: it's not the developer which will see the

[Python-Dev] Errors after running make test

2006-08-11 Thread Thomas Heller
There are errors now after the testsuite has finished. Taken from the very end of the amd64 test log (for example). http://www.python.org/dev/buildbot/trunk/amd64%20gentoo%20trunk/builds/1403/step-test/0 [...] 293 tests OK. 26 tests skipped: test_aepack test_al test_applesingle

Re: [Python-Dev] Dict suppressing exceptions

2006-08-11 Thread Martin v. Löwis
Michael Chermside schrieb: I don't *strongly* object to this consensus, but if you haven't glanced at my original example, take a look - it might convince you. The proposed solution will not help with my example. I ignored your example the first time because it was too complicated to

Re: [Python-Dev] Elementtree and Namespaces in 2.5

2006-08-11 Thread Martin v. Löwis
Chris S schrieb: I'm happy to see Elementtree being considered for inclusion with 2.5. However, before committing to this decision, there's an issue regarding it's namespace parsing that should be addressed. Although Elmenttree is in most respects an excellent XML parser, a huge gotcha that

Re: [Python-Dev] SyntaxError: can't assign to function call

2006-08-11 Thread Martin v. Löwis
Neal Becker schrieb: No. Array references (x[i]) and attribute references (x.a) represent locations. Function calls represent values. This is no different than the distinction between lvalues and rvalues in C. Except this syntax is valid in c++ where X() is a constructor call:

Re: [Python-Dev] Unicode Data in Python2.5 is missing a ucd_4_1_0 object

2006-08-11 Thread Martin v. Löwis
Armin Ronacher schrieb: Right, I didn't know that. From that old bug report it sounded like a programmer should be able to select a specific UCD version. Well, my comment was that _IDNA_ needs to access _3.2_. This isn't as general as any application needs to access any version. We likely

Re: [Python-Dev] SyntaxError: can't assign to function call

2006-08-11 Thread Phillip J. Eby
At 09:40 PM 8/11/2006 +0200, Martin v. Löwis wrote: Michael Urman schrieb: On 8/9/06, Michael Hudson [EMAIL PROTECTED] wrote: The question doesn't make sense: in Python, you assign to a name, an attribute or a subscript, and that's it. Just to play devil's advocate here, why not to a

Re: [Python-Dev] SyntaxError: can't assign to function call

2006-08-11 Thread Martin v. Löwis
Phillip J. Eby schrieb: Actually, this isn't as hard as you're implying. In at least the compiler.ast package, such an operation would be represented as a CallFunc node as the child of an Assign node. Wrapping the call node's main child expression in a Getattr for __setcall__ would then

[Python-Dev] Dict suppressing exceptions

2006-08-11 Thread Jim Jewett
Martin v. Löwis wrote: Now I looked at it, and think that the recipe is broken. It should add an __eq__ method which is def __eq__(self, other): return type(self) is type(other) \ and self.EnumType is other.EnumType \ and self.__value==other.__value)

Re: [Python-Dev] Dict suppressing exceptions

2006-08-11 Thread Michael Chermside
Martin v. Löwis writes: Now I looked at it, and think that the recipe is broken. Not broken, but perhaps wrongheaded. The recipe went out of its way to ensure that it would raise an exception of enum values from different enumerations were compared. There's nothing out there saying that this is

Re: [Python-Dev] Dict suppressing exceptions

2006-08-11 Thread M.-A. Lemburg
M.-A. Lemburg wrote: Guido van Rossum wrote: Marc-Andre, how's the patch coming along? I'm working on it. Since we only want equal compares to generate the warning, I have to add a rich compare function to Unicode objects. Here's an initial version:

[Python-Dev] 2.6 idea: a 'function' builtin to parallel classmethod and staticmethod

2006-08-11 Thread Nick Coghlan
It's sometimes useful to be able to use an existing callable as a method of a new class. If the callable is a real function, this is easy. You just including the following line in the class definition: method = some_callable However, callable objects without a function-like __get__ method

Re: [Python-Dev] Dict suppressing exceptions

2006-08-11 Thread Guido van Rossum
On 8/11/06, Michael Chermside [EMAIL PROTECTED] wrote: Martin v. Löwis writes: Now I looked at it, and think that the recipe is broken. Not broken, but perhaps wrongheaded. The recipe went out of its way to ensure that it would raise an exception of enum values from different enumerations

Re: [Python-Dev] Dict suppressing exceptions

2006-08-11 Thread Guido van Rossum
On 8/11/06, Martin v. Löwis [EMAIL PROTECTED] wrote: Michael Chermside schrieb: I propose that we institute a new policy. The policy should state: __eq__ methods should always return True or False. They should only raise an exception if there is some internal error within one

Re: [Python-Dev] Dict suppressing exceptions

2006-08-11 Thread Martin v. Löwis
Guido van Rossum schrieb: __eq__ methods should always return True or False. They should only raise an exception if there is some internal error within one of the objects being compared -- they should never raise an exception because the other object is of an unexpected type.