Skip to content

Commit 987436c

Browse files
authored
Merge pull request #2762 from Starbuck5/remove-pygame-threads
Remove pygame.threads
2 parents 98fc54d + 6182c7c commit 987436c

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
@@ -947,7 +947,6 @@ def run(self):
947947
PACKAGEDATA = {
948948
"cmdclass": cmdclass,
949949
"packages": ['pygame',
950-
'pygame.threads',
951950
'pygame._sdl2',
952951
'pygame.tests',
953952
'pygame.tests.test_utils',
@@ -956,7 +955,6 @@ def run(self):
956955
'pygame.__pyinstaller'],
957956
"package_dir": {'pygame': 'src_py',
958957
'pygame._sdl2': 'src_py/_sdl2',
959-
'pygame.threads': 'src_py/threads',
960958
'pygame.tests': 'test',
961959
'pygame.docs': 'docs',
962960
'pygame.examples': 'examples',
@@ -977,11 +975,9 @@ def run(self):
977975
PACKAGEDATA = {
978976
"cmdclass": cmdclass,
979977
"packages": ['pygame',
980-
'pygame.threads',
981978
'pygame._sdl2'],
982979
"package_dir": {'pygame': 'src_py',
983-
'pygame._sdl2': 'src_py/_sdl2',
984-
'pygame.threads': 'src_py/threads'},
980+
'pygame._sdl2': 'src_py/_sdl2'},
985981
"ext_modules": extensions,
986982
"zip_safe": False,
987983
"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)