Skip to content

Commit 6968861

Browse files
committed
Fix ifupdown2 on Python 3.12
Signed-off-by: Saikrishna Arcot <[email protected]>
1 parent 238e26a commit 6968861

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
From: Jan Huijsmans <[email protected]>
2+
Date: Tue, 9 Jul 2024 09:03:25 +0200
3+
X-Dgit-Generated: 3.0.0-1.3 25127847996b30ded7825cb98247e54478bdd350
4+
Subject: Bug #296: python 3.12 compability
5+
6+
Since python 3.2, readfp needs to be replaced by read_file.
7+
Python 3.12 dropped the readfp function.
8+
9+
Patch provided as PR by me, as the original reporter failed to do
10+
so since 4-4-2024 and my systems break due to this issue.
11+
12+
---
13+
14+
diff --git a/ifupdown2/ifupdown/main.py b/ifupdown2/ifupdown/main.py
15+
index 5ab07fa..141a922 100644
16+
--- a/ifupdown2/ifupdown/main.py
17+
+++ b/ifupdown2/ifupdown/main.py
18+
@@ -139,7 +139,7 @@ class Ifupdown2:
19+
configStr = '[ifupdown2]\n' + config
20+
configFP = io.StringIO(configStr)
21+
parser = configparser.RawConfigParser()
22+
- parser.readfp(configFP)
23+
+ parser.read_file(configFP)
24+
configmap_g = dict(parser.items('ifupdown2'))
25+
26+
# Preprocess config map

src/ifupdown2/patch/series

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
0001-fix-broadcast-addr-encoding.patch
22
0002-disable-checks-when-using-no-wait.patch
33
0003-Fix-the-return-value-of-utils._execute_subprocess-me.patch
4+
bug-296-python-3.12-compability.patch

0 commit comments

Comments
 (0)