Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5dd3673

Browse files
gh-74929: Remove undesirable DECREF in PEP 667 implementation (#118583)
With tests.
1 parent1b22d80 commit5dd3673

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

‎Lib/test/test_frame.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,21 @@ def f():
364364
c=0
365365
f()
366366

367+
deftest_local_objects(self):
368+
o=object()
369+
k='.'.join(['a','b','c'])
370+
f_locals=sys._getframe().f_locals
371+
f_locals['o']=f_locals['k']
372+
self.assertEqual(o,'a.b.c')
373+
374+
deftest_update_with_self(self):
375+
deff():
376+
f_locals=sys._getframe().f_locals
377+
f_locals.update(f_locals)
378+
f_locals.update(f_locals)
379+
f_locals.update(f_locals)
380+
f()
381+
367382
deftest_repr(self):
368383
x=1
369384
# Introduce a reference cycle

‎Objects/frameobject.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ framelocalsproxy_setitem(PyObject *self, PyObject *key, PyObject *value)
171171
}elseif (value!=oldvalue) {
172172
Py_XSETREF(fast[i],Py_NewRef(value));
173173
}
174-
Py_XDECREF(value);
175174
return0;
176175
}
177176
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp