#jython IRC Log (v0.9)

Index

IRC Log for 2016-05-11

Timestamps are in GMT/BST.

[1:20] * fwierzbicki1 (~Adium@99-106-169-5.lightspeed.sntcca.sbcglobal.net) Quit (Quit: Leaving.)
[1:49] * jimklo_ (~jimklo@75-128-4-186.dhcp.snlo.ca.charter.com) has joined #jython
[1:53] * jimklo (~jimklo@192.12.16.110) Quit (Ping timeout: 252 seconds)
[1:53] * jimklo_ (~jimklo@75-128-4-186.dhcp.snlo.ca.charter.com) Quit (Ping timeout: 246 seconds)
[12:39] * TomA (~TomA@c-68-32-46-223.hsd1.mi.comcast.net) has joined #jython
[14:23] * xemdetia (xemdetia@nat/ibm/x-romnydmunseizlsj) has joined #jython
[15:29] <jimbaker> ahhughes, there are multiple ways of bundling jython, and corresponding libraries. usually the correct answer is to use the default jar - that's certainly what i do. but it's much bigger
[15:30] <jimbaker> in terms of how to bundle with OSGI - i have no experience unfortunately
[15:34] * jimklo (~jimklo@192.12.16.110) has joined #jython
[15:36] <jimbaker> perhaps these questions should help inform this mavenization bug: http://bugs.jython.org/issue2182
[15:39] * robbyoconnor (~wakawaka@guifications/user/r0bby) Quit (Ping timeout: 252 seconds)
[15:39] * IvanPonomarev (~Ivan@46.28.89.250) has joined #jython
[15:45] <IvanPonomarev> Hello, Jim, are you here?
[15:45] <jimbaker> IvanPonomarev, hi
[15:45] <jimbaker> so tell me about your specific problem
[15:46] <jimbaker> also, what do you teach in moscow?
[15:46] <IvanPonomarev> Well everything is explained in our email group message here https://sourceforge.net/p/jython/mailman/message/34413663/
[15:47] <IvanPonomarev> I teach an introductory course on axiomatic set theory )
[15:47] <IvanPonomarev> We need to have a brand new PythonInterpreter from time to time
[15:47] <IvanPonomarev> We are using a pool (LinkedList<PythonInterpreter>)
[15:48] <IvanPonomarev> to make multi-user operation possible
[15:48] <IvanPonomarev> Is it a correct idea at all??
[15:49] <jimbaker> (i just finished teaching my principles of programming languages)
[15:49] <jimbaker> (also on a separate chat...)
[15:50] <jimbaker> so PythonInterpreter objects are pretty cheap
[15:50] <jimbaker> but i guess it's the linked PySystemState that you need fresh as well?
[15:52] <IvanPonomarev> not exactly... when someone changes a Python script file on a file system, we want all calls for Python functions to work the new way
[15:52] <IvanPonomarev> so we are clearing the pool of interpreters
[15:52] <IvanPonomarev> and trying to create new ones with new PySystemState
[15:53] <jimbaker> IvanPonomarev, i would have to dig it up, but i did some testing of PythonInterpreter lifecycle where i was creating 10,000s of PIs in the test. seemed to work well, and fast
[15:54] <jimbaker> IvanPonomarev, yeah, that specific case makes sense. it's not the only way to refresh
[15:54] <IvanPonomarev> what is the correct way to create a fresh PythonInterpreter to avoid using the cached compiled code: to use new PythonInterpreter(null, new PySystemState()) or new PythonInterpreter(null, Py.getSystemState())
[15:54] <IvanPonomarev> &
[15:54] <IvanPonomarev> ?
[15:54] <jimbaker> jython supports exactly the same semantics as seen in cpython with https://docs.python.org/2/library/functions.html#reload
[15:56] <IvanPonomarev> Ahhh
[15:56] <jimbaker> IvanPonomarev, you can do things like clear sys.modules
[15:57] <IvanPonomarev> we never tried to do this
[15:57] <IvanPonomarev> I have to try it out )
[15:57] * TomA (~TomA@c-68-32-46-223.hsd1.mi.comcast.net) Quit (Remote host closed the connection)
[15:57] <jimbaker> so it's important to understand that jython/cpython share the same approach: fundamentally the only unit of compilation is a function body, as wrapped by a code object
[15:59] <IvanPonomarev> As far as I understood the reload(...) function reloads only one module
[16:00] <IvanPonomarev> if I want them all reloaded, I have to clear sys.modules, don't I?
[16:01] <jimbaker> so some given function wraps that code object, along with its closed lexical scope (the "closure"), along with some other fields; so if you do a dir of a function, you will get 'func_closure', 'func_code', 'func_defaults', 'func_dict', 'func_doc', 'func_globals', 'func_name' as the relevant ones here
[16:02] <jimbaker> IvanPonomarev, it's more subtle, because sys.modules really is just a reference to modules that in turn ultimately end up in such leafs as code objects
[16:02] <IvanPonomarev> now I see
[16:02] <jimbaker> but sys.modules does interact with how import works
[16:03] <jimbaker> but lets say i have some code object that is changing. is it really the case that i need to clear out all my imports of the standard library? probably not
[16:03] <jimbaker> most likely i just need to rebind the corresponding function
[16:04] <jimbaker> and that's really really fast, and standard across jython/cpython :)
[16:04] <jimbaker> it is in fact, what is core to what it means for python to be a dynamic language
[16:05] <IvanPonomarev> ohh.. thank you for your lesson on Python understanding, Jim
[16:06] <jimbaker> IvanPonomarev, no worries. since you are teaching axiomatic set theory, i know you appreciate the fact that sometimes the way to solve a problem is to just reframe it :)
[16:06] <IvanPonomarev> I never came accross the problem of dynamic modules changing before in other languages and systems
[16:07] <IvanPonomarev> ok, so now the best way for me is to dig into that 'reload' built-in function, right?
[16:07] <jimbaker> IvanPonomarev, it's actually true of ruby and javascript
[16:07] <jimbaker> IvanPonomarev, yeah, i think reload might work for you
[16:08] * fwierzbicki (~Adium@99-106-169-5.lightspeed.sntcca.sbcglobal.net) has joined #jython
[16:08] <IvanPonomarev> thanks for your advice, will try it out and will write you about the results.
[16:08] <jimbaker> but in general, you can do this dynamic rebinding a number of ways. so for example, i can compile a new code object, with https://docs.python.org/2/library/functions.html#compile
[16:08] <jimbaker> then set to a function
[16:09] <jimbaker> just gets you deeper into the runtime, with more precision - you can do this change on a function by function basis
[16:10] <IvanPonomarev> In my case I just have a bunch of directories with .py files
[16:10] <IvanPonomarev> And in fact I don
[16:10] <IvanPonomarev> t know which file has changed, i will have to devise a method of doing this
[16:11] <jimbaker> IvanPonomarev, so the way that jython does this with the standard import mechanism is simply modification time
[16:11] <jimbaker> so that's reasonable enough for most usage
[16:13] <jimbaker> again, we give you tools to change as desired. anyway, i think this scapel is going to be more far productive than the PySystemState sledgehammer. certainly more scalable!
[16:14] <jimbaker> the other interesting thing is that you can do things like code evolution. so in python i can readily change the class of some object at any time (unless java-defined builtins like int - they have special rules, mostly to make things more efficient. again no diff here between cpython/jython)
[16:15] <jimbaker> this can make sense, so long as the new class can work with the object; and the user of the object are forwards compatible with the new object
[16:15] <jimbaker> sorry, compatible with the *new class*
[16:16] <IvanPonomarev> OK now I got enough information to dive into tests and investigation
[16:17] <jimbaker> IvanPonomarev, you might look into 3rd party packages like https://pypi.python.org/pypi/lazy-reload
[16:17] <jimbaker> it probably would work as is
[16:18] <IvanPonomarev> Thanks for your help, will check this out
[16:21] <IvanPonomarev> If you still here: a colleague of mine is asking, could you explain if the undocumented methods .cleanup(), .close(), .initialize() of PySystemState do anything usable?
[16:23] <jimbaker> lazy-reload fails on what looks like could be a easy workaround; one place where jython could easily match cpython
[16:23] <jimbaker> (i will make a note of it)
[16:24] <jimbaker> IvanPonomarev, so generally we do not document "public" methods of the jython runtime because we don't want to have to support them as an official API
[16:25] <jimbaker> but yes, these methods do important stuff. especially the headache that is the initialize method
[16:26] <jimbaker> i spent a lot of time a couple years ago trying to make that method better, but it still has some unfortunate dependencies
[16:27] <IvanPonomarev> I see, anyway these methods are not what we should look into to solve our specific problem
[16:27] <jimbaker> yeah, i think we have discussed a far superior approach
[16:33] * robbyoconnor (~wakawaka@guifications/user/r0bby) has joined #jython
[16:38] * robbyoconnor (~wakawaka@guifications/user/r0bby) Quit (Quit: Konversation terminated!)
[16:48] <jimbaker> IvanPonomarev, here's the workaround for lazy_reload: https://gist.github.com/jimbaker/bed895b6f4ef167b95cebedaff9b6699
[16:49] <IvanPonomarev> I see, thanks!
[16:51] <jimbaker> and corresponding bug: http://bugs.jython.org/issue2499
[17:25] * IvanPonomarev (~Ivan@46.28.89.250) Quit (Ping timeout: 240 seconds)
[17:29] * srcerer (~chatzilla@dns2.klsairexpress.com) has joined #jython
[17:35] * TomA (~TomA@c-68-32-46-223.hsd1.mi.comcast.net) has joined #jython
[19:18] * xemdetia (xemdetia@nat/ibm/x-romnydmunseizlsj) Quit (Ping timeout: 250 seconds)
[19:38] <TomA> jimbaker - We're running into an issue when using default cacerts in our ssl client. Essentially, if you pass in a JVM argument to specify your own truststore (-Djavax.net.ssl.trustStore=/tmp/truststore.jks), the code will also look for more cacert files in that same directory (in my case /tmp) and eventually err out when it does not have permissions to open a file in that directory. (https://github.com/jythontools/jython/blob/m
[19:38] <TomA> aster/Lib/ssl.py#L1057). Is "Finding more cacerts even though you explicitly passed one in" desired behavior?
[19:47] <jimbaker> TomA, most likely not - you are seeing the conflict between some behavior that comes from cpython emulation, vs what java supports
[19:47] <jimbaker> (a usual source of bugs for jython...)
[19:48] <jimbaker> please file a bug. i'm starting to have some bandwidth again. filed grades last night
[19:48] <TomA> ahh ok that makes sense. Do you think the fix is basically don't set a capath if a cacert (java truststore is set)?
[19:48] <TomA> if so, I can file a bug/patch real quick
[19:51] <jimbaker> btw - merge sorting 130+ final papers makes me wonder when i can have computer-based exams... but hey my classroom had a true blackboard setup in that high style of univ engineering - sliding, exquisitely balanced, covering the walls
[19:51] <jimbaker> so there's that
[19:51] <TomA> haha
[19:51] <jimbaker> TomA, yeah, please file that bug. i think that's the right fix
[19:52] <TomA> cool will do. Thanks jim
[20:13] * IvanPonomarev (~Ivan@176.194.41.233) has joined #jython
[20:30] * IvanPonomarev (~Ivan@176.194.41.233) Quit (Ping timeout: 246 seconds)
[21:46] * xemdetia (xemdetia@nat/ibm/x-srkueyrdmnkhmsmy) has joined #jython
[21:48] * TomA (~TomA@c-68-32-46-223.hsd1.mi.comcast.net) Quit (Remote host closed the connection)
[22:00] * stewori (~stefan@5.146.129.173) has joined #jython
[22:49] * jimklo (~jimklo@192.12.16.110) Quit (Ping timeout: 265 seconds)
[23:29] * cyraxjoe (~joe@web518.webfaction.com) Quit (Read error: Connection reset by peer)
[23:30] * cyraxjoe (~joe@2607:f0d0:1103:106:e::12c) has joined #jython
[23:47] <ahhughes> jimbaker: thanks for your response (many hours ago)... been alseep - its now morning here :)

Index

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