Closed pawamoy closed 5 months ago
The SystemError
s seem to come from pysource_codegen
itself:
Failing case with seed 538993
Traceback (most recent call last):
File "/media/data/dev/griffe/duties.py", line 325, in test_seed
visit("module", filepath=Path("/tmp/module.py"), code=generate(seed))
^^^^^^^^^^^^^^
File "/media/data/dev/griffe/__pypackages__/3.12/lib/pysource_codegen/_codegen.py", line 930, in generate
tree = generator.generate(root_node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/media/data/dev/griffe/__pypackages__/3.12/lib/pysource_codegen/_codegen.py", line 886, in generate
result = fix(result, parents)
^^^^^^^^^^^^^^^^^^^^
File "/media/data/dev/griffe/__pypackages__/3.12/lib/pysource_codegen/_codegen.py", line 752, in fix
compile(code, "<string>", "exec", dont_inherit=True)
SystemError: compiler_lookup_arg(name='name_1') with reftype=3 failed in <generic parameters of name_0>; freevars of code name_0: ('.type_params', 'name_1', 'name_3', 'name_4')
We will ignore them for now.
Erm, it looks like I can't regenerate the same code when debugging through VSCode... :face_exhaling:
Oh, OK, it actually depended on the Python version used.
Yes, it depends on the python version. Are you still using a 3.12 pre-release? This errors looking familiar to me. https://github.com/python/cpython/issues/109219
I put an quick implementation together based on your tweet which finds some errors #216. the pysource-minimize part is the important part here which gives you this nice small source codes.
Let me know how you want to integrate it. You can also take it from here if you want.
Yes I'm still using Python 3.12.0rc1, good catch! Will upgrade :slightly_smiling_face:
I eventually made use of pysource_minimize
, thank you again for showing me how to use it :slightly_smiling_face:
https://github.com/15r10nk/pysource-codegen :rocket:
We should reuse these seeds to investigate and fix any legitimate issue. At least we should catch the errors and log debug messages. @15r10nk recommends we minimize the generated code with pysource-minimize before debugging.