This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: kwarg default value expression incorrectly evaluated
Type: behavior Stage: resolved
Components: Parser Versions: Python 3.10
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: lys.nikolaou, moefear85, pablogsal
Priority: normal Keywords:

Created on 2021-11-22 12:32 by moefear85, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (1)
msg406765 - (view) Author: Muhamed Itani (moefear85) Date: 2021-11-22 12:32
I have an MPYFrame class that inherits from tkinter.Frame. It's init looks like this:

from os.path import normcase,normpath
def __init__(self,master=None,port=None,baudrate=115200,timeout=1,localFolder=normcase(normpath(os.getcwd()))):

The problem is, when I check/access the value of localFolder later in the code (even directly as a first statement within __init__), it is obvious that os.getcwd() is executing, but normcase and/or normpath are not. The resulting path contains capital letters (tested on Windows 11), even though it should not. If I run:
localFolder=normcase(normpath(localFolder))

as a first statement after init, then check the value of localFolder (for example at a debugging breakpoint), it correctly then contains a normalized path in which all letters have been converted to lowercase (but only after the statement itself has executed).
History
Date User Action Args
2022-04-11 14:59:52adminsetgithub: 90025
2021-11-22 12:46:03moefear85setfiles: - mpyFrame.pyw
2021-11-22 12:45:29moefear85setstatus: open -> closed
resolution: not a bug
stage: resolved
2021-11-22 12:32:27moefear85create