summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorKyleMiles <krm504@nyu.edu>2019-09-19 18:11:44 +0000
committerKyleMiles <krm504@nyu.edu>2019-09-19 18:11:44 +0000
commit6db079c21099737d92df2f743f5c94e4592492a5 (patch)
tree56900e8917a52fcf650c06be11a8fd7bd3be5827 /python
parentf5851a8c606cdc2369cf1ee928e1fe9687513782 (diff)
Fix call to BNDefineAutoSymbolAndVariableOrFunction
Diffstat (limited to 'python')
-rw-r--r--python/binaryview.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index a48880dd..aef72a6a 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -3287,7 +3287,7 @@ class BinaryView(object):
.. warning:: If multiple symbols for the same address are defined, only the most recent symbol will ever be used.
:param Symbol sym: the symbol to define
- :param SymbolType sym_type: Type of symbol being defined
+ :param SymbolType sym_type: Type of symbol being defined (can be None)
:param Platform plat: (optional) platform
:rtype: None
"""
@@ -3295,7 +3295,13 @@ class BinaryView(object):
plat = self.platform
elif not isinstance(plat, binaryninja.platform.Platform):
raise AttributeError("Provided platform is not of type `binaryninja.platform.Platform`")
- core.BNDefineAutoSymbolAndVariableOrFunction(self.handle, plat.handle, sym.handle, sym_type.handle)
+
+ if isinstance(sym_type, binaryninja.SymbolType):
+ sym_type = sym_type.handle
+ elif sym_type is not None:
+ raise AttributeError("Provided sym_type is not of type `binaryninja.SymbolType`")
+
+ core.BNDefineAutoSymbolAndVariableOrFunction(self.handle, plat.handle, sym.handle, sym_type)
def undefine_auto_symbol(self, sym):
"""