From 4802ca3ac8f8326ad493a33021ad79cfb1d8cf94 Mon Sep 17 00:00:00 2001 From: 40% Date: Tue, 20 Oct 2026 14:11:58 +0800 Subject: [PATCH] Convert old-style Cython properties to @property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace 4 deprecated Cython property blocks with standard @property syntax: - Row.name (L693) - NLRow.name (L1002) - Variable.name (L1558) — keeps NULL -> "" branch - Constraint.name (L2220) — keeps NULL -> "" branch Behavior is equivalent; Cython compiles @property to a C-level getset_descriptor, identical to the legacy property name: form. --- src/pyscipopt/scip.pxi | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/src/pyscipopt/scip.pxi b/src/pyscipopt/scip.pxi index 6b991ad2f..11cf40d71 100644 --- a/src/pyscipopt/scip.pxi +++ b/src/pyscipopt/scip.pxi @@ -690,10 +690,9 @@ cdef class Row: row.scip_row = sciprow return row - property name: - def __get__(self): - cname = bytes( SCIProwGetName(self.scip_row) ) - return cname.decode('utf-8') + @property + def name(self): + return bytes(SCIProwGetName(self.scip_row)).decode("utf-8") def getLhs(self): """ @@ -999,10 +998,9 @@ cdef class NLRow: nlrow.scip_nlrow = scipnlrow return nlrow - property name: - def __get__(self): - cname = bytes( SCIPnlrowGetName(self.scip_nlrow) ) - return cname.decode('utf-8') + @property + def name(self): + return bytes(SCIPnlrowGetName(self.scip_nlrow)).decode("utf-8") def getConstant(self): """ @@ -1555,12 +1553,11 @@ cdef class Variable(Expr): Expr.__init__(var, {Term(var) : 1.0}) return var - property name: - def __get__(self): - if self.scip_var == NULL: - return "" - cname = bytes( SCIPvarGetName(self.scip_var) ) - return cname.decode('utf-8') + @property + def name(self): + if self.scip_var == NULL: + return "" + return bytes(SCIPvarGetName(self.scip_var)).decode("utf-8") cdef Variable copy(self, bint copy=True): return self @@ -2217,12 +2214,11 @@ cdef class Constraint: cons.scip_cons = scipcons return cons - property name: - def __get__(self): - if self.scip_cons == NULL: - return "" - cname = bytes( SCIPconsGetName(self.scip_cons) ) - return cname.decode('utf-8') + @property + def name(self): + if self.scip_cons == NULL: + return "" + return bytes(SCIPconsGetName(self.scip_cons)).decode("utf-8") def ptr(self): return (self.scip_cons)