mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-10-01 22:14:53 +02:00
Objects: Make bool an int
We can't inherit from bool, so __new__ can't return a bool, so everything has be done with int. However __bool__ is already defined for int, so it should have no significant impact (other than type() calls). Fixes issue 232.
This commit is contained in:
@@ -156,9 +156,12 @@ class PrimitiveObject(interfaces.objects.ObjectInterface):
|
||||
return self._context.layers.write(self.vol.layer_name, self.vol.offset, data)
|
||||
|
||||
|
||||
# This must be int (and the _struct_type must be int) because bool cannot be inherited from:
|
||||
# https://mail.python.org/pipermail/python-dev/2002-March/020822.html
|
||||
# https://mail.python.org/pipermail/python-dev/2004-February/042537.html
|
||||
class Boolean(PrimitiveObject, int):
|
||||
"""Primitive Object that handles boolean types."""
|
||||
_struct_type = bool # type: ClassVar[Type]
|
||||
_struct_type = int # type: ClassVar[Type]
|
||||
|
||||
|
||||
class Integer(PrimitiveObject, int):
|
||||
|
||||
Reference in New Issue
Block a user