Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue regarding numba. #230

Merged
merged 2 commits into from
Jun 16, 2020
Merged

Fix for issue regarding numba. #230

merged 2 commits into from
Jun 16, 2020

Conversation

Torxed
Copy link
Contributor

@Torxed Torxed commented Jun 16, 2020

Converts <class 'OSError'> into str(err) when calling warnings.warn(err).

Relevant gist: https://gist.github.com/Torxed/10f3bd35ddbd8ceabda8f7a002fdff6c

Code to reproduce:

import pyglet
import numba

game_window = pyglet.window.Window(600, 400)
icon = pyglet.image.load("test.png")
game_window.set_icon(icon)
pyglet.app.run()

Original report: https://stackoverflow.com/questions/62383035/error-while-import-numba-module-in-pyglet-projects

@benmoran56 benmoran56 merged commit 39a4f7b into pyglet:pyglet-1.5-maintenance Jun 16, 2020
@benmoran56
Copy link
Member

Thanks, looks good!

@caffeinepills
Copy link
Collaborator

This is bizarre as warnings.warn seems to take exceptions:

>>> import warnings
>>> test = OSError("Failed")
>>> warnings.warn(test)

Warning (from warnings module):
  File "__main__", line 1
UserWarning: Failed
>>> 

@benmoran56
Copy link
Member

The best we can figure is that Numba is mutating things somehow during the JIT process. The traceback indicated that warn would only accept string/bytes, but that certainly doesn't seem to be the case in my Python interpreter either.

In any case, this seems like an easy enough fix for whatever is causing it.

@Torxed
Copy link
Contributor Author

Torxed commented Jun 16, 2020

I was having issues using the -m trace --trace module to diagnose the issue. Not sure the JIT optimization liked what I was doing.

benmoran56 pushed a commit that referenced this pull request Jun 22, 2020
* Fix for issue regarding numba.

* Found other instances of warnings.warn(err) where OSError was passed unprocessed.

Co-authored-by: Lord Anton Hvornum <anton.feeds@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants