Eduardo

Please open a GitHub issue for this and mention me on it (@Legorooj).

Thanks,



Jasper Harrison, aka Legorooj


Core Developer on PyInstaller

https://legorooj.net







\-------- Original Message --------
On Aug 31, 2022, 22:23, epri < pollo.epri...@gmail.com> wrote:

>
> Wasn't sure whether or not to make this an issue so posting this here first.
>
>
>
>
> PyInstaller version: 4.10
>
> Version of Python: 3.6.8
>
> Platform: Windows 10
>
> Python installed from: python.org
>
> Didn't try on another platform.
>
> Will try development version if necessary.
>
>
>
>
> Clean installation.
>
> Ran program from command window
>
> Used --onedir mode
>
>
>
>
> Error:
>
> \\site-packages\\PyInstaller\\lib\\modulegraph\\modulegraph.py", line 2771, 
> in \_scan\_bytecode
> assert prev\_insts\[-2\].opname == 'LOAD\_CONST'
> AssertionError
>
>
>
>
>
> Command line used: pyinstaller -F --clean --paths \{paths --collect-all 
> \{name1\} --collect-all \{name2\} script.py
>
>
>
>
> **The problem arises when using .pyc files for the modules in *name1* and 
> *name2*.**
>
> **The problem does not occur when I comment out [this][] line in 
> *modulegraph.py*.**
>
>  *  When I run pyinstaller without line 2764 (linked above), everything runs 
> to completion and the executable generated works as intended.
>
> I've been trying to look through previous commits to try and understand the 
> reason for the **assert** statement and why it is necessary. Could it perhaps 
> no longer be necessary?
>
>
>
>
> The *prev\_insts\[-2\].opname* variable is equal to **EXTENDED\_ARG** thus 
> causing the assert statement to fail.
>
>
>
>
> There's been a few issues before related to extend\_arg but not my exact 
> problem as well as commits.
>
> 1.  [Link][]
> 2.  [Link][Link 1]
> 3.  And this [link][] seems to be the commit for the first variation of the 
> *LOAD\_CONST* assert but it's not clear to me why it's there.
>
> Based on what I found in PyInstaller's current *[bytecode.py][]*, it does 
> seem like this line may need to be expanded on:
>
> The biggest clarity killer here is the \`\`EXTENDED\_ARG\`\` opcode which can 
> appear almost anywhere and therefore needs to be tiptoed around at every 
> step. If this code needs to expand significantly, I would recommend an 
> upgrade to a regex-based grammar parsing library such as Reparse. This way, 
> little steps like unpacking \`\`EXTENDED\_ARGS\`\` can be defined once then 
> simply referenced forming a nice hierarchy rather than copied everywhere its 
> needed.
>
>
>
>
>
> Could you please provide some information about why this type of opcode 
> requires an exception to be thrown and why PyInstaller works when the 
> assertion is removed? Or just confirm with me whether or not it is safe for 
> me to continue on with the line removed? Or even just a way to avoid running 
> into this exception?
>
>
>
>
> [Reference][] to extended\_arg from *dis.py*.
>
>
>
>
> Thank you,
>
>
>
>
> Eduardo
>
> \--
> You received this message because you are subscribed to the Google Groups 
> "PyInstaller" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to 
> [pyinstaller+unsubscr...@googlegroups.com][pyinstaller_unsubscribe_googlegroups.com].
> To view this discussion on the web visit 
> [https://groups.google.com/d/msgid/pyinstaller/6a5e44bd-ba26-433e-9048-22cea77326c9n%40googlegroups.com][https_groups.google.com_d_msgid_pyinstaller_6a5e44bd-ba26-433e-9048-22cea77326c9n_40googlegroups.com].
>


[this]: 
https://github.com/pyinstaller/pyinstaller/blob/3ea48fd875e786ecbb3c160209791aa11d55ae99/PyInstaller/lib/modulegraph/modulegraph.py#L2764
[Link]: https://github.com/pyinstaller/pyinstaller/pull/5830
[Link 1]: 
https://github.com/pyinstaller/pyinstaller/issues/6301#issuecomment-962519524
[link]: 
https://github.com/pyinstaller/pyinstaller/commit/ed732c92eded85e6bca4232eedefee2906bbfa52
[bytecode.py]: 
https://github.com/pyinstaller/pyinstaller/blob/1e6a8d53f150cf24b574c32085f3745cbd2afaa6/PyInstaller/depend/bytecode.py#L13
[Reference]: 
https://docs.python.org/3/library/dis.html?highlight=load_const#opcode-LOAD_CONST
[pyinstaller_unsubscribe_googlegroups.com]: 
mailto:pyinstaller+unsubscr...@googlegroups.com
[https_groups.google.com_d_msgid_pyinstaller_6a5e44bd-ba26-433e-9048-22cea77326c9n_40googlegroups.com]:
 
https://groups.google.com/d/msgid/pyinstaller/6a5e44bd-ba26-433e-9048-22cea77326c9n%40googlegroups.com?utm_medium=email&utm_source=footer

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pyinstaller+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyinstaller/jNNhmh2PvbeqBAIZJp85vwi1sPijTDXKsUZdae9xxLVnhNVIuunlqxLHdbEvZ_zMXRZsacweysdRDnpoNrVhGcieE0JvtKwU6Li1yQkZbXE%3D%40protonmail.com.

Attachment: publickey - EmailAddress(s=legorooj@protonmail.com) - 0x164CF234.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to