Skip to content

Commit 6182c7c

Browse files
committed
Remove pygame.threads
1 parent 8d6e7f9 commit 6182c7c

File tree

8 files changed

+32
-558
lines changed

8 files changed

+32
-558
lines changed

buildconfig/stubs/gen_stubs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
"surfarray",
3636
"transform",
3737
"scrap",
38-
"threads",
3938
"version",
4039
"base",
4140
"bufferproxy",

buildconfig/stubs/pygame/__init__.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ from pygame import (
2222
surfarray as surfarray,
2323
transform as transform,
2424
scrap as scrap,
25-
threads as threads,
2625
version as version,
2726
base as base,
2827
bufferproxy as bufferproxy,

setup.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,6 @@ def run(self):
951951
PACKAGEDATA = {
952952
"cmdclass": cmdclass,
953953
"packages": ['pygame',
954-
'pygame.threads',
955954
'pygame._sdl2',
956955
'pygame.tests',
957956
'pygame.tests.test_utils',
@@ -960,7 +959,6 @@ def run(self):
960959
'pygame.__pyinstaller'],
961960
"package_dir": {'pygame': 'src_py',
962961
'pygame._sdl2': 'src_py/_sdl2',
963-
'pygame.threads': 'src_py/threads',
964962
'pygame.tests': 'test',
965963
'pygame.docs': 'docs',
966964
'pygame.examples': 'examples',
@@ -981,11 +979,9 @@ def run(self):
981979
PACKAGEDATA = {
982980
"cmdclass": cmdclass,
983981
"packages": ['pygame',
984-
'pygame.threads',
985982
'pygame._sdl2'],
986983
"package_dir": {'pygame': 'src_py',
987-
'pygame._sdl2': 'src_py/_sdl2',
988-
'pygame.threads': 'src_py/threads'},
984+
'pygame._sdl2': 'src_py/_sdl2'},
989985
"ext_modules": extensions,
990986
"zip_safe": False,
991987
"data_files": data_files

src_py/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,6 @@ def Cursor(*args): # pylint: disable=unused-argument
197197
except (ImportError, OSError):
198198
sprite = MissingModule("sprite", urgent=1)
199199

200-
try:
201-
import pygame.threads
202-
except (ImportError, OSError):
203-
threads = MissingModule("threads", urgent=1)
204200

205201
try:
206202
import pygame.pixelcopy

src_py/threads/__init__.py

Lines changed: 0 additions & 271 deletions
This file was deleted.

test/image_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import unittest
77
import glob
88
import pathlib
9+
from concurrent.futures import ThreadPoolExecutor
910

1011
from pygame.tests.test_utils import example_path, png, tostring
1112
import pygame, pygame.image, pygame.pkgdata
@@ -1356,12 +1357,11 @@ def test_save_extended(self):
13561357
)
13571358

13581359
def threads_load(self, images):
1359-
import pygame.threads
1360-
1361-
for i in range(10):
1362-
surfs = pygame.threads.tmap(pygame.image.load, images)
1363-
for s in surfs:
1364-
self.assertIsInstance(s, pygame.Surface)
1360+
for _ in range(10):
1361+
with ThreadPoolExecutor(max_workers=20) as executor:
1362+
surfs = executor.map(pygame.image.load, images)
1363+
for s in surfs:
1364+
self.assertIsInstance(s, pygame.Surface)
13651365

13661366
def test_load_png_threads(self):
13671367
self.threads_load(glob.glob(example_path("data/*.png")))

0 commit comments

Comments
 (0)