01:45
lesshaste has joined #pypy
01:45
leshaste has quit [Read error: Connection reset by peer]
03:29
Flawed_Logic has left #pypy [Leaving]
05:19
jinsun has quit [Ping timeout: 245 seconds]
07:26
<
graingert >
which branch should I PR into if I have a patch for both pypy2.7 and pypy3.10 - does it go into main and get backported or branch/default?
07:32
<
graingert >
and is there a way to benchmark a PR?
08:34
<
cfbolz >
goes to main
08:35
<
cfbolz >
graingert: then we merge forward to py3.10
08:36
<
cfbolz >
graingert: benchmarking a pr is possible, unfortunately only for branches on the main repo :-(
08:37
<
cfbolz >
but if you tell me, I'm happy to kick off a run
08:40
<
graingert >
it's a bit nasty change
08:44
<
cfbolz >
graingert: I see. does it help?
08:44
<
graingert >
it means gc.get_referrers doesn't make a new referrer and return it
08:47
<
graingert >
another option is to reverse scope_w and use `def scopenext(self): return "scope_w.pop()"`
08:48
<
cfbolz >
both feel pretty heavy handed I must say
08:53
<
cfbolz >
graingert: how about the following idea: in the get_referrers implementation we make a copy of the scope_w list and then zero the original one?
08:54
<
graingert >
get_referrers would need it's own gateway?
08:55
<
cfbolz >
sorry, I meant the args_w list
08:56
<
cfbolz >
I can quickly try it
08:57
<
graingert >
get_referrers doesn't see the scope_w list it gets a copy of the tuple as self.behavior(space, space.fixedview(scope_w[0]))
08:58
<
graingert >
Then scope_w lives in the Activation._run frame and the BuiltinCode.funcrun_obj frames
09:00
<
graingert >
That doesn't hold a reference to the tuple
09:02
<
cfbolz >
no, but the tuple holds a reference to it
09:18
<
cfbolz >
and I would prefer something along the lines, because it's a lot less invasive
09:26
<
cfbolz >
graingert: did you manage to write a unit test for this problem, by chance?
09:30
<
graingert >
I've been testing it manually in the interactive interpreter
09:31
<
graingert >
so mutating args_w mutates the tuple?
09:33
<
graingert >
Eg args_w is W_TupleObject.wrappeditems so clearing it drops the ref from the tuple nice
09:35
<
cfbolz >
it's a bit weird to mutate the tuple
09:35
<
cfbolz >
but it's unreachable at this point
09:36
<
cfbolz >
graingert: do you want to do the pr with this approach?
09:55
<
graingert >
foo() returns a frame and that tuple
09:57
<
cfbolz >
graingert: that's because the A instance is still on the evaluation stack of the frame until the function get_referrers returns
10:10
<
graingert >
That feels like it might keep objects alive longer than it should
10:27
<
cfbolz >
graingert: maybe, but not doing so would make every single function call slower
11:07
[Arfrever] has quit [Read error: Connection reset by peer]
11:08
[Arfrever] has joined #pypy
11:13
[Arfrever] has quit [Read error: Connection reset by peer]
11:24
[Arfrever] has joined #pypy
13:17
lesshaste has quit [Remote host closed the connection]
13:17
lesshaste has joined #pypy
13:41
otisolsen70 has joined #pypy
13:42
otisolsen70 has quit [Remote host closed the connection]
13:43
otisolsen70 has joined #pypy
16:38
otisolsen70 has quit [Quit: Leaving]
16:50
<
graingert >
cfbolz: why would it be slower?
17:20
jinsun has joined #pypy
17:26
<
cfbolz >
graingert: dropvalues costs some time, right? it has to zero the stack etc.
17:29
<
cfbolz >
do you have a concrete usecase where the longer lifetimes are noticeable?
17:36
<
graingert >
dropvalues is called the same number of times in my commit
17:38
<
graingert >
cfbolz: I can't think of any examples it's just a distinct difference to how cpython behaves
17:39
<
cfbolz >
sure, but thats really not fixable at all, because the root cause is us using a GC, which will free objects much later anyway
17:40
<
cfbolz >
cpython is moving towards more flexibility in that regard too, with eg deferred refcounting coming up eventually
17:41
<
graingert >
But it's a problem if you move a variable into a function, and say that's the rest of your program and it deletes the object passed in
17:42
<
graingert >
Later is fine, this issue results in stuff never getting collected
17:42
<
graingert >
Consider
17:44
<
graingert >
The file contents stick around for the full rest_of_program()
17:45
<
cfbolz >
in this case v is collectable after the del by pypy
17:47
<
graingert >
It's not collectable because main incorrectly owns it
17:50
<
cfbolz >
hmmm, are you 100% sure cpython doesnt do the same?
17:53
ztrawhcse has quit [Read error: Connection reset by peer]
17:53
ztrawhcse has joined #pypy
18:07
jinsun has quit [Read error: Connection reset by peer]
18:10
<
graingert >
cfbolz: for pypy you can add a callback that sets a nonlocal flag, then run `while flag: gc.collect()` and it should terminate
18:42
Dejan has quit [Quit: Leaving]
19:51
lesshaste has quit [Remote host closed the connection]
19:51
lesshaste has joined #pypy