]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
restore old *args approach for MutableDict.pop()
authorNils Philippsen <nils@tiptoe.de>
Tue, 28 Feb 2023 21:04:54 +0000 (16:04 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 4 Mar 2023 16:09:57 +0000 (11:09 -0500)
commit80b7c608835f1be5418d8ed567664654e8b583e3
treecb130762a03034df733954dedf2aa68f9196f88b
parentda70478eb2eafe9c76b836217371e029c3c820e3
restore old *args approach for MutableDict.pop()

The typing change in ba0e508141206efc55cdab91df21c1
changed the semantics of pop() and possibly setdefault() in order to
try working at runtime with a two-argument signature.  however
the implementation for this in cpython likely uses a strict `*args`
approach where the lack of the second parameter is explicit, rather
than matching to a constant.  Restore the old implementation inside
of a "not TYPE_CHECKING" block while keeping the type annotated forms
intact for typing only.

Fixed regression caused by typing added to ``sqlalchemy.ext.mutable`` for
:ticket:`8667`, where the semantics of the ``.pop()`` method changed such
that the method was non-working.  Pull request courtesy Nils Philippsen.

Fixes: #9380
Closes: #9381
Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9381
Pull-request-sha: fd903ce1b949d2af26ceb6c2159ad84aab007f3d

Change-Id: I213e52f51a795801aacf05307e38cc8c89b54e12
doc/build/changelog/unreleased_20/9380.rst [new file with mode: 0644]
lib/sqlalchemy/ext/mutable.py
test/ext/test_mutable.py