pyodide / pyodide/pytest-pyodide

TST: can't pickle pyodide.InternalError

Open
#82 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
38
Forks
20
Avg merge
1d 23h
Merged PRs (30d)
1

Description

Now in https://github.com/pyodide/pytest-pyodide/pull/80 (that just updates linting) we start to see the issue about picklability of InternalError. I think this is likely related to changes in pyodide 0.23.0

@hoodmane for JsException that got subclassed into a Python Exception I guess we don't support for them to be picklable, while this tries to do it when passing errors between the runner and the host?

___________________________ test_hypothesis[firefox] ___________________________
pytest_pyodide/decorator.py:194: in test_hypothesis
    ???
pytest_pyodide/runner.py:212: in run_async
    return self.run_js(
pytest_pyodide/runner.py:249: in run_js
    return self.run_js_inner(code, check_code)
pytest_pyodide/runner.py:354: in run_js_inner
    raise JavascriptException(retval[1], retval[2])
E   pytest_pyodide.runner.JavascriptException: PythonError: Traceback (most recent call last):
E     File "<string>", line 104, in run_in_pyodide_main
E     File "/home/runner/work/pytest-pyodide/pytest-pyodide/tests/test_decorator.py", line 225, in test_hypothesis
E   pyodide.InternalError: Internal error occurred in compute_typeflags
E   
E   During handling of the above exception, another exception occurred:
E   
E   Traceback (most recent call last):
E     File "/lib/python3.10/asyncio/futures.py", line 201, in result
E       raise self._exception
E     File "/lib/python3.10/asyncio/tasks.py", line 232, in __step
E       result = coro.send(None)
E     File "<string>", line 116, in run_in_pyodide_main
E     File "<string>", line 75, in encode
E   _pickle.PicklingError: Can't pickle <class 'pyodide.InternalError'>: attribute lookup InternalError on pyodide failed

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce test_hypothesis in tests/test_decorator.py with Firefox, then inspect pytest_pyodide/runner.py and pytest_pyodide/decorator.py around run_async, run_js, and the failing error transfer. Trace how the InternalError is encoded and passed between the runner and host. Done means the test no longer fails with the _pickle.PicklingError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.