فهرست منبع

task: Fix memory leak related to Python 3 signal API changes

Python 3's signal.py API does not properly support custom signal handlers. An exception is created every frame because of this, which fills up the memory of the application.

Closes #873
Derzsi Dániel 5 سال پیش
والد
کامیت
eccfce4606
1فایلهای تغییر یافته به همراه5 افزوده شده و 1 حذف شده
  1. 5 1
      direct/src/task/Task.py

+ 5 - 1
direct/src/task/Task.py

@@ -17,9 +17,13 @@ from direct.showbase.MessengerGlobal import messenger
 import types
 import random
 import importlib
+import sys
 
 try:
-    import signal
+    if sys.version_info >= (3, 0):
+        import _signal as signal
+    else:
+        import signal
 except ImportError:
     signal = None