File tree Expand file tree Collapse file tree 1 file changed +0
-27
lines changed Expand file tree Collapse file tree 1 file changed +0
-27
lines changed Original file line number Diff line number Diff line change @@ -425,33 +425,6 @@ whereas this PEP does not.
425
425
:pep: `558 ` does not specify exactly when the internal copy is
426
426
updated, making the behavior of :pep: `558 ` impossible to reason about.
427
427
428
- Open Issues
429
- ===========
430
-
431
- Have locals() return a mapping proxy
432
- ------------------------------------
433
-
434
- An alternative way to define ``locals() `` would be simply as::
435
-
436
- def locals():
437
- return sys._getframe(1).f_locals
438
-
439
- This would be simpler and easier to understand. However,
440
- there would be backwards compatibility issues when ``locals() `` is assigned
441
- to a local variable or passed to ``eval `` or ``exec ``.
442
-
443
- Lifetime of the mapping proxy
444
- -----------------------------
445
-
446
- Each read of the ``f_locals `` attributes creates a new mapping proxy.
447
- This is done to avoid creating a reference cycle.
448
-
449
- An alternative would be to cache the proxy on the frame, so that
450
- ``frame.f_locals is frame.f_locals `` would be true.
451
- The downside of this is that the reference cycle would delay collection
452
- of both the frame and mapping proxy until the next cycle collection.
453
-
454
- ``PyEval_GetLocals() `` already creates a cycle, as it returns a borrowed reference.
455
428
456
429
Implementation
457
430
==============
You can’t perform that action at this time.
0 commit comments