classification
Title: SystemError from class 'int'
Type: Stage: resolved
Components: Versions: Python 3.8
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: jollyoliver657, mark.dickinson, serhiy.storchaka, vstinner
Priority: normal Keywords:

Created on 2021-01-09 22:50 by jollyoliver657, last changed 2021-01-13 11:27 by vstinner. This issue is now closed.

Files
File name Uploaded Description Edit
Movement.py jollyoliver657, 2021-01-09 22:50
Messages (6)
msg384743 - (view) Author: Jason Oliver (jollyoliver657) Date: 2021-01-09 22:50
This is my first bug report so I hope that this is correctly formatted. I am learning how to use pygame and encountered the following error:
SystemError: <class 'int'> returned a result with an error set

I googled the error message and came across the following answer on stackoverflow:
https://stackoverflow.com/a/53796516

This stated that the problem could exist within the implementation of python and that I should file a bug report here.

I am using the following software installed through pip/pip3:
Python 3.8.4
pygame 2.0.1
OS Edition: Windows 10 Pro
OS Version: 20H2
OS build: 19042.685

The bug can be reproduced deterministically.
msg384759 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2021-01-10 11:05
This is more likely to be a bug in Pygame than in Python itself. What's likely happening here is that some part of the Pygame machinery is setting an exception state but then returning a value as normal. (Generally, if some function in a C extension sets an exception, that function should return NULL or -1.) That then leaves things in an inconsistent state, and Python doesn't notice that inconsistent state until the "int" call happens.

Please could you report to the Pygame folks, if you haven't done so already? It certainly is *possible* that it's actually a core Python bug, but even then the first step would be to eliminate the Pygame component from the code-to-reproduce.
msg384762 - (view) Author: Jason Oliver (jollyoliver657) Date: 2021-01-10 13:45
I will submit the bug report to the pygame bug tracker.
msg384764 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-01-10 14:33
With debug build of Python I get a crash in other place:

$ ./python -Xdev Movement.py 
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
python: Objects/abstract.c:155: PyObject_GetItem: Assertion `(item != NULL) ^ (PyErr_Occurred() != NULL)' failed.
Fatal Python error: Aborted

Current thread 0x00007fc3d0b6e280 (most recent call first):
  File "Movement.py", line 47 in writeGridToSurface
  File "Movement.py", line 100 in <module>

It is very likely a bug in Pygame. Perhaps it was always here, just Python 3.8 is more strict to programming errors in extensions.
msg385009 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2021-01-13 09:05
Downstream issue is here: https://github.com/pygame/pygame/issues/2442

I'll close this here, since that report indicates a bug in Pygame.
msg385018 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-01-13 11:27
> I'll close this here, since that report indicates a bug in Pygame.

FYI I created bpo-42923 "Py_FatalError(): dump the list of extension modules" to help users to understand that the error can come from third party C extensions rather than Python itself.
History
Date User Action Args
2021-01-13 11:27:04vstinnersetnosy: + vstinner
messages: + msg385018
2021-01-13 09:05:51mark.dickinsonsetstatus: open -> closed
resolution: third party
messages: + msg385009

stage: resolved
2021-01-10 14:33:00serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg384764
2021-01-10 13:45:21jollyoliver657setmessages: + msg384762
2021-01-10 11:05:03mark.dickinsonsetnosy: + mark.dickinson
messages: + msg384759
2021-01-09 22:50:07jollyoliver657create