-
-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#2467 add patch to silence egl file open warning
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
From e727dc530f4abfe0091be068573d7dda311fc575 Mon Sep 17 00:00:00 2001 | ||
From: Antoine Martin <totaam@xpra.org> | ||
Date: Fri, 27 Oct 2023 15:25:07 +0700 | ||
Subject: [PATCH] fix resource warning | ||
|
||
``` | ||
/usr/lib/python3.11/site-packages/OpenGL/platform/egl.py:76: ResourceWarning: unclosed file <_io.TextIOWrapper | ||
name='/proc/cpuinfo' mode='r' encoding='UTF-8'> | ||
info = open('/proc/cpuinfo').read() | ||
``` | ||
--- | ||
OpenGL/platform/egl.py | 3 ++- | ||
1 file changed, 2 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/OpenGL/platform/egl.py b/OpenGL/platform/egl.py | ||
index 55fbb0be..44b55024 100644 | ||
--- a/OpenGL/platform/egl.py | ||
+++ b/OpenGL/platform/egl.py | ||
@@ -73,7 +73,8 @@ def EGL(self): | ||
# https://github.com/raspberrypi/firmware/issues/110 | ||
import os | ||
if os.path.exists('/proc/cpuinfo'): | ||
- info = open('/proc/cpuinfo').read() | ||
+ with open('/proc/cpuinfo', 'r') as f: | ||
+ info = f.read() | ||
if 'BCM2708' in info or 'BCM2709' in info: | ||
assert self.GLES2 | ||
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters