classification
Title: compile_file's stripdir does not accept pathlib.Path
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: FFY00, hauntsaninja, xtreak
Priority: normal Keywords: patch

Created on 2020-04-30 06:18 by hauntsaninja, last changed 2020-05-03 12:55 by FFY00.

Pull Requests
URL Status Linked Edit
PR 19883 open FFY00, 2020-05-03 12:55
Messages (2)
msg367740 - (view) Author: Shantanu (hauntsaninja) * Date: 2020-04-30 06:18
Python 3.9 added the stripdir argument to compileall functions. From https://docs.python.org/3.9/library/compileall.html#compileall.compile_file:
> The stripdir, prependdir and limit_sl_dest arguments correspond to the -s, -p and -e options described above. They may be specified as str, bytes or os.PathLike.

```
~ λ python3.9
Python 3.9.0a6+ (heads/master:360371f, Apr 29 2020, 15:44:56) 
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import compileall, pathlib
>>> compileall.compile_file(pathlib.Path("tmp/test.py"), stripdir=pathlib.Path("tmp"))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/shantanu/.pyenv/versions/3.9-dev/lib/python3.9/compileall.py", line 161, in compile_file
    stripdir_parts = stripdir.split(os.path.sep)
AttributeError: 'PosixPath' object has no attribute 'split'
```

Found by Jelle Zijlstra in https://github.com/python/typeshed/pull/3956#discussion_r417735663
msg367741 - (view) Author: Shantanu (hauntsaninja) * Date: 2020-04-30 06:23
If it helps triage, this is the BPO for where the changes to compileall were made: https://bugs.python.org/issue38112
History
Date User Action Args
2020-05-03 12:55:07FFY00setkeywords: + patch
nosy: + FFY00

pull_requests: + pull_request19195
stage: patch review
2020-04-30 06:32:44xtreaksetnosy: + xtreak
type: behavior
2020-04-30 06:23:58hauntsaninjasetmessages: + msg367741
2020-04-30 06:18:15hauntsaninjacreate