arigato changed the topic of #pypy to: PyPy, the flexible snake (IRC logs: https://quodlibet.duckdns.org/irc/pypy/latest.log.html#irc-end ) | use cffi for calling C | mac OS and Fedora are not Windows
alexband has quit [Remote host closed the connection]
alexband has joined #pypy
alexband has quit [Ping timeout: 250 seconds]
lritter has quit [Ping timeout: 268 seconds]
lritter has joined #pypy
adamholmberg has joined #pypy
alexband has joined #pypy
alexband has quit []
Garen has quit [Read error: Connection reset by peer]
Garen has joined #pypy
demonimin has quit [Ping timeout: 272 seconds]
adamholmberg has quit [Remote host closed the connection]
adamholmberg has joined #pypy
adamholmberg has quit [Ping timeout: 246 seconds]
jcea has quit [Remote host closed the connection]
jcea has joined #pypy
sknebel has quit [Ping timeout: 252 seconds]
jcea has quit [Quit: jcea]
sknebel has joined #pypy
dddddd has quit [Remote host closed the connection]
lritter has quit [Ping timeout: 268 seconds]
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
forgottenone has joined #pypy
tayfun26 has joined #pypy
tayfun26 has quit [Quit: tayfun26]
jamesaxl has joined #pypy
hastake has quit [Ping timeout: 245 seconds]
hastake has joined #pypy
marvin has quit [Remote host closed the connection]
marvin has joined #pypy
Zaab1t has joined #pypy
jamesaxl has quit [Read error: Connection reset by peer]
marvin has quit [Remote host closed the connection]
jamesaxl has joined #pypy
marvin has joined #pypy
antocuni__ has joined #pypy
<energizer> fijal: what did you mean a while ago that class.__dict__ is special because it isn't code. why isn't it code?
<fijal> because it's a constant
<fijal> or not necesarilly constant, but a value that's not code
<fijal> there is no bulletproof way to compare it with something else
<energizer> fijal: in the same way that 123456789 is not code?
<fijal> yes, 123456789 is not code, but there is a good way to compare it
<fijal> we know (sort of) that 12 and 12 can be interchanged without much problem (not always in python, but we can assume always)
<energizer> fijal: inspect.getsource(my_class) ?
<fijal> that's clearly not enough
<fijal> what if class is generated using some decorators that download it's source from the internets?
demonimin has joined #pypy
<energizer> i see
<fijal> this is an extreme example, but it's usually not computable
<fijal> or more precisely - it's very hard to define something that is both working for a reasonable subset of python (enough to ship anything) but also at the same time not wrong
rubdos has quit [Ping timeout: 252 seconds]
forgottenone has quit [Ping timeout: 246 seconds]
<energizer> fijal: and i suppose just comparing the text of the .py files also isn't good enough, because of, i dunno, import hooks
forgottenone has joined #pypy
<fijal> well, import hooks are just a tip of the iceberg really
<fijal> generally speaking it's hard to decide what happens during import time, because any code can run
<fijal> it can depend on env variables for example
<fijal> or on the internet
<fijal> or on myriad of other things - it's very hard to decide that what you loaded it's exactly what was loaded previously
<fijal> it's not completely impossible to write a decent heuristic - but we found it very hard to do
<fijal> but the key here is to try to write those heuristics
antocuni__ has quit [Quit: Leaving]
<energizer> why isn't "all the installed code is textually the same" good enough?
antocuni__ has joined #pypy
antocuni__ has quit [Client Quit]
<energizer> for a heuristic
antocuni has joined #pypy
<antocuni> energizer: or simply: "class Foo: if random.choice([0,1]): def foo(self): return 42 else def foo(self): return 43"
<fijal> energizer: because loading the exact same code twice does not always create the same objects
<fijal> note that the heuristic can only have false negatives (code is actually the same, but the heuristic says "no"), while it's not allowed to have false positives
<fijal> also, to start with, you don't know if the textual code would find all the constants etc. in the same place
<fijal> because it contains imports which traverse paths at real time
<fijal> e.g. mercurial loads configuration at import time - this is probably a bad idea, but it means that JIT code will not be valid
rubdos has joined #pypy
<energizer> fijal: the decision about 'this class is the same as that class' must be made before import time?
<fijal> you can't do much before import time
<fijal> you have to decide "this imported class is the same as that other imported class"
<fijal> before import time it is indeed a bunch of text, but that's not very useful
<energizer> so a class will have some attributes you can compare, e.g. literals and methods (by source), and others that maybe you can't
rubdos has quit [Excess Flood]
<energizer> (after import)
rubdos has joined #pypy
<energizer> like, if a class has only pickleable attributes, you can check
<energizer> and even cloudpickle
<fijal> even that is too haphazard
<fijal> pickle assumes global names are the same and that's it
<fijal> it does not enforce anything
<fijal> but also you can't compare by source - inspect.getsource is not guaranteed to give you anything at all and if it gives you stuff its not guaranteed to be correct
<fijal> did you read what I said?
<energizer> yeah just linking for context
<fijal> the requirement to be always right is the problem
<antocuni> fijal: well, actually what energizer says it's not completely incorrect. At its core a class is just a thin wrapper around a __dict__ (plus __name__ and __bases__). The hard part is comparing the contents of the __dict__, in particular functions
<fijal> (or only allowing one kind of fails)
<energizer> if the textual source of a function matches and all the func.co_* match, what's left in deciding this is the same function?
<antocuni> energizer: the textual source is useless, the co_code is more important. But I can think of many ways things can subtly break if you go this route. E.g.: http://paste.openstack.org/show/736066/
<antocuni> are A and B the same class (apart the name)?
<energizer> antocuni: co_code says yes, you say no?
<fijal> energizer: what do you say about this: https://paste.pound-python.org/show/uwyELqtWYJkSBLm51aJ3/
<antocuni> well, you are the one who is proposing ways to compare classes, and I am the one who is trying to break it :)
<fijal> this is not how decorators work, but it does not matter, really
<antocuni> energizer: in particular: "A().foo.im_func is foo"
<antocuni> if you use "B", it gives you a different result
<antocuni> fijal: I say SyntaxError :)
<energizer> interesting, ill think about this, thanks! :)
<fijal> antocuni: psss
<energizer> fijal: did you mean to do that @translate at import time or at call time?
<fijal> energizer: the thing is it does not matter - you can write it both ways
<fijal> it's hard to decide because there are values out there (random dict) that might be different, but you have no way to tell
<fijal> there is no way to generally compare anything in python - yes, you can compare ints and stuff, but not more sophisticated values
dddddd has joined #pypy
Zaabtop has joined #pypy
xcm has quit [Read error: Connection reset by peer]
Zaab1t has quit [Ping timeout: 268 seconds]
Zaabtop is now known as Zaab1t
xcm has joined #pypy
Zaab1t has quit [Ping timeout: 268 seconds]
antocuni has quit [Ping timeout: 268 seconds]
Zaab1t has joined #pypy
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
sknebel has quit [Ping timeout: 250 seconds]
Zaab1t has quit [Quit: bye bye friends]
sknebel has joined #pypy
marky1991 has joined #pypy
jcea has joined #pypy
Rhy0lite has joined #pypy
adamholmberg has joined #pypy
abrown has joined #pypy
sknebel has quit [Ping timeout: 250 seconds]
sknebel has joined #pypy
<abrown> fijal, cfbolz: I mentioned last week that I had been working on an abstract model of meta-interpretation; are you still interested in taking a look?
antocuni has joined #pypy
<abrown> I do have a question about how quasi-immutable works; hopefully someone can answer. I have a class hierarchy of AST nodes, all annotated with `_immutable_ = True`. On a leaf node I believe I need to do something like `_immutable_fields = ['a', 'b', 'c?']` but RPython complains about not having the `_immutable_ = True` in a descendant. How could I specify a quasi-immutable on the leaf node without having to re-annotate the whole hierarchy with
<abrown> `_immutable_fields`?
<abrown> (The reason I think 'c' above needs to be quasi-immutable is that it is the top of a stack of linked objects that may change over time; I push an item on the stack and change 'c' to point to it.)
Zaab1t has joined #pypy
abrown has quit [Remote host closed the connection]
abrown has joined #pypy
marky1991 has quit [Ping timeout: 250 seconds]
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
adamholmberg has quit [Remote host closed the connection]
lritter has joined #pypy
adamholmberg has joined #pypy
abrown has quit [Ping timeout: 268 seconds]
<tos9> sending ^C on pypy startup sometimes doesn't kill the process
<tos9> I assume because random parts of python that are running are catching KeyboardInterrupt (or all exceptions) and so the ^C is interrupting random Python junk
<tos9> Obviously that's not good enough for a bug report and I assume it's unlikely to be fixable anyway since the stdlib is junk :/ so presumably that's just venting but yeah :(
jacob22__ has quit [Remote host closed the connection]
Zaab1t has quit [Quit: bye bye friends]
moei has joined #pypy
marky1991 has joined #pypy
Zaab1t has joined #pypy
froztbyte has quit [Ping timeout: 260 seconds]
froztbyte has joined #pypy
froztbyte has quit [Changing host]
froztbyte has joined #pypy
abrown has joined #pypy
marky1991 has quit [Read error: Connection reset by peer]
marky1991 has joined #pypy
antocuni has quit [Ping timeout: 250 seconds]
forgottenone has quit [Remote host closed the connection]
<cfbolz> abrown: we are mostly moving away from _immutable_ = True
<cfbolz> Just be explicit and always list the fields
bendlas has quit [Write error: Connection reset by peer]
<abrown> ok; if I write a function to automatically annotate the class hierarchy with the annotations they need, will the translation pick that stuff up?
<abrown> (I think I've seen that type of thing in PyPy somewhere?)
<cfbolz> abrown: yes, it will
<abrown> cool, thanks; any comments on quasi-immutability? how often can a reference change and still be quasi-immutable?
<simpson> As much as you like. QIs cause *invalidation* of JIT assumptions when they change, which is kind of like a deopt; the JIT will throw out the compiled code which had assumed the old value.
<cfbolz> Yep
<cfbolz> Basically a quasi immutable is only worth it if the value is constant long enough that you can generate machine code that depends on that value and then run that machine code often enough that the compilation costs are recuperated
<cfbolz> abrown: does that make sense?
bendlas has joined #pypy
marky1991 has quit [Read error: Connection reset by peer]
marky1991 has joined #pypy
<abrown> cfbolz, simpson: yup, makes sense; thanks
bendlas has quit [Remote host closed the connection]
Rhy0lite has quit [Quit: Leaving]
Zaab1t has quit [Ping timeout: 246 seconds]
bendlas has joined #pypy
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
jacob22__ has joined #pypy
marky1991 has quit [Read error: Connection reset by peer]
marky1991 has joined #pypy
moei has quit [Quit: Leaving...]
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
marky1991 has quit [Ping timeout: 246 seconds]
marky1991 has joined #pypy
marky1991 has quit [Read error: Connection reset by peer]
marky1991 has joined #pypy
adamholmberg has quit [Remote host closed the connection]
adamholmberg has joined #pypy
adamholmberg has quit [Remote host closed the connection]
adamholmberg has joined #pypy
adamholmberg has quit [Remote host closed the connection]
adamholmberg has joined #pypy
marky1991 has quit [Read error: Connection reset by peer]
marky1991 has joined #pypy
vstinner has left #pypy [#pypy]
adamholmberg has quit [Ping timeout: 250 seconds]
marky1991 has quit [Read error: Connection reset by peer]
adamholmberg has joined #pypy
adamholmberg has quit [Remote host closed the connection]
adamholmberg has joined #pypy
adamholmberg has quit [Ping timeout: 250 seconds]
demonimin has quit [Quit: bye]
adamholmberg has joined #pypy
antocuni has joined #pypy
demonimin has joined #pypy