Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
950eddf0
Commit
950eddf0
authored
Jun 30, 2003
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix SF 762891: "del p[key]" on proxy object raises SystemError()
parent
9fd4444f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
1 deletion
+49
-1
Lib/test/test_weakref.py
Lib/test/test_weakref.py
+11
-0
Misc/NEWS
Misc/NEWS
+33
-0
Objects/weakrefobject.c
Objects/weakrefobject.c
+5
-1
No files found.
Lib/test/test_weakref.py
View file @
950eddf0
...
...
@@ -226,6 +226,17 @@ class ReferencesTestCase(TestBase):
self
.
assert_
(
not
hasattr
(
o
,
'foo'
),
"object does not reflect attribute removal via proxy"
)
def
test_proxy_deletion
(
self
):
# Test clearing of SF bug #762891
class
Foo
:
result
=
None
def
__delitem__
(
self
,
accessor
):
self
.
result
=
accessor
g
=
Foo
()
f
=
weakref
.
proxy
(
g
)
del
f
[
0
]
self
.
assertEqual
(
f
.
result
,
0
)
def
test_getweakrefcount
(
self
):
o
=
C
()
ref1
=
weakref
.
ref
(
o
)
...
...
Misc/NEWS
View file @
950eddf0
...
...
@@ -4,6 +4,39 @@ Python News
(
editors
:
check
NEWS
.
help
for
information
about
editing
NEWS
using
ReST
.)
What
's New in Python 2.3 release candidate?
===========================================
Core and builtins
-----------------
Extension modules
-----------------
- weakref.proxy() can now handle "del obj[i]" for proxy objects
defining __delitem__. Formerly, it generated a SystemError.
- SSL no longer crashes the interpreter when the remote side disconnects.
Library
-------
Tools/Demos
-----------
Build
-----
C API
-----
Windows
-------
Mac
---
What'
s
New
in
Python
2.3
beta
2
?
================================
...
...
Objects/weakrefobject.c
View file @
950eddf0
...
...
@@ -389,6 +389,10 @@ proxy_setitem(PyWeakReference *proxy, PyObject *key, PyObject *value)
{
if
(
!
proxy_checkref
(
proxy
))
return
-
1
;
if
(
value
==
NULL
)
return
PyObject_DelItem
(
PyWeakref_GET_OBJECT
(
proxy
),
key
);
else
return
PyObject_SetItem
(
PyWeakref_GET_OBJECT
(
proxy
),
key
,
value
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment