-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SMS-DELIVER from
number decoding error
#33
Comments
Back in the faucamp/python-gsmmodem repository instead of addressLen = int(math.ceil(addressLen / 2.0)) and: if addressLen % 2:
addressLen = int(addressLen / 2) + 1
else:
addressLen = int(addressLen / 2) There are no more occurrences of |
Thank you! I'm making pull request then. |
Just a question: Shouldn't |
The faucamp@df20a9a fix from 2014 was originally part of the codebase until I merged @paolo-losi branch. The |
quick test, all three blocks give the same values:
import math
def testblock1(addressLen):
if addressLen % 2:
addressLen = int(addressLen / 2) + 1
else:
addressLen = int(addressLen / 2)
print (addressLen)
testblock1(0)
testblock1(1)
testblock1(2)
testblock1(3)
testblock1(4)
testblock1(5)
testblock1(6)
def testblock2(addressLen):
addressLen = int(math.ceil(addressLen / 2.0))
print (addressLen)
testblock2(0)
testblock2(1)
testblock2(2)
testblock2(3)
testblock2(4)
testblock2(5)
testblock2(6)
def testblock3(addressLen):
addressLen = int((addressLen + 1) / 2)
print (addressLen)
testblock3(0)
testblock3(1)
testblock3(2)
testblock3(3)
testblock3(4)
testblock3(5)
testblock3(6) |
I suggest to change
|
Hey, I've encountered strange bug while decoding some pdu's. I got
EncodingError
exception on some messages while the others are decoding normally. It seems that a problem is in a functionnibble2octet
:In Python 3 this function can produce float values. The value is used later in
unpackSeptets
and comparison with int breaks desired behavior. If it is simple python2->python3 migration issue, it can be fixed simply byreturn int(o / 2) + 1
. Can somebody confirm that fix doesn't break anything else?The text was updated successfully, but these errors were encountered: