[issue45977] Unexpected effect of sys.pycache_prefix = ""

2021-12-11 Thread Andrei Kulakov
Andrei Kulakov added the comment: Thanks, I've misunderstood how it works. It makes sense now. Closing as not a bug. -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker

[issue45977] Unexpected effect of sys.pycache_prefix = ""

2021-12-06 Thread Christian Heimes
Christian Heimes added the comment: The cache prefix mirrors the directory structure. Python takes the absolute path to the .py file, converts the path to a relative path by stripping off the leading slash, and finally joins the path with the prefix. Take this example: $

[issue45977] Unexpected effect of sys.pycache_prefix = ""

2021-12-05 Thread Andrei Kulakov
Andrei Kulakov added the comment: Can this also create the risk of 'path too long' issues? -- ___ Python tracker ___ ___

[issue45977] Unexpected effect of sys.pycache_prefix = ""

2021-12-05 Thread Andrei Kulakov
Andrei Kulakov added the comment: If CWD=/a/b and pycache_prefix=c, the resulting dir is /a/b/c as I would expect. If CWD=/a/b and pycache_prefix='', I would expect resulting dir to be /a/b instead of /a/b/a/b . For example as the shell `cd` command accepts relative path as arg, I would

[issue45977] Unexpected effect of sys.pycache_prefix = ""

2021-12-05 Thread Christian Heimes
Christian Heimes added the comment: It works as designed and documented. An empty string is considered a relative directory. https://docs.python.org/3/library/sys.html#sys.pycache_prefix > If this is set (not None), Python will write bytecode-cache .pyc files to > (and read them from) a

[issue45977] Unexpected effect of sys.pycache_prefix = ""

2021-12-03 Thread Andrei Kulakov
Andrei Kulakov added the comment: (I forgot to mention this happens on MacOS). -- ___ Python tracker ___ ___ Python-bugs-list

[issue45977] Unexpected effect of sys.pycache_prefix = ""

2021-12-03 Thread Andrei Kulakov
New submission from Andrei Kulakov : Setting sys.pycache_prefix = "", re-creates CWD structure under current directory, e.g. if run from /Users/foo/test, will create /Users/foo/test/Users/foo/test/myfile.pyc . Is that intentional? It seems a little weird. At least it might be good to