Modifying an outer variable inside a function without explicit global or nonlocal keywords.
Python treats any variable assigned anywhere within a function as a local variable for that entire function scope. If you try to read that variable before the assignment line executes, Python raises `UnboundLocalError`.
This happens when you try to increment or modify a global/outer variable inside a function (e.g., `counter += 1`) without first declaring `global counter` or `nonlocal counter`.
1count = 02 3def increment():4 # Attempting to read 'count' before assignment in local scope!5 count += 16 7increment()1count = 02 3def increment():4 global count5 count += 16 7increment()8print(count) # Output: 1Simulate standard system builds to trigger compiler trace records and track memory crashes locally.
Because `count += 1` contains an assignment (`count = count + 1`), Python classifies `count` as a local variable inside `increment()`. When evaluating `count + 1`, local `count` has not been assigned yet.