Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kirill Smelkov
cpython
Commits
70797194
Commit
70797194
authored
13 years ago
by
Raymond Hettinger
Browse files
Options
Download
Email Patches
Plain Diff
Issue 11802: filecmp cache was growing without bound.
parent
6ddefd79
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
Lib/filecmp.py
Lib/filecmp.py
+6
-5
No files found.
Lib/filecmp.py
View file @
70797194
...
...
@@ -48,11 +48,12 @@ def cmp(f1, f2, shallow=True):
if
s1
[
1
]
!=
s2
[
1
]:
return
False
result
=
_cache
.
get
((
f1
,
f2
))
if
result
and
(
s1
,
s2
)
==
result
[:
2
]:
return
result
[
2
]
outcome
=
_do_cmp
(
f1
,
f2
)
_cache
[
f1
,
f2
]
=
s1
,
s2
,
outcome
outcome
=
_cache
.
get
((
f1
,
f2
,
s1
,
s2
))
if
outcome
is
None
:
outcome
=
_do_cmp
(
f1
,
f2
)
if
len
(
_cache
)
>
100
:
# limit the maximum size of the cache
_cache
.
clear
()
_cache
[
f1
,
f2
,
s1
,
s2
]
=
outcome
return
outcome
def
_sig
(
st
):
...
...
This diff is collapsed.
Click to expand it.
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