Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 1 | From 415d50fc56b82963e5570c7738c61b22f4a83748 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 | |
| 6 | The 'U' mode bit is removed in python 3.11. It has been |
| 7 | deprecated for a long time. The 'U' mode bit has no effect |
| 8 | so this change doesn't change any behavior. |
| 9 | |
| 10 | See https://docs.python.org/3.11/whatsnew/3.11.html#changes-in-the-python-api |
| 11 | |
| 12 | Upstream-Status: Submitted [https://github.com/jackaudio/jack2/pull/884] |
| 13 | --- |
| 14 | waflib/ConfigSet.py | 2 +- |
| 15 | waflib/Context.py | 4 ++-- |
| 16 | 2 files changed, 3 insertions(+), 3 deletions(-) |
| 17 | |
| 18 | diff --git a/waflib/ConfigSet.py b/waflib/ConfigSet.py |
| 19 | index b300bb56..84736c9c 100644 |
| 20 | --- a/waflib/ConfigSet.py |
| 21 | +++ b/waflib/ConfigSet.py |
| 22 | @@ -312,7 +312,7 @@ class ConfigSet(object): |
| 23 | :type filename: string |
| 24 | """ |
| 25 | tbl = self.table |
| 26 | - code = Utils.readf(filename, m='rU') |
| 27 | + code = Utils.readf(filename, m='r') |
| 28 | for m in re_imp.finditer(code): |
| 29 | g = m.group |
| 30 | tbl[g(2)] = eval(g(3)) |
| 31 | diff --git a/waflib/Context.py b/waflib/Context.py |
| 32 | index 9fee3fa1..761b521f 100644 |
| 33 | --- a/waflib/Context.py |
| 34 | +++ b/waflib/Context.py |
| 35 | @@ -266,7 +266,7 @@ class Context(ctx): |
| 36 | cache[node] = True |
| 37 | self.pre_recurse(node) |
| 38 | try: |
| 39 | - function_code = node.read('rU', encoding) |
| 40 | + function_code = node.read('r', encoding) |
| 41 | exec(compile(function_code, node.abspath(), 'exec'), self.exec_dict) |
| 42 | finally: |
| 43 | self.post_recurse(node) |
| 44 | @@ -662,7 +662,7 @@ def load_module(path, encoding=None): |
| 45 | |
| 46 | module = imp.new_module(WSCRIPT_FILE) |
| 47 | try: |
| 48 | - code = Utils.readf(path, m='rU', encoding=encoding) |
| 49 | + code = Utils.readf(path, m='r', encoding=encoding) |
| 50 | except EnvironmentError: |
| 51 | raise Errors.WafError('Could not read the file %r' % path) |
| 52 | |