aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/difflib.py
Commit message (Collapse)AuthorAge
* gh-131204: Fix `difflib.HtmlDiff` may not use monospaced font (#131221)Wulian2332025-03-14
| | | | Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
* gh-93096: Remove CLI interface for `difflib` (#131099)donBarbos2025-03-13
|
* gh-129939: Add darkmode support for difflib's comparison pages (#129940)Wulian2332025-02-11
|
* gh-115801: Only allow sequence of strings as input for difflib.unified_diff ↵Pieter Eendebak2024-06-10
| | | | (GH-118333)
* gh-119105: Differ.compare is too slow [for degenerate cases] (#119492)Tim Peters2024-05-24
| | | | ``_fancy_replace()`` is no longer recursive. and a single call does a worst-case linear number of ratio() computations instead of quadratic. This renders toothless a universe of pathological cases. Some inputs may produce different output, but that's rare, and I didn't find a case where the final diff appeared to be of materially worse quality. To the contrary, by refusing to even consider synching on lines "far apart", there was more easy-to-digest locality in the output.
* gh-119105: difflib.py Differ.compare is too slow [for degenerate cases] ↵Tim Peters2024-05-22
| | | | | (#119376) Track all pairs achieving the best ratio in Differ(). This repairs the "very deep recursion and cubic time" bad cases in a way that preserves previous output.
* gh-119105: difflib: improve recursion for degenerate cases (#119131)pulkin2024-05-19
| | | | | | | | | Code from https://github.com/pulkin, in PR https://github.com/python/cpython/pull/119131 Greatly speeds `Differ` when there are many identically scoring pairs, by splitting the recursion near the inputs' midpoints instead of degenerating (as now) into just peeling off the first two lines. Co-authored-by: Tim Peters <tim.peters@gmail.com>
* Correct method name typo (#91970)Simon de Vlieger2022-04-27
|
* Fix typos in the Lib directory (GH-28775)Christian Clauss2021-10-06
| | | | | Fix typos in the Lib directory as identified by codespell. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* bpo-45216: Remove extraneous method docs from `difflib` (GH-28445)Nikita Sobolev2021-09-21
|
* bpo-40394 - difflib.SequenceMatched.find_longest_match default args (GH-19742)lrjball2020-04-29
| | | | | * bpo-40394 - difflib.SequenceMatched.find_longest_match default args Added default args to find_longest_match, as well as related tests.
* bpo-39481: PEP 585 for difflib, filecmp, fileinput (#19422)Ethan Smith2020-04-09
|
* bpo-38738: Fix formatting of True and False. (GH-17083)Serhiy Storchaka2019-11-12
| | | | | | | | | * "Return true/false" is replaced with "Return ``True``/``False``" if the function actually returns a bool. * Fixed formatting of some True and False literals (now in monospace). * Replaced "True/False" with "true/false" if it can be not only bool. * Replaced some 1/0 with True/False if it corresponds the code. * "Returns <bool>" is replaced with "Return <bool>".
* Fix difflib `?` hint in diff output when dealing with tabs (#15201)Anthony Sottile2019-08-21
|
* Revert "bpo-35603: Escape table header of make_table output that can cause ↵Serhiy Storchaka2019-01-02
| | | | | potential XSS. (GH-11341)" (GH-11356) This reverts commit 78de01198b047347abc5e458851bb12c48429e24.
* bpo-35603: Escape table header of make_table output that can cause potential ↵Xtreak2018-12-29
| | | | XSS. (GH-11341)
* bpo-33224: PEP 479 fix for difflib.mdiff() (GH-6381)Raymond Hettinger2018-04-05
|
* bpo-32981: Fix catastrophic backtracking vulns (#5955)Jamie Davis2018-03-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Prevent low-grade poplib REDOS (CVE-2018-1060) The regex to test a mail server's timestamp is susceptible to catastrophic backtracking on long evil responses from the server. Happily, the maximum length of malicious inputs is 2K thanks to a limit introduced in the fix for CVE-2013-1752. A 2KB evil response from the mail server would result in small slowdowns (milliseconds vs. microseconds) accumulated over many apop calls. This is a potential DOS vector via accumulated slowdowns. Replace it with a similar non-vulnerable regex. The new regex is RFC compliant. The old regex was non-compliant in edge cases. * Prevent difflib REDOS (CVE-2018-1061) The default regex for IS_LINE_JUNK is susceptible to catastrophic backtracking. This is a potential DOS vector. Replace it with an equivalent non-vulnerable regex. Also introduce unit and REDOS tests for difflib. Co-authored-by: Tim Peters <tim.peters@gmail.com> Co-authored-by: Christian Heimes <christian@python.org>
* bpo-29762: More use "raise from None". (#569)Serhiy Storchaka2017-04-05
| | | This hides unwanted implementation details from tracebacks.
* #27364: fix "incorrect" uses of escape character in the stdlib.R David Murray2016-09-08
| | | | | | | And most of the tools. Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and Martin Panter.
* Issue #25523: Merge "a" to "an" fixes from 3.4 into 3.5Martin Panter2015-11-02
|\
| * Issue #25523: Correct "a" article to "an" articleMartin Panter2015-11-02
| | | | | | | | | | | | This changes the main documentation, doc strings, source code comments, and a couple error messages in the test suite. In some cases the word was removed or edited some other way to fix the grammar.
* | Issue 24237: Raise PendingDeprecationWarning per PEP 479Yury Selivanov2015-05-22
| | | | | | | | | | | | | | | | | | Raise PendingDeprecationWarning when generator raises StopIteration and no __future__ import is used. Fix offenders in the stdlib and tests. See also issue 22906. Thanks to Nick Coghlan and Berker Peksag for reviews.
* | PEP 479: Change StopIteration handling inside generators.Yury Selivanov2015-05-09
| | | | | | | | Closes issue #22906.
* | #17445: difflib: add diff_bytes(), to compare bytes rather than strGreg Ward2015-04-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some applications (e.g. traditional Unix diff, version control systems) neither know nor care about the encodings of the files they are comparing. They are textual, but to the diff utility they are just bytes. This worked fine under Python 2, because all of the hardcoded strings in difflib.py are ASCII, so could safely be combined with old-style u'' strings. But it stopped working in 3.x. The solution is to use surrogate escapes for a lossless bytes->str->bytes roundtrip. That means {unified,context}_diff() can continue to just handle strings without worrying about bytes. Callers who have to deal with bytes will need to change to using diff_bytes(). Use case: Mercurial's test runner uses difflib to compare current hg output with known good output. But Mercurial's output is just bytes, since it can contain: * file contents (arbitrary unknown encoding) * filenames (arbitrary unknown encoding) * usernames and commit messages (usually UTF-8, but not guaranteed because old versions of Mercurial did not enforce it) * user messages (locale encoding) Since the output of any given hg command can include text in multiple encodings, it is hopeless to try to treat it as decodable Unicode text. It's just bytes, all the way down. This is an elaboration of a patch by Terry Reedy.
* | Issue #2052: Add charset parameter to HtmlDiff.make_file().Berker Peksag2015-03-15
| |
* | Use two-argument form of next() and use a return-statement instead of an ↵Raymond Hettinger2014-08-03
| | | | | | | | explicit raise StopIteration
* | Make the import private to keep the global namespace clean.Raymond Hettinger2014-08-03
| |
* | Use reversed() instead of creating a new temporary list.Raymond Hettinger2014-08-03
| |
* | mergeRaymond Hettinger2014-06-21
|\|
| * Issue 21635: Fix caching in difflib.SequenceMatcher.get_matching_blocks().Raymond Hettinger2014-06-21
| |
* | (Merge 3.4) Issue #20976: pyflakes: Remove unused importsVictor Stinner2014-03-20
|\|
| * Issue #20976: pyflakes: Remove unused importsVictor Stinner2014-03-20
| |
* | #14332: provide a better explanation of junk in difflib docsAndrew Kuchling2014-03-19
|/ | | | Initial patch by Alba Magallanes.
* Issue #19936: Added executable bits or shebang lines to Python scripts whichSerhiy Storchaka2014-01-16
|\ | | | | | | | | | | | | requires them. Disable executable bits and shebang lines in test and benchmark files in order to prevent using a random system python, and in source files of modules which don't provide command line interface. Fixed shebang lines in the unittestgui and checkpip scripts.
| * Issue #19936: Added executable bits or shebang lines to Python scripts whichSerhiy Storchaka2014-01-16
| | | | | | | | | | | | | | requires them. Disable executable bits and shebang lines in test and benchmark files in order to prevent using a random system python, and in source files of modules which don't provide command line interface. Fixed shebang line to use python3 executable in the unittestgui script.
* | #18705: merge with 3.3.Ezio Melotti2013-08-17
|\|
| * #18705: fix a number of typos. Patch by Févry Thibault.Ezio Melotti2013-08-17
| |
* | Issue #13248: removed deprecated and undocumented difflib.isbjunk, isbpopular.Terry Jan Reedy2013-03-19
| |
* | utilize yield fromPhilip Jenvey2012-10-01
|/
* Fix comment in difflib.Florent Xicluna2011-12-10
|
* #13012: use splitlines(keepends=True/False) instead of splitlines(0/1).Ezio Melotti2011-09-28
|
* Issue 11747: Fix output format for context diffs.Raymond Hettinger2011-04-12
|
* Issue #11747: Fix range formatting in context and unified diffs.Raymond Hettinger2011-04-11
|
* Cleanup and modernize code prior to working on Issue 11747.Raymond Hettinger2011-04-10
|
* #11565: Merge with 3.1.Ezio Melotti2011-03-16
|\
| * #11565: Fix several typos. Patch by Piotr Kasprzyk.Ezio Melotti2011-03-16
| |
| * Merged revisions 76469 via svnmerge fromSenthil Kumaran2009-11-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r76469 | senthil.kumaran | 2009-11-24 00:32:52 +0530 (Tue, 24 Nov 2009) | 10 lines Merged revisions 76464 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r76464 | senthil.kumaran | 2009-11-24 00:11:31 +0530 (Tue, 24 Nov 2009) | 4 lines Fix for issue1488943 - difflib.Differ() doesn't always add hints for tab characters. ........ ................
* | Issue 10534, difflib: tweak doc; test new SequenceMatcher instance ↵Terry Reedy2010-12-15
| | | | | | | | attributes; avoid unneeded lists of SM.b2j keys and items in .__chain_b. Do not backport.
* | Issue 10534 deprecate isbjunk and isbpopular methods.Terry Reedy2010-12-03
| | | | | | | | Will add gone in 3.3 test later.