Content-Length: 298851 | pFad | https://github.com/python/cpython/issues/136523

ad Exception raised from `Wave_write.__del__()` after failed attempt to open file for write operation · Issue #136523 · python/cpython · GitHub
Skip to content

Exception raised from Wave_write.__del__() after failed attempt to open file for write operation #136523

Description

@cristian64

Bug report

Bug description:

Consider a Python script with the following content:

import wave

try:
    with wave.open('/unwritable_path.wav', 'wb') as f:
        pass  # Not reachable, open() should have raised by now
except PermissionError:
    pass

When executed in a Python interpreter, an exception is raised on exit from Wave_write.__del__():

Exception ignored in: <function Wave_write.__del__ at 0x000001CA3478B740>
Traceback (most recent call last):
  File "C:\Python313\Lib\wave.py", line 469, in __del__
    self.close()
  File "C:\Python313\Lib\wave.py", line 592, in close
    if self._file:
AttributeError: 'Wave_write' object has no attribute '_file'

CPython versions tested on:

3.12, 3.13

Operating systems tested on:

Linux, Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









    ApplySandwichStrip

    pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


    --- a PPN by Garber Painting Akron. With Image Size Reduction included!

    Fetched URL: https://github.com/python/cpython/issues/136523

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy