[Asterisk-code-review] lib/python: asterisk.voicemail compatibility of maxint for Python 3: (...testsuite[master])

Rodrigo Ramirez Norambuena asteriskteam at digium.com
Sat Jul 20 13:45:03 CDT 2019


Rodrigo Ramirez Norambuena has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/11599


Change subject: lib/python: asterisk.voicemail compatibility of maxint for Python 3:
......................................................................

lib/python: asterisk.voicemail compatibility of maxint for Python 3:

maxint was remove in Python 3. This change include a port compatibility
for this function for Python 3 using maxsize.

This is accord to the python3 compatibility done in
ChangeId: If76c2d3e11e4ab4552d0df7841287c8bb2de7918

Change-Id: Ie321376d7234ff054dfb9964f5995866879199a3
---
M lib/python/asterisk/voicemail.py
1 file changed, 9 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/99/11599/1

diff --git a/lib/python/asterisk/voicemail.py b/lib/python/asterisk/voicemail.py
index 3c4c7d5..0c1c088 100644
--- a/lib/python/asterisk/voicemail.py
+++ b/lib/python/asterisk/voicemail.py
@@ -429,8 +429,16 @@
                             'c': context, 'm': mailbox, 'f': folder, 'n': msg_env_name})
 
         random.seed()
+
+        # `maxint` was removed in Python 3
+        # https://docs.python.org/3.0/whatsnew/3.0.html#integers
+        if sys.version_info.major == 2:
+           maxint = sys.maxint
+        else:
+           maxint = sys.maxsize
+
         msg_id = (str(int(time.time())) + "-" +
-                  str(random.randrange(0, 1, sys.maxint - 1)))
+                  str(random.randrange(0, 1, maxint - 1)))
 
         with open(msg_env_path, 'w') as envelope_file:
             envelope_file.write(';\n')

-- 
To view, visit https://gerrit.asterisk.org/c/testsuite/+/11599
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Change-Id: Ie321376d7234ff054dfb9964f5995866879199a3
Gerrit-Change-Number: 11599
Gerrit-PatchSet: 1
Gerrit-Owner: Rodrigo Ramirez Norambuena <a at rodrigoramirez.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190720/cd1510c2/attachment.html>


More information about the asterisk-code-review mailing list