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

os.path.realpath() RecursionError #128098

Closed as duplicate
Closed as duplicate
Labels
3.12only security fixes3.13bugs and security fixes3.14bugs and security fixesextension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error
@jwilk

Description

@jwilk

os.path.realpath() attempts to detect symlink loops, but this is not bulletproof;
it's possible to make it fall into infinite recursion.

Reproducer:

importosimporttempfilewithtempfile.TemporaryDirectory()astmpdir:os.chdir(tmpdir)os.symlink('../'* (1+tmpdir.count('/'))+f'{tmpdir}/d','d')os.path.realpath('d')

Traceback:

Traceback (most recent call last):  File".../recursiverealpath.py", line7, in<module>    os.path.realpath('d')  File"<frozen posixpath>", line427, inrealpath  File"<frozen posixpath>", line487, in_joinrealpath  File"<frozen posixpath>", line487, in_joinrealpath  File"<frozen posixpath>", line487, in_joinrealpath  [Previous line repeated 993 more times]  File"<frozen posixpath>", line442, in_joinrealpath  File"<frozen posixpath>", line63, inisabsRecursionError:maximum recursion depth exceeded

Tested with Python 3.12.8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13bugs and security fixes3.14bugs and security fixesextension-modulesC modules in the Modules dirtype-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