Skip to content

Commit 2fc7441

Browse files
committed
add explicit arg.deleter raising AttributeError for cdef class compat
In Cython cdef class, a property without a deleter raises NotImplementedError instead of Python's AttributeError. Add an explicit deleter to BaseInstr.arg that raises AttributeError to keep consistent behaviour across pure Python and Cython builds.
1 parent c979e50 commit 2fc7441

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/bytecode/instr.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,10 @@ def arg(self) -> A:
788788
def arg(self, arg: A):
789789
self._set(self._name, arg)
790790

791+
@arg.deleter
792+
def arg(self) -> None:
793+
raise AttributeError("can't delete attribute")
794+
791795
@property
792796
def lineno(self) -> int | _UNSET | None:
793797
return self._location.lineno if self._location is not None else UNSET

0 commit comments

Comments
 (0)