[issue27512] os.fspath is certain to crash when exception raised in __fspath__

Xiang Zhang report at bugs.python.org
Thu Jul 14 05:28:13 EDT 2016


New submission from Xiang Zhang:

When any exception is raised inside __fspath__, operations involving it like os.fspath, open are certain to crash.

>>> import os
>>> class Test:
...     def __fspath__(self):
...             raise RuntimeError
... 
>>> os.fspath(Test())
Segmentation fault (core dumped)

Attach a patch to fix this.

----------
components: Extension Modules
files: fix_fspath_crash.patch
keywords: patch
messages: 270386
nosy: brett.cannon, ethan.furman, xiang.zhang
priority: normal
severity: normal
status: open
title: os.fspath is certain to crash when exception raised in __fspath__
type: crash
versions: Python 3.6
Added file: http://bugs.python.org/file43713/fix_fspath_crash.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27512>
_______________________________________


More information about the Python-bugs-list mailing list