[issue47136] The variable __module__ in the class body getting an undesirable value from __prepare__ of the metaclass

2022-04-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: It would be nice if the class creation process was documented a bit better. Here is my experiment to see what is going on: ``` # the global `__name__` is normally the module's name. __name__ = "something" class Meta_default_prepare(type): def

[issue47136] The variable __module__ in the class body getting an undesirable value from __prepare__ of the metaclass

2022-04-06 Thread Takuo Matsuoka
Takuo Matsuoka added the comment: Thank you Ethan for your comments. Sure, I was not familiar with how you measure the magnitude of the consequences. The code in my own work was of the kind of the generic example I gave, but I have abandoned the approach, and don't seem able to find it any

[issue47136] The variable __module__ in the class body getting an undesirable value from __prepare__ of the metaclass

2022-04-05 Thread Ethan Furman
Ethan Furman added the comment: You are using the same generic example -- it does show the issue you are concerned with, but offers no rational for why we should "fix" it -- in other words, we cannot tell if it's actually broken. Please provide an example of code you are actually using -- a

[issue47136] The variable __module__ in the class body getting an undesirable value from __prepare__ of the metaclass

2022-04-05 Thread Takuo Matsuoka
Takuo Matsuoka added the comment: Thank you Ethan for reopening this issue and closing the other one. Here is a description of a more specific issue, containing a more reasonable example. I've changed the title of the issue to a more appropriate one accordingly. Context --- Some classes