[pypy-issue] Issue #2985: pypy3.6: `os.replace(..., pathlike)`: TypeError: 'PosixPath' does not support the buffer interface (pypy/pypy)

Anthony Sottile issues-reply at bitbucket.org
Sun Mar 31 15:33:59 EDT 2019


New issue 2985: pypy3.6: `os.replace(..., pathlike)`: TypeError: 'PosixPath' does not support the buffer interface
https://bitbucket.org/pypy/pypy/issues/2985/pypy36-osreplace-pathlike-typeerror

Anthony Sottile:

### sample script

```python
import os
import pathlib

open('a', 'a+').close()
os.replace('a', pathlib.Path('b'))
```

### pypy output

```console
$ ./pypy3.6-v7.1.0-linux64/bin/pypy3 --version
Python 3.6.1 (de061d87e39c, Mar 24 2019, 22:18:07)
[PyPy 7.1.0-beta0 with GCC 6.2.0 20160901]
$ ./pypy3.6-v7.1.0-linux64/bin/pypy3 x.py 
Traceback (most recent call last):
  File "x.py", line 5, in <module>
    os.replace('a', pathlib.Path('b'))
TypeError: 'PosixPath' does not support the buffer interface
```

### cpython output

```console
$ python3.6 --version --version
Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0]
$ python3.6 x.py 
$
```

### misc

this was noticed while attempting to use https://github.com/ambv/black using pypy3.6

### guess

my guess is this hasn't been updated from the changes in python3.6 as the error message matches exactly what is happening on pypy3.5:

```
$ pypy3 --version
Python 3.5.3 (fdd60ed87e94, Apr 24 2018, 06:10:04)
[PyPy 6.0.0 with GCC 6.2.0 20160901]
$ pypy3 x.py 
Traceback (most recent call last):
  File "x.py", line 5, in <module>
    os.replace('a', pathlib.Path('b'))
TypeError: 'PosixPath' does not support the buffer interface

$ python3.5 --version --version
Python 3.5.7
$ python3.5 x.py 
Traceback (most recent call last):
  File "x.py", line 5, in <module>
    os.replace('a', pathlib.Path('b'))
TypeError: replace: illegal type for dst parameter
```




More information about the pypy-issue mailing list