Skip to content

SopelIdentifierMemory pop() does not cast #2524

@half-duplex

Description

@half-duplex

Description

SopelIdentifierMemory automatically casts strings to Identifiers when accessing contents with mem["foo"], but pop() doesn't seem to.

Reproduction steps

>>> from sopel.tools import Identifier, SopelIdentifierMemory
>>> mem = SopelIdentifierMemory()
>>> mem["Foo"] = "bar"
>>> mem["Foo"]
'bar'
>>> mem.pop("Foo")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 'Foo'
>>> mem.pop(Identifier("Foo"))
'bar'

Note the capital F in "Foo" - hashing Identifier("foo") and "foo" seems to match, but not Identifier("Foo") and "Foo".

Expected behavior

pop() performs the same cast as mem["Foo"] and works.

Sopel version

271b306

Installation method

pip install

Python version

3.11.5

Metadata

Metadata

Assignees

Labels

BugThings to squish; generally used for issuesMedium Priority

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions