[issue33217] x in enum.Flag member is True when x is not a Flag

2019-05-08 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

A test for this has been added for IntFlag so I think it must have been on 
purpose : 
https://github.com/python/cpython/commit/9430652535f88125d8003f342a8884d34885d876#diff-d57e55a3bb4873aec10786e531a88947R2386

--
nosy: +remi.lapeyre

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33217] x in enum.Flag member is True when x is not a Flag

2019-05-08 Thread Peter Tönz

Peter Tönz  added the comment:

I use python 3.8.0a3 to make our testframework ready for the future.

Is it volitional that the Expression "if int in IntEnum:" raise also a 
TypeError?

--
nosy: +Peter Tönz

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33217] x in enum.Flag member is True when x is not a Flag

2018-09-10 Thread Ethan Furman


Ethan Furman  added the comment:

Thank you, Rahul!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33217] x in enum.Flag member is True when x is not a Flag

2018-09-10 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 9430652535f88125d8003f342a8884d34885d876 by Ethan Furman (Rahul 
Jha) in branch 'master':
bpo-33217: Raise TypeError for non-Enum lookups in Enums (GH-6651)
https://github.com/python/cpython/commit/9430652535f88125d8003f342a8884d34885d876


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33217] x in enum.Flag member is True when x is not a Flag

2018-04-30 Thread Rahul Jha

Change by Rahul Jha :


--
pull_requests: +6347
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33217] x in enum.Flag member is True when x is not a Flag

2018-04-28 Thread Ethan Furman

Ethan Furman  added the comment:

Rahul Jha, sure, go ahead!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33217] x in enum.Flag member is True when x is not a Flag

2018-04-28 Thread Rahul Jha

Rahul Jha  added the comment:

Hi Ethan,

The only thing which is left is to change the Deprecation Warning to raise a 
`TypeError` and alter the tests accordingly.

Seeing that most of the work for the issue has already been done, can I take it 
forward from here on wards, please?

--
nosy: +RJ722

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33217] x in enum.Flag member is True when x is not a Flag

2018-04-12 Thread Ethan Furman

Ethan Furman  added the comment:

DeprecationWarning is in 3.7, now need to raise TypeError in 3.8.

--
stage: patch review -> needs patch
versions:  -Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33217] x in enum.Flag member is True when x is not a Flag

2018-04-11 Thread Ethan Furman

Ethan Furman  added the comment:


New changeset 3715176557cf87925c8f89b98939c7daf9bf48e2 by Ethan Furman in 
branch '3.7':
[3.7] bpo-33217: deprecate non-Enum lookups in Enums (GH-6392)
https://github.com/python/cpython/commit/3715176557cf87925c8f89b98939c7daf9bf48e2


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33217] x in enum.Flag member is True when x is not a Flag

2018-04-05 Thread Ethan Furman

Change by Ethan Furman :


--
keywords: +patch
pull_requests: +6100
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33217] x in enum.Flag member is True when x is not a Flag

2018-04-04 Thread Ethan Furman

Ethan Furman  added the comment:

Stepping back slightly, it is more general to say that str, and in certain 
other cases dict and set (and possibly others) will raise instead of return 
False when it is impossible for the target type to ever hold the checked-for 
type.  A couple examples of what will raise:

1 in 'hello'   # integers will never be in a string
list() in dict()   # dict keys must be hashable (and lists are not)

So, yes, at least for pure Enums and Flags, raising TypeError when a 
non-Enum/Flag is checked for would be appropriate.

Since there may be code currently relying on always getting True/False, though, 
a deprecation period is called for.  I'll see if I can get that into 3.7.

--
title: x in enum.Flag() is True when x is no Flag -> x in enum.Flag member is 
True when x is not a Flag

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com