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
cb19d44a
Commit
cb19d44a
authored
Apr 08, 1993
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug in class instance hash (forgot to clear error condition).
parent
5d16a779
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
Objects/classobject.c
Objects/classobject.c
+8
-3
No files found.
Objects/classobject.c
View file @
cb19d44a
...
...
@@ -317,7 +317,7 @@ instance_hash(inst)
{
object
*
func
;
object
*
res
;
int
outcome
;
long
outcome
;
func
=
instance_getattr
(
inst
,
"__hash__"
);
if
(
func
==
NULL
)
{
...
...
@@ -325,8 +325,13 @@ instance_hash(inst)
If a __cmp__ method exists, there must be a __hash__. */
err_clear
();
func
=
instance_getattr
(
inst
,
"__cmp__"
);
if
(
func
==
NULL
)
return
(
long
)
inst
;
if
(
func
==
NULL
)
{
err_clear
();
outcome
=
(
long
)
inst
;
if
(
outcome
==
-
1
)
outcome
=
-
2
;
return
outcome
;
}
err_setstr
(
TypeError
,
"unhashable instance"
);
return
-
1
;
}
...
...
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