summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Ferrell <josh@vector35.com>2025-09-02 17:19:16 -0400
committerJosh Ferrell <josh@vector35.com>2025-09-02 17:19:16 -0400
commit82a858d3be86d4e701cf8e2ebdc31c8d70237dd6 (patch)
tree8e695d0c52687ac0cdfe2f784f9dad42575427a7
parenteef93b932844110cf19a4b2741b528623b77998e (diff)
Do not change symbol type when setting data variable name
-rw-r--r--python/binaryview.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index c255a80e..88779630 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -11307,11 +11307,16 @@ class DataVariable(CoreDataVariable):
@symbol.setter
def symbol(self, value: Optional[Union[str, '_types.CoreSymbol']]) -> None: # type: ignore
+ existing_symbol = self.symbol
if value is None or value == "":
- if self.symbol is not None:
- self.view.undefine_user_symbol(self.symbol)
+ if existing_symbol is not None:
+ self.view.undefine_user_symbol(existing_symbol)
elif isinstance(value, (str, _types.QualifiedName)):
- symbol = _types.Symbol(SymbolType.DataSymbol, self.address, str(value))
+ if existing_symbol is not None:
+ symbol_type = existing_symbol.type
+ else:
+ symbol_type = SymbolType.DataSymbol
+ symbol = _types.Symbol(symbol_type, self.address, str(value))
self.view.define_user_symbol(symbol)
elif isinstance(value, _types.CoreSymbol):
self.view.define_user_symbol(value)