Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getcwd problem does not return cwd #58188

Closed
fif0 mannequin opened this issue Feb 9, 2012 · 2 comments
Closed

getcwd problem does not return cwd #58188

fif0 mannequin opened this issue Feb 9, 2012 · 2 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@fif0
Copy link
Mannequin

fif0 mannequin commented Feb 9, 2012

BPO 13980
Nosy @bitdancer
Files
  • maybe_a_bug.py
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2012-02-09.22:40:50.992>
    created_at = <Date 2012-02-09.22:12:58.072>
    labels = ['interpreter-core', 'invalid']
    title = 'getcwd problem does not return cwd'
    updated_at = <Date 2012-02-09.22:40:50.990>
    user = 'https://bugs.python.org/fif0'

    bugs.python.org fields:

    activity = <Date 2012-02-09.22:40:50.990>
    actor = 'r.david.murray'
    assignee = 'none'
    closed = True
    closed_date = <Date 2012-02-09.22:40:50.992>
    closer = 'r.david.murray'
    components = ['Interpreter Core']
    creation = <Date 2012-02-09.22:12:58.072>
    creator = 'fif0'
    dependencies = []
    files = ['24472']
    hgrepos = []
    issue_num = 13980
    keywords = []
    message_count = 2.0
    messages = ['152991', '152995']
    nosy_count = 2.0
    nosy_names = ['r.david.murray', 'fif0']
    pr_nums = []
    priority = 'normal'
    resolution = 'not a bug'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue13980'
    versions = ['Python 2.7']

    @fif0
    Copy link
    Mannequin Author

    fif0 mannequin commented Feb 9, 2012

    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.

    @fif0 fif0 mannequin added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Feb 9, 2012
    @fif0 fif0 mannequin changed the title getcwd problem getcwd problem does not return cwd Feb 9, 2012
    @bitdancer
    Copy link
    Member

    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).

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    interpreter-core (Objects, Python, Grammar, and Parser dirs)
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant