[issue27607] Enums never match if imported from another file

2016-07-24 Thread Ethan Furman
Ethan Furman added the comment: Oh, forgot to mention I also tried testing as just 'main.py' from inside the test directory (that's what accounted for one of the two error messages). -- ___ Python tracker

[issue27607] Enums never match if imported from another file

2016-07-24 Thread Ethan Furman
Ethan Furman added the comment: Sylvia, if you have any control over the name of your zip files, please use something shorter. ;) The files inside are a 'main.py' and a 'module.py' -- notice there is no '__main__.py'. So it can't be executed as 'python3 -m blahblah'. I tried renaming

[issue27607] Enums never match if imported from another file

2016-07-24 Thread Sylvia van Os
Sylvia van Os added the comment: Importing it from a third module indeed works without issues and makes both isinstance() calls return True, yes. -- ___ Python tracker

[issue27607] Enums never match if imported from another file

2016-07-24 Thread Raymond Hettinger
Raymond Hettinger added the comment: I left it open so that Ethan would get a chance to see anything related to Enum. -- nosy: +rhettinger ___ Python tracker

[issue27607] Enums never match if imported from another file

2016-07-24 Thread R. David Murray
R. David Murray added the comment: Certainly reporting it is fine, if nothing else it gives a record for someone else searching for the same problem. I'm not certain why Raymond left the issue open, so I'm not closing it myself :) -- ___ Python

[issue27607] Enums never match if imported from another file

2016-07-24 Thread Sylvia van Os
Sylvia van Os added the comment: For what it's worth, I am not opposed to having this issue closed. As I am new to reporting anything on the Python issue tracker and was uncertain on how relevant the PEP in question was, I figured it would be better to report this anyway just in case.

[issue27607] Enums never match if imported from another file

2016-07-24 Thread R. David Murray
R. David Murray added the comment: This is a consequence of the way __main__ works. You actually have two separate instances of the Enum class. If there is a fix for this it would be that PEP, so I'm not sure there is any point in keeping this issue open. -- nosy: +r.david.murray

[issue27607] Enums never match if imported from another file

2016-07-24 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> ethan.furman ___ Python tracker ___

[issue27607] Enums never match if imported from another file

2016-07-24 Thread Brett Cannon
Changes by Brett Cannon : -- nosy: +ethan.furman ___ Python tracker ___ ___

[issue27607] Enums never match if imported from another file

2016-07-24 Thread Sylvia van Os
New submission from Sylvia van Os: If main imports another file, and this file imports an Enum class from main, isinstance will return false for Enum variables set in this file, causing the Enums to never match. A proof of concept is added as a zip. I thank Kwpolska for simplifying my