[Python-Dev] Std test failures on WIndows: test_compare, test_minidom
Tue, 2 Jan 2001 08:51:48 -0800
On Tue, Jan 02, 2001 at 06:19:14PM -0500, Tim Peters wrote:
> Neil, my platform doesn't even *have* a "make": are you saying the test
> passes for you when you run regrtest.py?
Yes. Isn't checking in code without running regrtest a capital
> Lang Ref 2.1.3 (Comparisons) says you can compare them, and
> guarantees they won't compare equal, but doesn't define it beyond that.
Okay, I'll use == rather than cmp(). When I was working on the coercion
patch I found cmp() useful. I guess it shouldn't be in the standard
test suite, especially since Jython may implement things differently.
> or, do you think that the results from cmp() should be clamped
> between -1 and 1?
> Not that either <wink>; cmp() isn't documented that way.
> They're "bizarre" simply because they're not what Python returns!
They do on my box:
Python 2.0 (#19, Nov 21 2000, 18:13:04)
[GCC 2.95.2 20000220 (Debian GNU/Linux)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> cmp(1, None)
I guess MS uses a different strcmp than GNU. Do you mind trying the
attached C code? I get "-78" as output. I should have thought a little
more before checking in the patch. -78 is quite obviously a
machine/library dependent thing.
> One of us is missing something obvious here <wink>.
I don't know about that. The implementation of coercion and comparison
is not simple. I've been studying it for some time now and I obviously
still don't know what the hell is going on.
AFAICT, the problem is that instances without a comparison method can
compare larger or smaller than numbers depending on where in memory the
objects are stored.
printf("%d\n", strcmp("", "None"));