sethmlarson / virtualbox-python

Complete implementation of VirtualBox's COM API with a Pythonic interface.
https://pypi.org/project/virtualbox
Apache License 2.0
354 stars 75 forks source link

IMedium.create_base_storage() logical_size argument only accepts integers #4

Closed obbardc closed 10 years ago

obbardc commented 10 years ago

logical_size argument is the size of the storage medium in bytes. In Python longs are also ints!

>>> isinstance(10*1024, int) # 10kb
True
>>> isinstance(10*1024*1024, int) #10mb
True
>>> isinstance(10*1024*1024*1024, int) # 10gb
False

Fix: Allow integers as well as longs to allow large hard drive sizes.

>>> isinstance(10*1024*1024*1024*1024, (int, long)) # 10tb
True

I will attach a fork which implements this fix.

mjdorma commented 10 years ago

Thanks for your feedback. This is a bug indeed.

Py3x unified the int/long only have int which is actually Py2x's long type...

Let me know if this change resolves your issue: 0aacc934879d605c511b96f32b742f476bb3396c

mjdorma commented 10 years ago

Fixed in 7df6b05fa0a58ef43ad6dce42fec6a3398316396