bottlepy / bottle

bottle.py is a fast and simple micro-framework for python web-applications.
http://bottlepy.org/
MIT License
8.33k stars 1.46k forks source link

Removed a pitfall where the code was using a default mutable argument #1355

Closed NaelsonDouglas closed 2 years ago

NaelsonDouglas commented 2 years ago

The problem In Python it usually dangerous to use mutable arguments like dicts or lists as default arguments in method, as is better explained here

the solution This PR applies a simple refactoring to remove a case where a method was created using default a mutable argument

defnull commented 2 years ago

The globals variable is not mutated and does not leave the local scope of the function. This is safe to do. The other change does not not seem to have any effect.