[issue34042] Reference loss for local classes

2018-07-06 Thread Yury Selivanov
Yury Selivanov added the comment: Thank you for reporting the issue, Kay. And huge thanks to Antoine and Pablo for bisecting. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue34042] Reference loss for local classes

2018-07-06 Thread miss-islington
miss-islington added the comment: New changeset 127bd9bfd591c8ec1a97eb7f4037c8b884eef973 by Miss Islington (bot) in branch '3.7': bpo-34042: Fix dict.copy() to maintain correct total refcount (GH-8119) https://github.com/python/cpython/commit/127bd9bfd591c8ec1a97eb7f4037c8b884eef973 ---

[issue34042] Reference loss for local classes

2018-07-06 Thread miss-islington
Change by miss-islington : -- pull_requests: +7715 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue34042] Reference loss for local classes

2018-07-06 Thread Yury Selivanov
Yury Selivanov added the comment: New changeset 0b75228700e0077d8bf2636e74733389514b4b2f by Yury Selivanov in branch 'master': bpo-34042: Fix dict.copy() to maintain correct total refcount (GH-8119) https://github.com/python/cpython/commit/0b75228700e0077d8bf2636e74733389514b4b2f --

[issue34042] Reference loss for local classes

2018-07-06 Thread Yury Selivanov
Yury Selivanov added the comment: > If you could do what you often you, and make this what distributions like > Debian pull from, it would be good enough in terms of release for me, as it > blocks Nuitka tests from passing on them. I'm not sure what you mean by "what you often do". I'll push

[issue34042] Reference loss for local classes

2018-07-06 Thread Kay Hayen
Kay Hayen added the comment: Hello, so it's harmless and it explains the other reference counting issue, where a change in call convention could make a reference counting bug show or go away: codecs.open(TESTFN, encoding='cp949') This was showing it, where as codecs.open(TESTFN, "rb", 'cp949

[issue34042] Reference loss for local classes

2018-07-05 Thread Yury Selivanov
Yury Selivanov added the comment: > Agreed, if it was a real reference bug, the interpreter should crash before > the total reference count gets negative ;-) First thing I checked with Serhiy's script :) A PR with a fix: https://github.com/python/cpython/pull/8119 -- __

[issue34042] Reference loss for local classes

2018-07-05 Thread Yury Selivanov
Change by Yury Selivanov : -- keywords: +patch pull_requests: +7704 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-l

[issue34042] Reference loss for local classes

2018-07-05 Thread Antoine Pitrou
Antoine Pitrou added the comment: Agreed, if it was a real reference bug, the interpreter should crash before the total reference count gets negative ;-) -- ___ Python tracker __

[issue34042] Reference loss for local classes

2018-07-05 Thread Yury Selivanov
Yury Selivanov added the comment: This isn't a real reference bug, but rather a bug in total refs accountability. It seems that I missed the fact that we track refs to the keys table with a DK_INCREF macro. The new `clone_combined_dict` uses `memcpy` to clone the keys table (along with its

[issue34042] Reference loss for local classes

2018-07-05 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: @Antoine Wow, it seems that we both foundb0a7a037b8fde56b62f886d5188bced7776777b4 with one minute of difference :D I added Yuri to the noise list as is the author of that PR. -- ___ Python tracker

[issue34042] Reference loss for local classes

2018-07-05 Thread Antoine Pitrou
Antoine Pitrou added the comment: I've bisected myself and the culprit seems to be b0a7a037b8fde56b62f886d5188bced7776777b4 ("""bpo-31179: Make dict.copy() up to 5.5 times faster."""). -- nosy: +yselivanov ___ Python tracker

[issue34042] Reference loss for local classes

2018-07-05 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: I think I found it. After doing the bisect manually (as redirecting stdout/stderr) seems to affect somehow the test) I found commit b0a7a037b8fde56b62f886d5188bced7776777b4 as the culprit. Reverting this commit on the current master seem to solve the

[issue34042] Reference loss for local classes

2018-07-05 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: I investigated that commit but I cannot find anything :(. -- ___ Python tracker ___ ___ Py

[issue34042] Reference loss for local classes

2018-07-05 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: I ran git bisect with @Serhiy reproducer and it yielded commit 3929499914d47365ae744df312e16da8955c90ac as the first bad commit that has this problem. I did not look more into that but the bisect is reproducible (yields the same commit if you run it s

[issue34042] Reference loss for local classes

2018-07-05 Thread Kay Hayen
Kay Hayen added the comment: Just to confirm, this is also happening on Windows as well, with both 32 and 64 bits. -- ___ Python tracker ___ _

[issue34042] Reference loss for local classes

2018-07-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The simplest reproducer: import gc, sys for i in range(100): class A: pass del A c = gc.collect() del c print(sys.gettotalrefcount()) -- nosy: +pitrou, vstinner ___ Python tracker

[issue34042] Reference loss for local classes

2018-07-04 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- components: +Interpreter Core nosy: +serhiy.storchaka type: -> resource usage ___ Python tracker ___ __

[issue34042] Reference loss for local classes

2018-07-04 Thread Kay Hayen
New submission from Kay Hayen : I have a test in Nuitka, designed to detect reference counting problems with Python code. It basically takes a snapshot of the refcount, runs a function until it stabilizes, then says PASS, or else reports the last diff. Obviously for CPython it's supposed to p