<p dir="ltr">You can look at <a href="https://docs.python.org/devguide/compiler.html">https://docs.python.org/devguide/compiler.html</a> to see if you missed something.</p>
<p dir="ltr">As for the _frozen_importlib problem, that typically manifests itself when you have invalid bytecode (that module is frozen bytecode that gets compiled into the interpreter and is the first bit of Python code that gets run).</p>
<br><div class="gmail_quote"><div dir="ltr">On Sun, 27 Dec 2015, 16:41 Guido van Rossum <<a href="mailto:gvanrossum@gmail.com">gvanrossum@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Can you show the diffs you have so far? Somebody's got to look at your code.</p>
<p dir="ltr">--Guido (mobile)</p>
<div class="gmail_quote"></div><div class="gmail_quote">On Dec 27, 2015 16:51, "Erik" <<a href="mailto:python@lucidity.plus.com" target="_blank">python@lucidity.plus.com</a>> wrote:<br type="attribution"></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks for your help so far (I'm experimenting with the peephole optimizer - hence my question before as I was trying to work out how to know what the small integer hard-coded offsets should be when looking ahead in the bytecode).<br>
<br>
<br>
I've successfully added a new opcode (generated by the optimizer and understood by the interpreter loop) but when adding a second I unexpectedly got the following error. I'm not doing anything different to what I did with the first opcode as far as I can tell (I have a TARGET(FOO) in ceval.c and have obviously defined the new opcode's value in opcode.h).<br>
<br>
<br>
"""<br>
./python -E -S -m sysconfig --generate-posix-vars ;\<br>
        if test $? -ne 0 ; then \<br>
                echo "generate-posix-vars failed" ; \<br>
                rm -f ./pybuilddir.txt ; \<br>
                exit 1 ; \<br>
        fi<br>
XXX lineno: 241, opcode: 1<br>
Fatal Python error: Py_Initialize: can't import _frozen_importlib<br>
Traceback (most recent call last):<br>
  File "<frozen importlib._bootstrap>", line 698, in <module><br>
  File "<frozen importlib._bootstrap>", line 751, in BuiltinImporter<br>
  File "<frozen importlib._bootstrap>", line 241, in _requires_builtin<br>
SystemError: unknown opcode<br>
Aborted (core dumped)<br>
generate-posix-vars failed<br>
make: *** [pybuilddir.txt] Error 1<br>
"""<br>
<br>
If I #ifdef out the code in peephole.c which generates my new (2nd) opcode, then the error does not occur. I tried a "make clean" first, but that didn't help (I realise that does not necessarily rule out a makefile dependency issue).<br>
<br>
Does anyone know if this is a well-known symptom of forgetting to add something somewhere when adding a new opcode, or do I need to track it down some more myself? I did not have this problem when introducing my first new opcode.<br>
<br>
Thanks, E.<br>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org" target="_blank">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/guido%40python.org" rel="noreferrer" target="_blank">https://mail.python.org/mailman/options/python-dev/guido%40python.org</a><br>
</blockquote></div>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org" target="_blank">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/brett%40python.org" rel="noreferrer" target="_blank">https://mail.python.org/mailman/options/python-dev/brett%40python.org</a><br>
</blockquote></div>