tools/pygrub: Fix pygrub's --entry flag for python3
PATCH 1/1 tools/pygrub: Fix pygrub's --entry flag for python3
string.atoi() has been deprecated since Python 2.0, has a big scary warning in the python2.7 docs and is absent from python3 altogether. int() does the same thing and is compatible with both.
See https://docs.python.org/2/library/string.html#string.atoi:
--- tools/pygrub/src/pygrub | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/pygrub/src/pygrub +1 -1
@@ -731,7 +731,7 @@ class Grub: def get_entry_idx(cf, entry): # first, see if the given entry is numeric try: - idx = string.atoi(entry) + idx = int(entry) return idx except ValueError: pass
Signature · 1 line
2.34.1
Quoted 16 lines · Alejandro Vallejo
string.atoi()has been deprecated since Python 2.0, has a big scary warning in the python2.7 docs and is absent from python3 altogether.int()does the same thing and is compatible with both.See https://docs.python.org/2/library/string.html#string.atoi:
Signed-off-by Alejandro Vallejo <[email protected]>--- tools/pygrub/src/pygrub | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/pygrub/src/pygrub +0
-0
tools/pygrub/src/pygrub class Grub: · line 737
Quoted 8 lines
tools/pygrub/src/pygrub +1
-1@@ -731,7 +731,7 @@ class Grub: def get_entry_idx(cf, entry): # first, see if the given entry is numeric try: - idx = string.atoi(entry) + idx = int(entry) return idx except ValueError: pass
CC Henry for 4.18. This was discovered late in the XSA-443 work and is one small extra bit of Python3 work.
Thanks,
~Andrew
Quoted 16 lines · Alejandro Vallejo
string.atoi()has been deprecated since Python 2.0, has a big scary warning in the python2.7 docs and is absent from python3 altogether.int()does the same thing and is compatible with both.See https://docs.python.org/2/library/string.html#string.atoi:
Signed-off-by Alejandro Vallejo <[email protected]>--- tools/pygrub/src/pygrub | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/pygrub/src/pygrub +0
-0
tools/pygrub/src/pygrub class Grub: · line 737
Quoted 8 lines
tools/pygrub/src/pygrub +1
-1@@ -731,7 +731,7 @@ class Grub: def get_entry_idx(cf, entry): # first, see if the given entry is numeric try: - idx = string.atoi(entry) + idx = int(entry) return idx except ValueError: pass
CC Henry for 4.18. This was discovered late in the XSA-443 work and is one small extra bit of Python3 work.
Thanks,
~Andrew
Hi Andrew, Alejandro,
Quoted 14 lines · Andrew Cooper
Quoted 11 lines · Alejandro Vallejo
string.atoi()has been deprecated since Python 2.0, has a big scary warning in the python2.7 docs and is absent from python3 altogether.int()does the same thing and is compatible with both.See https://docs.python.org/2/library/string.html#string.atoi:
Signed-off-by Alejandro Vallejo <[email protected]>---
tools/pygrub/src/pygrub| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines
tools/pygrub/src/pygrub class Grub: · line 737
Quoted 13 lines
tools/pygrub/src/pygrub +0
-0@@ -731,7 +731,7 @@ class Grub:def
get_entry_idx(cf, entry):
# first, see if the given entry is numeric
try:tools/pygrub/src/pygrub +1
-1- idx = string.atoi(entry) + idx = int(entry) return idx except ValueError: passCC Henry for 4.18. This was discovered late in the XSA-443 work and is one small extra bit of Python3 work.
Thanks.
Kind regards,
Henry
Quoted 4 lines
Thanks,
~Andrew