Issue 31905: IPv4Networkcontains raises exception on None
Created on 2017-10-30 20:56 by Gerard Weatherby, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| ne.py | Gerard Weatherby, 2017-10-30 20:56 | SCCE | ||
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 4180 | closed | python-dev, 2017-10-30 21:08 | |
| Messages (4) | |||
|---|---|---|---|
| msg305250 - (view) | Author: Gerard Weatherby (Gerard Weatherby) * | Date: 2017-10-30 20:56 | |
Given a IPvNetwork network if x in network: ... raises an AttributeError instead of returning False. |
|||
| msg305251 - (view) | Author: R. David Murray (r.david.murray) * ![]() |
Date: 2017-10-30 21:19 | |
It is not obvious that this is a bug. Why should None be a valid value for 'in network'? |
|||
| msg305262 - (view) | Author: Eric V. Smith (eric.smith) * ![]() |
Date: 2017-10-31 00:19 | |
I agree with David. And since the PR says "not other", then it makes even less sense, since it's checking for any False-y object. I recommend closing this as "not a bug". |
|||
| msg305275 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2017-10-31 07:07 | |
I concur. IPvNetwork is not a general purposed collection. And even genera purposed collections can have restrictions on the arguments of "in". E.g.:
>>> [] in {}
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'list'
Similar issue already was raised (maybe not for IPvNetwork, but for other class supporting the "in" operator) and was closed with the same arguments.
|
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:53 | admin | set | github: 76086 |
| 2017-10-31 07:07:23 | serhiy.storchaka | set | resolution: fixed -> not a bug |
| 2017-10-31 07:07:05 | serhiy.storchaka | set | status: open -> closed nosy:
+ serhiy.storchaka resolution: fixed |
| 2017-10-31 00:19:32 | eric.smith | set | nosy:
+ eric.smith messages: + msg305262 |
| 2017-10-30 21:19:28 | r.david.murray | set | nosy:
+ r.david.murray messages: + msg305251 |
| 2017-10-30 21:08:24 | python-dev | set | keywords:
+ patch stage: patch review pull_requests: + pull_request4150 |
| 2017-10-30 20:56:08 | Gerard Weatherby | create | |
