Issue 13980: getcwd problem does not return cwd (original) (raw)

Issue13980

Created on 2012-02-09 22:12 by fif0, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
maybe_a_bug.py fif0,2012-02-09 22:12
Messages (2)
msg152991 - (view) Author: (fif0) Date: 2012-02-09 22:12
Please take a look at the detached file. At the first call of the methode foo(), path and the second getcwd are the same. After the directory change, the default value path is not the the current working directory.
msg152995 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-02-09 22:40
That's just how function definitions in Python work. The prototype is evaluated when the function is defined, not when it is run, so the default value of path will always be the value of getcwd at the time the function *defintion* is done (which will generally be the CWD when python starts, unless you are defining functions at runtime).
History
Date User Action Args
2022-04-11 14:57:26 admin set github: 58188
2012-02-09 22:40:50 r.david.murray set status: open -> closednosy: + r.david.murraymessages: + resolution: not a bugstage: resolved
2012-02-09 22🔞02 fif0 set title: getcwd problem -> getcwd problem does not return cwd
2012-02-09 22:12:58 fif0 create