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
42f58818
Commit
42f58818
authored
Apr 24, 2012
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Plain Diff
merge 3.2 (#14658)
parents
7ce67e45
7b166873
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
3 deletions
+18
-3
Lib/test/test_descr.py
Lib/test/test_descr.py
+9
-1
Misc/NEWS
Misc/NEWS
+6
-0
Objects/typeobject.c
Objects/typeobject.c
+3
-2
No files found.
Lib/test/test_descr.py
View file @
42f58818
...
...
@@ -4438,7 +4438,15 @@ order (MRO) for bases """
pass
Foo
.
__repr__
=
Foo
.
__str__
foo
=
Foo
()
str
(
foo
)
self
.
assertRaises
(
RuntimeError
,
str
,
foo
)
self
.
assertRaises
(
RuntimeError
,
repr
,
foo
)
def
test_mixing_slot_wrappers
(
self
):
class
X
(
dict
):
__setattr__
=
dict
.
__setitem__
x
=
X
()
x
.
y
=
42
self
.
assertEqual
(
x
[
"y"
],
42
)
def
test_slot_shadows_class_variable
(
self
):
with
self
.
assertRaises
(
ValueError
)
as
cm
:
...
...
Misc/NEWS
View file @
42f58818
...
...
@@ -14,6 +14,12 @@ Core and Builtins
their keys with other dictionaries. Classes take advantage of this to share
their instance dictionary keys for improved memory and performance.
- Issue #11603 (again): Setting __repr__ to __str__ now raises a RuntimeError
when repr() or str() is called on such an object.
- Issue #14658: Fix binding a special method to a builtin implementation of a
special method with a different name.
- Issue #14630: Fix a memory access bug for instances of a subclass of int
with value 0.
...
...
Objects/typeobject.c
View file @
42f58818
...
...
@@ -3035,7 +3035,7 @@ object_str(PyObject *self)
unaryfunc
f
;
f
=
Py_TYPE
(
self
)
->
tp_repr
;
if
(
f
==
NULL
||
f
==
object_str
)
if
(
f
==
NULL
)
f
=
object_repr
;
return
f
(
self
);
}
...
...
@@ -5879,7 +5879,8 @@ update_one_slot(PyTypeObject *type, slotdef *p)
}
continue
;
}
if
(
Py_TYPE
(
descr
)
==
&
PyWrapperDescr_Type
)
{
if
(
Py_TYPE
(
descr
)
==
&
PyWrapperDescr_Type
&&
((
PyWrapperDescrObject
*
)
descr
)
->
d_base
->
name_strobj
==
p
->
name_strobj
)
{
void
**
tptr
=
resolve_slotdups
(
type
,
p
->
name_strobj
);
if
(
tptr
==
NULL
||
tptr
==
ptr
)
generic
=
p
->
function
;
...
...
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