[New-bugs-announce] [issue40074] pickle module dump and load: add support for string file names

Diego Palacios report at bugs.python.org
Thu Mar 26 07:25:16 EDT 2020


New submission from Diego Palacios <diepala at gmail.com>:

The pickle functions dump and load are often used in the following lines:

```python
import pickle

fname = '/path/to/file.pickle'

with open(fname, 'rb') as f:
    object = pickle.load(f)
```

The load function should also accept a file name (string) as input and automatically open and load the object. The same should happen for the dump function. This would allow a simple use of the functions:

```python
object = pickle.load(fname)
```

This is what many users need when reading and storing and object from/to a file.

----------
components: Library (Lib)
messages: 365061
nosy: Diego Palacios
priority: normal
severity: normal
status: open
title: pickle module dump and load: add support for string file names
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40074>
_______________________________________


More information about the New-bugs-announce mailing list