Skip to content

Use suppress from contextlib#535

Merged
emcek merged 6 commits intomasterfrom
with_suppress
Jan 30, 2026
Merged

Use suppress from contextlib#535
emcek merged 6 commits intomasterfrom
with_suppress

Conversation

@emcek
Copy link
Owner

@emcek emcek commented Jan 30, 2026

Description

Replace try/except with suppress:

try:
    del cfg[old_name]
except KeyError:
    pass

with this:

from contextlib import suppress

with suppress(KeyError):
    del cfg[old_name]

@emcek emcek added this to the Release 3.8.0 milestone Jan 30, 2026
@emcek emcek self-assigned this Jan 30, 2026
@emcek emcek added the internal Internal changes label Jan 30, 2026
@sonarqubecloud
Copy link

@coveralls
Copy link

Coverage Status

coverage: 97.517% (+0.1%) from 97.401%
when pulling daf5e7b on with_suppress
into 92ab3f7 on master.

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 30, 2026

Merging this PR will degrade performance by 13.06%

❌ 1 regressed benchmark
✅ 370 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation test_get_gkey_as_dict_key 94.5 µs 108.7 µs -13.06%

Comparing with_suppress (daf5e7b) with master (92ab3f7)

Open in CodSpeed

@emcek emcek merged commit c2ba66e into master Jan 30, 2026
28 checks passed
@emcek emcek deleted the with_suppress branch January 30, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Internal changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants