0001-Remove-usage-of-U-mode-bit-for-opening-files-in-pyth.patch 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. From 328c58967dce8be426f9208ba7717ab5afc2c4f3 Mon Sep 17 00:00:00 2001
  2. From: Daan De Meyer <daan.j.demeyer@gmail.com>
  3. Date: Mon, 11 Jul 2022 00:56:28 +0200
  4. Subject: [PATCH] Remove usage of 'U' mode bit for opening files in python
  5. The 'U' mode bit is removed in python 3.11. It has been
  6. deprecated for a long time. The 'U' mode bit has no effect
  7. so this change doesn't change any behavior.
  8. See https://docs.python.org/3.11/whatsnew/3.11.html#changes-in-the-python-api
  9. Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
  10. ---
  11. waflib/ConfigSet.py | 2 +-
  12. waflib/Context.py | 4 ++--
  13. 2 files changed, 3 insertions(+), 3 deletions(-)
  14. diff --git a/waflib/ConfigSet.py b/waflib/ConfigSet.py
  15. index b300bb56..84736c9c 100644
  16. --- a/waflib/ConfigSet.py
  17. +++ b/waflib/ConfigSet.py
  18. @@ -312,7 +312,7 @@ class ConfigSet(object):
  19. :type filename: string
  20. """
  21. tbl = self.table
  22. - code = Utils.readf(filename, m='rU')
  23. + code = Utils.readf(filename, m='r')
  24. for m in re_imp.finditer(code):
  25. g = m.group
  26. tbl[g(2)] = eval(g(3))
  27. diff --git a/waflib/Context.py b/waflib/Context.py
  28. index 9fee3fa1..761b521f 100644
  29. --- a/waflib/Context.py
  30. +++ b/waflib/Context.py
  31. @@ -266,7 +266,7 @@ class Context(ctx):
  32. cache[node] = True
  33. self.pre_recurse(node)
  34. try:
  35. - function_code = node.read('rU', encoding)
  36. + function_code = node.read('r', encoding)
  37. exec(compile(function_code, node.abspath(), 'exec'), self.exec_dict)
  38. finally:
  39. self.post_recurse(node)
  40. @@ -662,7 +662,7 @@ def load_module(path, encoding=None):
  41. module = imp.new_module(WSCRIPT_FILE)
  42. try:
  43. - code = Utils.readf(path, m='rU', encoding=encoding)
  44. + code = Utils.readf(path, m='r', encoding=encoding)
  45. except EnvironmentError:
  46. raise Errors.WafError('Could not read the file %r' % path)
  47. --
  48. 2.30.2