Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Call to _imp.source_hash with incorrect arguments in (unreachable?) part of SourceLoader.get_code (importlib._bootstrap_external) #99508

Closed
Labels
@DavidCEllis

Description

@DavidCEllis

Bug report

As far as I can tell this line:

source_hash=_imp.source_hash(source_bytes)

will raise a TypeError and should be a 2 argument form as seen earlier in the same method.

source_hash=_imp.source_hash(
_RAW_MAGIC_NUMBER,
source_bytes,
)

However, as eitherhash_based is False,source_hash has already been generated or the code returns early I don't think this line can be reached. (Maybe if you have a flaky version of get_data that sometimes raises an ImportError/EOFError??).

Example:

>>>_imp.source_hash(_RAW_MAGIC_NUMBER,b'')b's\x8d\x9c\xd5\xd5\xe8\x7fs'>>>_imp.source_hash(b'')Traceback (mostrecentcalllast):File"/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/code.py",line90,inruncodeexec(code,self.locals)File"<input>",line1,in<module>TypeError:source_hash()missingrequiredargument'source' (pos2)

Edit: Sorry, as I opened the issue from within the source line via 'reference in new issue' I think I accidentally skipped the bug report format that would have given this a label.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp