GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — `#[vm::pyclass]` / `#[vm::pymethod]` causes infinite loop in macro expansion · Issue #8097 · RustPython/RustPython Open Labels C-bugSomething isn't workingSomething isn't working DescriptionSummary
Affected: Root cause
while let Some((_, attr)) = iter.peek() { let attr_name = if let Some(ident) = attr.get_ident() { ident.to_string() } else { continue; // ← iter.next() skipped; same attribute peeked forever }; // ... iter.next(); // ← never reached when get_ident() returns None }
Writing Minimal reproduction
[package] name = "reproduce-pyclass-hang" version = "0.1.0" edition = "2021" [dependencies] rustpython-vm = { version = "0.5", default-features = false, features = ["compiler", "gc"] }
use rustpython_vm as vm; #[derive(Debug, vm::PyPayload)] struct Item { value: i64 } #[vm::pyclass] impl Item { #[vm::pymethod] // ← qualified path triggers the hang fn value(&self) -> i64 { self.value } } Run FixMove // crates/derive-impl/src/pyclass.rs (~line 1986) while let Some((_, attr)) = iter.peek() { // Wrap in if-let so multi-segment paths (e.g. vm::pymethod) that return // None from get_ident() are skipped instead of looping forever. if let Some(ident) = attr.get_ident() { let attr_name = ident.to_string(); if attr_name == "cfg" { cfgs.push(attr.clone()); } else if ALL_ALLOWED_NAMES.contains(&attr_name.as_str()) { break; } } iter.next(); } Reacted by Copilot ActivityMetadataMetadataAssigneesLabelsC-bugSomething isn't workingSomething isn't working TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |