#jython IRC Log (v0.9)

Index

IRC Log for 2011-06-02

Timestamps are in GMT/BST.

[0:35] * skay (~skay@c-98-223-146-111.hsd1.in.comcast.net) Quit (Quit: skay)
[1:08] * lopex (~lopx@84-10-213-252.dynamic.chello.pl) Quit ()
[3:39] * shashank (~shashank@c-98-245-87-8.hsd1.co.comcast.net) has left #jython
[3:45] * robbyoconnor (~wakawaka@guifications/user/r0bby) has joined #jython
[3:50] * robbyoconnor (~wakawaka@guifications/user/r0bby) Quit (Ping timeout: 240 seconds)
[6:08] * agronholm (~demigod@nblzone-211-37.nblnetworks.fi) Quit (Quit: KVIrc 4.1.1 Equilibrium http://www.kvirc.net/)
[6:09] * agronholm (~demigod@nblzone-211-37.nblnetworks.fi) has joined #jython
[8:08] * MarderIII (~marderii@enneman.demon.nl) has joined #jython
[8:34] * jabley (~jabley@78-105-125-211.zone3.bethere.co.uk) has joined #jython
[11:05] * lopex (531346b2@gateway/web/freenode/ip.83.19.70.178) has joined #jython
[11:13] * juneau001 (~juneau@fess-116326.dhcp.fnal.gov) has joined #jython
[11:31] * thobe (~Adium@c83-249-235-76.bredband.comhem.se) has joined #jython
[11:35] * juneau001 (~juneau@fess-116326.dhcp.fnal.gov) Quit (Remote host closed the connection)
[11:35] * juneau001 (~juneau@fess-116326.dhcp.fnal.gov) has joined #jython
[11:41] * MarderIII (~marderii@enneman.demon.nl) Quit (Quit: [IRSSI] Of course I am crazy but that doesn't mean I am wrong.)
[12:41] * jabley (~jabley@78-105-125-211.zone3.bethere.co.uk) Quit (Quit: jabley)
[12:55] * chacara (~chacara@201.57.231.226) has joined #jython
[13:02] * jabley (~jabley@78-105-125-211.zone3.bethere.co.uk) has joined #jython
[13:15] * skay (~skay@c-98-223-146-111.hsd1.in.comcast.net) has joined #jython
[13:47] * Oti (~ohumbel@adsl-84-226-238-48.adslplus.ch) Quit (Quit: Oti)
[13:49] * Oti (~ohumbel@adsl-84-226-238-48.adslplus.ch) has joined #jython
[14:03] * skay (~skay@c-98-223-146-111.hsd1.in.comcast.net) Quit (Quit: skay)
[14:17] * Oti (~ohumbel@adsl-84-226-238-48.adslplus.ch) Quit (Quit: Oti)
[14:24] * lopex (531346b2@gateway/web/freenode/ip.83.19.70.178) Quit (Ping timeout: 252 seconds)
[14:33] * MarderIII (~marderii@enneman.demon.nl) has joined #jython
[15:18] * KayT3 (~KayT3@63.84.81.41) has joined #jython
[15:45] * shashank (~shashank@c-98-245-87-8.hsd1.co.comcast.net) has joined #jython
[15:48] * MarderIII (~marderii@enneman.demon.nl) Quit (Quit: [IRSSI] A fool dreams of wealth, a wise man, of happiness.)
[17:12] * jabley (~jabley@78-105-125-211.zone3.bethere.co.uk) Quit (Quit: jabley)
[17:48] * jabley (~jabley@cpc1-farn4-0-0-cust318.6-2.cable.virginmedia.com) has joined #jython
[17:51] * jabley (~jabley@cpc1-farn4-0-0-cust318.6-2.cable.virginmedia.com) Quit (Client Quit)
[17:53] * jabley (~jabley@cpc1-farn4-0-0-cust318.6-2.cable.virginmedia.com) has joined #jython
[17:55] * jabley (~jabley@cpc1-farn4-0-0-cust318.6-2.cable.virginmedia.com) Quit (Client Quit)
[18:09] <shashank> Hi all, I am trying to move jython to jdk7 to use invokedynamic, I am facing an issue with sorting regrtest
[18:09] <shashank> the regrtest will run for a random amount of time and then throw an exception:
[18:10] <shashank> java.lang.IllegalArgumentException: Comparison method violates its
[18:10] <shashank> general contract!
[18:11] <shashank> jimbaker: I think this has to do with the new TimSort introduced in Java. You can see the new TimSort at: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/bfd7abda8f79
[18:12] <shashank> The generic sort in Jython is at: https://bitbucket.org/shashank/jython-experiments/src/344d161e6ce8/src/org/python/core/PyList.java#cl-752
[18:13] <shashank> any clues on how to debug this?
[18:54] <pjenvey> shashank - I think I've seen that on osx. I don't think any of the sorting regrtest actually uses Java's builtin sorting, we have our own impl
[18:57] <shashank> pjenvey: I think the implementation uses Java's Collections
[18:57] <shashank> I don't know if the implementation changed, I'll look at the current bitbucket code for jython
[18:59] <shashank> pjenvey: Looks like sort does use Collections, I am looking at the head for Jython: https://bitbucket.org/jython/jython/src/b75d6d8f75ed/src/org/python/core/PyList.java#cl-752
[19:01] <pjenvey> shashank - oh yes my fault, we did change that to Collections.sort for 2.5.2
[19:05] <shashank> after reading the javadocs, I think the following contract is being violated in some way:
[19:05] <shashank> "The natural ordering for a class C is said to be consistent with equals if and only if e1.compareTo(e2) == 0 has the same boolean value as e1.equals(e2) for every e1 and e2 of class C."
[19:07] <shashank> And the sort regrtest seems to pass for the first few cases.. it passes for smaller number
[19:07] <shashank> and generally throws an exception when it's "Testing size 65"
[19:21] <shashank> Hmm I think I see the issue here! It has to do with the regrtest itself
[19:21] <shashank> there is a list s and it's being sorted like so:
[19:21] <shashank> s.sort(lambda a, b: int(random.random() * 3) - 1)
[19:21] <shashank> where the cmp function just randomly returns -1, 0 or 1
[19:22] <shashank> I think sometimes, the Java implementation would call the cmp function with the same values, but it gets a different value everytime
[19:22] <shashank> which causes it to crash
[19:24] <shashank> this test passes in normal Python though, is it required that we support this functionality?
[19:28] <pjenvey> shashank - probably, it looks like the next line checks if the original list is the same? ie if the contract is violated, no sort happens
[19:29] <pjenvey> so maybe we would catch the IllegalArg exception and return?
[19:29] <pjenvey> we'd have to make sure that would be the only IllegalArg we'd be catching, if we're going with that solution
[19:31] * juneau001 (~juneau@fess-116326.dhcp.fnal.gov) Quit (Quit: juneau001)
[19:40] <shashank> pjenvey: yes that is true. but we have to inform that the sorting did not happen right? So we need to catch the IllegalArg exception and throw a proper python exception instead
[20:04] <pjenvey> shashank - does the test expect an exception?
[20:04] <shashank> pjenvey: no it does not
[20:05] <pjenvey> I guess we don't have to, then?
[20:06] <shashank> well in generic code, the python developer would assume that the list has been sorted
[20:07] <shashank> it would make sense to inform them that the list has not been sorted.. rather than the developer having to chase that problem down from somewhere else
[20:09] <shashank> Python3 will remove support for the cmp method and just support the key argument which i think would reduce these kinds of issues
[20:09] <shashank> I'm sorry, Python3 _has_ removed ^^
[20:12] <shashank> even, if we are just looking at this particular test case, in the regrtest, then too the test will fail if we do not modify the test case, since it checks for the sorted array
[20:23] * shashank (~shashank@c-98-245-87-8.hsd1.co.comcast.net) Quit (Quit: shashank)
[20:23] * shashank (~shashank@c-98-245-87-8.hsd1.co.comcast.net) has joined #jython
[20:30] * shashank (~shashank@c-98-245-87-8.hsd1.co.comcast.net) Quit (Ping timeout: 250 seconds)
[20:41] <pjenvey> shashank_ - well if CPython doesn't care to notify you of the problem, we don't have to either
[21:08] * chacara (~chacara@201.57.231.226) Quit (Quit: Leaving)
[22:02] * shashank (~shashank@c-98-245-87-8.hsd1.co.comcast.net) has joined #jython
[22:36] * KayT3 (~KayT3@63.84.81.41) Quit (Quit: Leaving)
[22:59] <jimbaker> pjenvey, we have been using java's Collections.sort since a 2.5.0 beta iirc - i believe i changed it because the impl was buggy. once timsort was discussed for java 7, i didn't bother with going back as a possible optimization
[23:03] <jimbaker> shashank, re cmp returning random values, yeah, this is actually a good thing to test. i imagine this is more important with something like timsort than something simpler. a simple wrapper is all that's necessary i guess, as was discussed
[23:04] <jimbaker> what we don't want is for the sort to blow up because of a bad cmp function. so this test verifies that
[23:08] <shashank> jimbaker: Right, I'll make that change. So if we encounter a bad cmp function, we just swallow the IllegalArg exception and not sort the list right?
[23:09] <shashank> but, that could possibly result in code assuming a list to be sorted to break

Index

These logs were automatically created by JythonLogBot_ on irc.freenode.net using a slightly modified version of the Java IRC LogBot (github).