[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-30 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: test_grammar also needed a fix. It has been updated to use import_helper.import_fresh_module in bpo-43995 (GH-25764). -- nosy: +erlendaasland ___ Python tracker

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-30 Thread Larry Hastings
Larry Hastings added the comment: Ah, I see. So it wasn't a Windows thing, it was a "we run the test multiple times and that particular test assumed it was only run once" thing. And reflink testing is guaranteed to run every test multiple times. --

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-30 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > So I'm still puzzled about why that test worked on POSIX and failed on Windows I was able to reproduce it in my MacOS machine (maybe also it reproduced on Linux). The problem is that when you run with -R, the test runs several times and the import

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-30 Thread Larry Hastings
Larry Hastings added the comment: Obviously the original assertion failure ("AssertionError: False is not true") wasn't caused by the refleaks. So I'm still puzzled about why that test worked on POSIX and failed on Windows. I admit I was pulling some wacky import shenanigans in the test,

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

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

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-30 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: New changeset e374a40afa09be728b01653a06c9febfad9c9c50 by Pablo Galindo in branch 'master': bpo-43901: Fix refleaks in test_module (GH-25754) https://github.com/python/cpython/commit/e374a40afa09be728b01653a06c9febfad9c9c50 --

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-30 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: I made a fix for everything in https://github.com/python/cpython/pull/25754. Could you review it? -- ___ Python tracker ___

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-30 Thread Larry Hastings
Larry Hastings added the comment: You want a separate PR for the refleak fix, or should I roll them both up into one? -- ___ Python tracker ___

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-30 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > Eek! I swear I did a refleak check and got a clean bill of health. Again, > sorry about this! No problem at all! I'm sure we can fix this on time :) Opened https://github.com/python/cpython/pull/25754 for the refleaks --

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-30 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- pull_requests: +2 pull_request: https://github.com/python/cpython/pull/25754 ___ Python tracker ___

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-30 Thread Larry Hastings
Larry Hastings added the comment: Eek! I swear I did a refleak check and got a clean bill of health. Again, sorry about this! -- ___ Python tracker ___

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-30 Thread Larry Hastings
Change by Larry Hastings : -- pull_requests: +24442 stage: resolved -> patch review pull_request: https://github.com/python/cpython/pull/25752 ___ Python tracker ___

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-30 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: >> Why would it fail on Windows? It fails on all refleak buildbots. To reproduce: % ./configure --with-pydebug -C && make -j -s % ./python.exe -m test test_module -R : -- ___ Python tracker

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-30 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: Oh, actually is workse because commenting out the test shows refleaks: ㋹ ./python.exe -m test test_module -R : 0:00:00 load avg: 5.03 Run tests sequentially 0:00:00 load avg: 5.03 [1/1] test_module beginning 9 repetitions 123456789 . test_module

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-30 Thread Larry Hastings
Larry Hastings added the comment: Gee whiz! Sorry about that. I swear, it works fine on my machine. I'll incorporate import_helper.import_fresh_module helper into the test as you suggest, and once I get it to work I'll send you a PR. I don't know how to test fixing this failure, though,

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-30 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: I think that test_annotations_are_created_correctly should use the import_helper.import_fresh_module helper -- ___ Python tracker

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-30 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- priority: normal -> release blocker ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-30 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: Unfortunately commit 2f2b69855d6524e15d12c15ddc0adce629e7de84 has broken the buildbots: == FAIL: test_annotations_are_created_correctly (test.test_module.ModuleTests)

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-29 Thread Larry Hastings
Larry Hastings added the comment: Thanks for your feedback and reviews, everybody! Python just got an eensy teensy tiny bit better. -- assignee: -> larry resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-29 Thread Larry Hastings
Larry Hastings added the comment: New changeset 2f2b69855d6524e15d12c15ddc0adce629e7de84 by larryhastings in branch 'master': bpo-43901: Lazy-create an empty annotations dict in all unannotated user classes and modules (#25623)

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-27 Thread Jelle Zijlstra
Jelle Zijlstra added the comment: For what it's worth, I checked grep.app and found only one usage of del on __annotations__, in a test suite: https://github.com/go-python/gpython/blob/master/py/tests/function.py#L82. Changing its behavior seems very low risk. -- nosy: +Jelle

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-27 Thread Larry Hastings
Larry Hastings added the comment: I think the PR is in good shape. If anybody has the time for a review, I'd appreciate it! -- ___ Python tracker ___

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-26 Thread Kubilay Kocak
Change by Kubilay Kocak : -- components: +Interpreter Core -FreeBSD nosy: -koobs ___ Python tracker ___ ___ Python-bugs-list

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-26 Thread ANDRZEJ J.
Change by ANDRZEJ J. : -- components: +FreeBSD -Interpreter Core nosy: +kokik, koobs ___ Python tracker ___ ___

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-25 Thread Larry Hastings
Change by Larry Hastings : -- keywords: +patch pull_requests: +24322 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/25623 ___ Python tracker

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-24 Thread Guido van Rossum
Guido van Rossum added the comment: I think "no user-visible changes" is a pipe dream. Deleting __annotations__ seems fairly pointless so I don't mind changes that are only visible when you do that. -- ___ Python tracker

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-24 Thread Larry Hastings
Larry Hastings added the comment: > Functions don't store __annotations__ in their __dict__, it is a > separate slot named func_annotations (see funcobject.c). I guess > that's because the __dict__ is purely for user-defined function > attributes. I brought up functions because I'm now

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-24 Thread Guido van Rossum
Guido van Rossum added the comment: So, honestly I don't understand what your concern with the lazy approach is. Was your design based on having a bit in the class/module object (outside its __dict__) saying "I already lazily created one"? Or am I missing something? Also, I'll stop going on

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-24 Thread Guido van Rossum
Guido van Rossum added the comment: Functions don't store __annotations__ in their __dict__, it is a separate slot named func_annotations (see funcobject.c). I guess that's because the __dict__ is purely for user-defined function attributes. But perhaps for classes the C equivalent of this

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-24 Thread Larry Hastings
Larry Hastings added the comment: Hmm. Sorry for the stream-of-consciousness thought process here, but this approach adds wrinkles too. Function objects from the very beginning have lazy-created their annotations dict if it's not set. Which means this works fine: while True:

[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules

2021-04-24 Thread Larry Hastings
Change by Larry Hastings : -- title: Add an empty annotations dict to all unannotated classes and modules -> Lazy-create an empty annotations dict in all unannotated user classes and modules ___ Python tracker