[issue30545] Enum equality across modules: comparing objects instead of values

2018-11-16 Thread Sebastian Höfer
Sebastian Höfer added the comment: I ran into the same issue and while I see that this is not a bug I would suggest that this behaviour at least deserves a warning in the documentation under https://docs.python.org/3/library/enum.html#comparisons This unexpected behaviour can not only occur

[issue30545] Enum equality across modules: comparing objects instead of values

2018-08-12 Thread Ethan Furman
Ethan Furman added the comment: What you have discovered is not Enum specific, but in fact can happen with any module (as stated in my first comment in this bug report). Maybe these SO question will help: https://stackoverflow.com/q/2489601/208880 https://stackoverflow.com/a/4798648/208880

[issue30545] Enum equality across modules: comparing objects instead of values

2018-08-12 Thread Markus Wegmann
Markus Wegmann added the comment: Hi Ethan > Your Enum example in flawless is not an IntEnum, so the error (unable to add > an integer to None) seems entirely unrelated. The TypeError is just a consequence of the faulty Enum identity comparison some lines before. I mentioned the TypeError

[issue30545] Enum equality across modules: comparing objects instead of values

2018-08-11 Thread Ethan Furman
Ethan Furman added the comment: Markus Wegmann said: > In the appendix, you find a toy project with similar structure, which > in > contrast to `flora_tools` works flawlessly. I appreciate your attempt to reproduce the problem, but since you weren't able to, the issue

[issue30545] Enum equality across modules: comparing objects instead of values

2018-08-11 Thread Markus Wegmann
Markus Wegmann added the comment: Hi there! I came as well in contact with this kind of bug. Sadly, I could not replicate it with a simplified toy example. You can experience the bug, if checkout https://github.com/Atokulus/flora_tools/tree/56bb17ea33c910915875214e916ab73f567b3b0c and run

[issue30545] Enum equality across modules: comparing objects instead of values

2017-06-08 Thread Ethan Furman
Ethan Furman added the comment: No test code has been provided, so lacking any evidence of this problem I am closing this issue. Do not reopen without testable code to show the failure. -- resolution: -> not a bug stage: test needed -> resolved status: open -> closed

[issue30545] Enum equality across modules: comparing objects instead of values

2017-06-05 Thread Adrian Wan
Changes by Adrian Wan : -- nosy: +adrianwan2 status: pending -> open ___ Python tracker ___

[issue30545] Enum equality across modules: comparing objects instead of values

2017-06-03 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- status: open -> pending ___ Python tracker ___

[issue30545] Enum equality across modules: comparing objects instead of values

2017-06-02 Thread Ethan Furman
Ethan Furman added the comment: If your example code is the same as the code in the SO problem, then my previous points stand. According to the plain-English description you provided the comparison would succeed, so if you have example code which: - doesn't involve ModuleA being the __main__

[issue30545] Enum equality across modules: comparing objects instead of values

2017-06-02 Thread R. David Murray
R. David Murray added the comment: Can you provide actual code that demonstrates the issue you are talking about? -- nosy: +r.david.murray versions: -Python 2.7 ___ Python tracker

[issue30545] Enum equality across modules: comparing objects instead of values

2017-06-02 Thread Madhav Datt
Madhav Datt added the comment: Thanks a lot for those points Ethan. I feel I haven't done a very good job of explaining the bug, but let me use an example. Let's say we have an Enum called MyEnum, which is in a Python module called ModuleA. ModuleB imports ModuleA, and ModuleC imports both,

[issue30545] Enum equality across modules: comparing objects instead of values

2017-06-02 Thread Ethan Furman
Ethan Furman added the comment: Two points: - Python 2.7 was the version marked, but 2.7 does not come with Enum (wasn't introduced until 3.4 -- the third-party backport does work on 2.7) - the problem in the SO question is not caused by Enum, but by re-importing a module under a

[issue30545] Enum equality across modules: comparing objects instead of values

2017-06-02 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> ethan.furman nosy: +ethan.furman ___ Python tracker ___

[issue30545] Enum equality across modules: comparing objects instead of values

2017-06-01 Thread Madhav Datt
New submission from Madhav Datt: The problem is described with an example in this StackOverflow question (https://stackoverflow.com/questions/26589805/python-enums-across-modules). Like in C and other languages, I would expect Enum equality to work across modules and not compare enum