[New-bugs-announce] [issue22498] frozenset allows modification via -= operator

James Paget report at bugs.python.org
Thu Sep 25 19:26:56 CEST 2014


New submission from James Paget:

The operator -= modifies a frozenset (this should not be possible),
instead of signaling a TypeError.  Contrast with the += operator.

>>> f=frozenset([1,2])
>>> f
frozenset([1, 2])
>>> f -= frozenset([1])
>>> f
frozenset([2])
>>> f -= frozenset([2])
>>> f
frozenset([])
>>> f += frozenset([2])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +=: 'frozenset' and 'frozenset'
>>>

----------
components: Interpreter Core
messages: 227557
nosy: James.Paget
priority: normal
severity: normal
status: open
title: frozenset allows modification via -= operator
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22498>
_______________________________________


More information about the New-bugs-announce mailing list