example-code-2e icon indicating copy to clipboard operation
example-code-2e copied to clipboard

fix: enhance missing methods to handle missing keys more explicitly i…

Open t4m4k0ty4 opened this issue 5 months ago • 0 comments

Description

This PR improves the implementation of missing methods across several mapping subclasses to ensure safer and more predictable behavior when attempting to access keys in a case-insensitive manner.

Problem

In the original version, calls to self[_upper(key)] were made without checking if the transformed key actually exists. This could result in unhandled KeyErrors or unintended recursion, especially in dictionary-like structures where missing is automatically called upon a missing key.

Impact of my solution

This change enhances code clarity and error safety, making the behavior of custom mappings more robust and closer to Python’s expectations for missing.

t4m4k0ty4 avatar Jul 12 '25 07:07 t4m4k0ty4