Repository navigation
Add 14 leaky-abstraction pitfalls (#60–#73), 100% example coverage, and linter guardrails - #5
Merged
Merged
Conversation
…nd linter guardrails
- New pitfalls & verified examples (#60–#73):
- Fundamentals (README.md): #60 all([]) vacuous truth, #61 itertools.groupby
unsorted runs & shared cursor, #62 chained comparisons with in/is/==,
#63 match/case bare-name capture.
- Concurrency (docs/concurrency.md): #64 async for early-break cleanup leaks
(contextlib.aclosing), #65 asyncio.gather() orphaned sibling tasks,
#66 subprocess.Popen.wait() pipe buffer deadlocks, #67 GIL dict compound-op
& free-threaded assumptions.
- Object model (docs/object-model.md): #68 built-in dict/list C fast-path
method bypasses, #69 __slots__ lost in subclasses, #70 __len__ falsiness.
- Interpreter (docs/interpreter.md): #71 deferred/stringified annotations vs
runtime introspection.
- Data systems (docs/data-systems.md): #72 urllib.parse.urljoin path/origin
pitfalls, #73 Unicode normalization & .casefold() vs .lower().
- Improvements to existing entries & repo tooling:
- Add benign stdlib runnable examples for #58 and #59 (73/73 coverage).
- Highlight isinstance(True, int) JSON validation trap in #14.
- Add set/dict un-findable NaN key growth to #44.
- Link #53 safe_join TOCTOU discussion to filelock advisories & clarify
CWE-22 counts in docs/security.md.
- Add copy-paste Ruff/type-checker/runtime guardrail section to README.md.
- Add free-threaded CPython 3.13t and 3.14t to .github/workflows/verify.yml.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a7fdd9ab64
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Expands the catalog from 59 to 73 verified pitfalls with 100% runnable example coverage (
01–73), tightens existing entries, adds a copy-paste static/runtime guardrail reference, and adds free-threaded CPython (3.13t/3.14t) to CI.1. New Pitfalls & Self-Checking Examples (
#60–#73)README.md)all([])vacuous truth in authorization/validation (especially dangerous after iterator exhaustion) (examples/60_all_empty_vacuous_truth.py)itertools.groupbyonly groups consecutive runs and drains prior group iterators (examples/61_groupby_unsorted_and_shared.py)in,is, and==("a" in d == True→False) (examples/62_chained_comparison_trap.py)match/caseact as capture patterns rather than constant checks (examples/63_match_case_bare_name.py)docs/concurrency.md)breakfromasync forsuspendsfinallycleanup withoutcontextlib.aclosing()(examples/64_async_generator_cleanup.py)asyncio.gather()propagates the first exception while leaving sibling tasks running (examples/65_asyncio_gather_orphans.py)subprocess.Popen(..., stdout=PIPE).wait()deadlocks once the OS pipe buffer fills (examples/66_subprocess_pipe_deadlock.py)"The GIL makes dict safe"fails on check-then-set, concurrent iteration, and free-threaded builds (examples/67_freethreaded_gil_assumptions.py)docs/object-model.md)dict/listC fast-paths bypass overridden dunder methods on subclasses (examples/68_builtin_subclass_bypass.py)__slots__class without declaring__slots__silently restores__dict__(examples/69_slots_inheritance_dict.py)__len__without__bool__makes valid zero-length objects falsy (examples/70_bool_falls_back_to_len.py)docs/interpreter.md)from __future__ import annotations/ deferred annotations vs naive__annotations__inspection and local scopes (examples/71_stringified_annotations.py)docs/data-systems.md)urllib.parse.urljoindrops base path segments without/and swaps origins on//host(examples/72_urljoin_drops_path.py)==/dict lookup, and.lower()misses.casefold()mappings (examples/73_unicode_normalization_casing.py)2. Refinements & Tooling Improvements
73/73): Added benign stdlib demonstrations for #58 (examples/58_pickle_deserialization_exec.py) and #59 (examples/59_key_algorithm_confusion.py).isinstance(True, int)accepting JSON booleans in runtime integer validation (examples/14_bool_is_int.py).set/dictduplicate un-findableNaNkey growth (examples/44_nan_breaks_containers.py).safe_joinsymlink resolution to the local TOCTOUfilelockadvisories indocs/dependency-risk.mdand clarified444(CWE-22) vs507(incl. variants) indocs/security.md.README.md): Added a copy-paste[tool.ruff.lint]config + type-checker andpython -X devchecklist mapping pitfalls to automated checks..github/workflows/verify.yml): Added"3.13t"and"3.14t"alongside CPython 3.10–3.14.Verification
examples/*.pyscripts under CPython 3.14 andpython3.14 -X dev.ast.parse(..., feature_version=(3, 10)).README.md,CONTRIBUTING.md, anddocs/*.md.