[issue44116] The _csv module can't be garbage-collected after _csv.register_dialect is called

2021-05-12 Thread Dong-hee Na
Change by Dong-hee Na : -- nosy: +corona10 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44116] The _csv module can't be garbage-collected after _csv.register_dialect is called

2021-05-12 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > I know that work with heap types have been halted by the SC, as you've > pointed out a couple of times already, but shouldn't this heap type issue be > fixed before 3.10 is released? It should absolutely be fixed for all types that have been

[issue44116] The _csv module can't be garbage-collected after _csv.register_dialect is called

2021-05-12 Thread Erlend E. Aasland
Erlend E. Aasland added the comment: Pablo, as mentioned in bpo-42972, this is an issue with all heap allocated types; it is not _csv specific. I know that work with heap types have been halted by the SC, as you've pointed out a couple of times already, but shouldn't this heap type issue be

[issue44116] The _csv module can't be garbage-collected after _csv.register_dialect is called

2021-05-12 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue44116] The _csv module can't be garbage-collected after _csv.register_dialect is called

2021-05-12 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: New changeset ba260acb22f3a6de434dc7a159ddb94a6a8c9b7c by Miss Islington (bot) in branch '3.10': bpo-44116: Add GC support to _csv heap types (GH-26074) (GH-26081) https://github.com/python/cpython/commit/ba260acb22f3a6de434dc7a159ddb94a6a8c9b7c

[issue44116] The _csv module can't be garbage-collected after _csv.register_dialect is called

2021-05-12 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 2.0 -> 3.0 pull_requests: +24720 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26081 ___ Python tracker

[issue44116] The _csv module can't be garbage-collected after _csv.register_dialect is called

2021-05-12 Thread Erlend E. Aasland
Erlend E. Aasland added the comment: Yeah, that helped a lot: test_csv leaked [487, 487, 487, 487] memory blocks, sum=1948 Thanks! :) -- ___ Python tracker ___

[issue44116] The _csv module can't be garbage-collected after _csv.register_dialect is called

2021-05-12 Thread Erlend E. Aasland
Erlend E. Aasland added the comment: > Changes to _csv.Error should not be necessary, there everything is handled by > the superclass. Got it; thanks. -- ___ Python tracker

[issue44116] The _csv module can't be garbage-collected after _csv.register_dialect is called

2021-05-12 Thread Petr Viktorin
Petr Viktorin added the comment: Changes to _csv.Error should not be necessary, there everything is handled by the superclass. -- stage: patch review -> ___ Python tracker

[issue44116] The _csv module can't be garbage-collected after _csv.register_dialect is called

2021-05-12 Thread Erlend E. Aasland
Erlend E. Aasland added the comment: Also, for some reason two first iterations of the reproducer prints 2 less ref counts. -- ___ Python tracker ___

[issue44116] The _csv module can't be garbage-collected after _csv.register_dialect is called

2021-05-12 Thread Erlend E. Aasland
Erlend E. Aasland added the comment: I don't understand this. After applying PR-26074, test_csv now leaks memory/refs: $ ./python.exe -m test -R : test_csv 0:00:00 load avg: 1.18 Run tests sequentially 0:00:00 load avg: 1.18 [1/1] test_csv beginning 9 repetitions 123456789 . test_csv

[issue44116] The _csv module can't be garbage-collected after _csv.register_dialect is called

2021-05-12 Thread Erlend E. Aasland
Change by Erlend E. Aasland : -- pull_requests: +24714 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26074 ___ Python tracker ___

[issue44116] The _csv module can't be garbage-collected after _csv.register_dialect is called

2021-05-12 Thread Petr Viktorin
Petr Viktorin added the comment: The urllib.request one was caused by _hashlib, see GH-26072. -- stage: patch review -> ___ Python tracker ___

[issue44116] The _csv module can't be garbage-collected after _csv.register_dialect is called

2021-05-12 Thread Erlend E. Aasland
Erlend E. Aasland added the comment: Sure, I’ll do it after dinner :) -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue44116] The _csv module can't be garbage-collected after _csv.register_dialect is called

2021-05-12 Thread Petr Viktorin
Petr Viktorin added the comment: *facepalm* Yes, that's it. If you have the time now, could you send he PR? -- ___ Python tracker ___

[issue44116] The _csv module can't be garbage-collected after _csv.register_dialect is called

2021-05-12 Thread Erlend E. Aasland
Erlend E. Aasland added the comment: I created a quick-and-dirty patch. I can clean it up and make it into a PR if you want. -- ___ Python tracker ___

[issue44116] The _csv module can't be garbage-collected after _csv.register_dialect is called

2021-05-12 Thread Erlend E. Aasland
Erlend E. Aasland added the comment: Adding GC to _csv types: $ cat import sys import gc for i in range(10): import csv del sys.modules['_csv'] del sys.modules['csv'] del csv gc.collect() print(sys.gettotalrefcount()) $ ./python.exe bug.py 73164 73164 73166 73166

[issue44116] The _csv module can't be garbage-collected after _csv.register_dialect is called

2021-05-12 Thread Erlend E. Aasland
Change by Erlend E. Aasland : Added file: https://bugs.python.org/file50038/gc.diff ___ Python tracker ___ ___ Python-bugs-list mailing

[issue44116] The _csv module can't be garbage-collected after _csv.register_dialect is called

2021-05-12 Thread Erlend E. Aasland
Erlend E. Aasland added the comment: Could it be that the _csv heap types are not garbage collected? Ref. bpo-42972. -- nosy: +erlendaasland ___ Python tracker ___

[issue44116] The _csv module can't be garbage-collected after _csv.register_dialect is called

2021-05-12 Thread Petr Viktorin
Change by Petr Viktorin : -- keywords: +patch pull_requests: +24709 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26068 ___ Python tracker ___

[issue44116] The _csv module can't be garbage-collected after _csv.register_dialect is called

2021-05-12 Thread Petr Viktorin
Petr Viktorin added the comment: Hm, a similar thing apparently happens with urllib.request. -- ___ Python tracker ___ ___

[issue44116] The _csv module can't be garbage-collected after _csv.register_dialect is called

2021-05-12 Thread Petr Viktorin
New submission from Petr Viktorin : After `_csv.register_dialect` is called, the csv module is alive even after it's removed from sys.modules. It should be garbage-collected. (It's not that big a deal: unloading _csv isn't something users should do. But it might be hiding a deeper issue.)