protocolbuffers / protocolbuffers/protobuf
[Ruby] ListValue#each raises without a block instead of returning an Enumerator
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 72k
- Forks
- 16.3k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 140
Description
Summary
Google::Protobuf::ListValue includes Enumerable, but its handwritten each unconditionally yields. Calling each without a block raises LocalJumpError instead of returning an Enumerator, unlike the Array-like Ruby contract.
Proposed correction
Return enum_for(:each) when no block is provided. Candidate: 0092fd7f345b6c970e72895423487d01f11abab6.
The isolated model fails on current main (5b1c20741838b8359193b97895cb0ff35b4ecf79) and passes the candidate with chained enumeration and converted Ruby values. The cumulative candidate passes 332 native tests /556,948 assertions and 329 FFI tests /598,403 assertions with no failures or errors (documented omissions only).
I used an AI coding assistant during source review and verification. I am opening an issue first because CONTRIBUTING asks for tests and maintainer agreement; this dependency audit is not permitted to modify repository tests and no CLA was signed as part of it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the handwritten Google::Protobuf::ListValue#each entry point and reproduce the no-block call described in the issue. Verify that no-block and chained enumeration return converted Ruby values, then run the native and FFI suites noted in the report; done means both behaviors work without regressions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100