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

Regression of 3.13.1 for module paths in from import #127651

Closed
Labels
3.13bugs and security fixes3.14bugs and security fixestopic-importlibtype-bugAn unexpected behavior, bug, or error
@kayhayen

Description

@kayhayen

Bug report

Bug description:

importosprint("FILE",os.__file__,os.__spec__)deflocalImportFailure():try:fromosimportlistdir,listdir2,pathexceptExceptionase:print("gives",type(e),repr(e))print("From import that fails in the middle",end=" ")localImportFailure()

This code outputs with 3.13.1 the following:

FILE C:\Python313_64\Lib\os.py ModuleSpec(name='os', loader=<class '_frozen_importlib.FrozenImporter'>, origin='frozen')From import that fails in the middle gives <class 'ImportError'> ImportError("cannot import name 'listdir2' from 'os' (unknown location)")

As you can see, the__file__ and__spec__ values are fine. I found this in a regression test of Nuitka which worked with 3.13.1 and all Python versions before, giving the proper path from Python (which I use as a test oracle to know what the behavior to compare against is).

From my look at the code, this "unknown location" is coming from a code path, that tries to recognize shadowed stdlib modules, a new feature added in 3.13.1, can you please consider repairing it for 3.13.2, as I think file paths are very important part of exceptions for developers.

The issue is not OS specific. It only occurs with 3.13.1, not with 3.13.0.

CPython versions tested on:

3.13

Operating systems tested on:

Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixestopic-importlibtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp