Skip to content

Implement setattr builtin function#67

Merged
davidhewitt merged 6 commits intomainfrom
setattr
Apr 20, 2026
Merged

Implement setattr builtin function#67
davidhewitt merged 6 commits intomainfrom
setattr

Conversation

@friendlymatthew
Copy link
Copy Markdown
Member

This PR implements the setattr function for dynamic attribute modification on objects. The implementation uses the existing py_set_attr infrastructure

Note: the docs state this method is the counterpart of #65

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jan 23, 2026

Merging this PR will not alter performance

✅ 16 untouched benchmarks
⏩ 15 skipped benchmarks1


Comparing setattr (48332e8) with main (142807b)

Open in CodSpeed

Footnotes

  1. 15 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

devin-ai-integration[bot]

This comment was marked as resolved.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 13, 2026

Codecov Results 📊

❌ Patch coverage is 32.14%. Project has 23856 uncovered lines.
❌ Project coverage is 64.4%. Comparing base (base) to head (head).

Files with missing lines (4)
File Patch % Lines
crates/monty/src/builtins/setattr.rs 0.00% ⚠️ 15 Missing
crates/monty/src/value.rs 57.14% ⚠️ 3 Missing and 1 partials
crates/monty/src/builtins/mod.rs 0.00% ⚠️ 1 Missing
crates/monty/src/types/dataclass.rs 100.00% ⚠️ 1 partials
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    64.41%    64.40%    -0.01%
==========================================
  Files          256       258        +2
  Lines        66985     67009       +24
  Branches    143181    143283      +102
==========================================
+ Hits         43144     43153        +9
- Misses       23841     23856       +15
- Partials      3236      3240        +4

Generated by Codecov Action

devin-ai-integration[bot]

This comment was marked as resolved.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 13, 2026

Codecov Report

❌ Patch coverage is 89.28571% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/monty/src/builtins/setattr.rs 93.33% 0 Missing and 1 partial ⚠️
crates/monty/src/types/dataclass.rs 75.00% 0 Missing and 1 partial ⚠️
crates/monty/src/value.rs 85.71% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 7 additional findings in Devin Review.

Open in Devin Review

Comment thread crates/monty/src/value.rs
@davidhewitt davidhewitt merged commit d5444c6 into main Apr 20, 2026
30 checks passed
@davidhewitt davidhewitt deleted the setattr branch April 20, 2026 13:03
ChengZhang-98 added a commit to ChengZhang-98/monty that referenced this pull request Apr 27, 2026
* docs(sync-fork): add 2026-04-26 merge plan

Operational plan for absorbing 19 upstream commits since a4be566
(post-v0.0.14 → v0.0.17) into tiny-beaver-ext via a four-PR split
(A: trivia + JS, B: self-contained fixes, C: internal refactors,
D: public-API reshape) staged on cz/sync-fork/2026-04-26.

Locks in two design decisions:
- metadata is orthogonal to hash and equality
- dict key metadata is preserved (already implemented in DictEntry)

* uprev to v0.0.15

* uprev to v0.0.16

* uprev to 0.0.17 (pydantic#384)

* monty-js: allows maxMemory, allocation, recursion depth, and gc interval limits above u32::MAX (pydantic#344)

* skip some tests on WASI (pydantic#379)

* switch `pre-commit` -> `prek` (pydantic#392)

* docs(sync-fork): adjust 2026-04-26 plan after first PRs

- Use dash-separated PR branch names (git won't allow `foo/bar` as a
  child of an existing `foo` ref).
- Move 4dc46f2 (`prefix_code` -> `type_check_stubs` rename) from PR-B
  to PR-D — it modifies build.rs which is created by e777ebf in PR-D.

* docs(sync-fork): document PR-C/PR-D stacking on PR-B

* Implement `setattr` builtin function (pydantic#67)

Co-authored-by: David Hewitt <mail@davidhewitt.dev>

* stop empty tuple singleton contributing to memory limit (pydantic#363)

* fix panics when overflowing negating i64::MIN (pydantic#368)

* fixes GC interval ignored in ResourceTracker and Heap (pydantic#371)

* docs(sync-fork): add 2026-04-26 merge completion notes

Captures actual decisions vs. plan, conflict resolutions per PR,
the two design decisions confirmed under test execution, real bugs
caught by validation (5 — folded back into proper PRs via
--autosquash), and the two known extension gaps (setattr and
StoreSubscript both drop value metadata) now pinned by ext_tests
for follow-up work.

Validation: 1689 / 1708 / 1704 / 21 / 934 / 1100 / 38 tests
passing across the various test targets. Lint clean. Both
design-decision invariants hold.

---------

Co-authored-by: Cheng Zhang <cheng98@fb.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
Co-authored-by: Sathish Thiyagarajan <sathish.thiyagarajan@earlham.ac.uk>
Co-authored-by: Matthew Kim <38759997+friendlymatthew@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants