summaryrefslogtreecommitdiffstats
path: root/Lib/difflib.py
Commit message (Collapse)AuthorAgeFilesLines
* Correct method name typo (#91970)Simon de Vlieger2022-04-271-1/+1
|
* Fix typos in the Lib directory (GH-28775)Christian Clauss2021-10-061-1/+1
| | | | | 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-211-40/+0
|
* bpo-40394 - difflib.SequenceMatched.find_longest_match default args (GH-19742)lrjball2020-04-301-2/+8
| | | | | * 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-101-0/+4
|
* bpo-38738: Fix formatting of True and False. (GH-17083)Serhiy Storchaka2019-11-121-2/+2
| | | | | | | | | * "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-211-22/+11
|
* Revert "bpo-35603: Escape table header of make_table output that can cause ↵Serhiy Storchaka2019-01-021-4/+0
| | | | | 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-291-0/+4
| | | | XSS. (GH-11341)
* bpo-33224: PEP 479 fix for difflib.mdiff() (GH-6381)Raymond Hettinger2018-04-051-8/+12
|
* bpo-32981: Fix catastrophic backtracking vulns (#5955)Jamie Davis2018-03-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-051-1/+1
| | | This hides unwanted implementation details from tracebacks.
* #27364: fix "incorrect" uses of escape character in the stdlib.R David Murray2016-09-081-1/+1
| | | | | | | 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-021-1/+1
|\
| * Issue #25523: Correct "a" article to "an" articleMartin Panter2015-11-021-1/+1
| | | | | | | | | | | | 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-221-2/+8
| | | | | | | | | | | | | | | | | | 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-091-2/+1
| | | | | | | | Closes issue #22906.
* | #17445: difflib: add diff_bytes(), to compare bytes rather than strGreg Ward2015-04-211-1/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-141-8/+11
| |
* | Use two-argument form of next() and use a return-statement instead of an ↵Raymond Hettinger2014-08-041-5/+2
| | | | | | | | explicit raise StopIteration
* | Make the import private to keep the global namespace clean.Raymond Hettinger2014-08-041-2/+2
| |
* | Use reversed() instead of creating a new temporary list.Raymond Hettinger2014-08-041-1/+1
| |
* | mergeRaymond Hettinger2014-06-211-2/+2
|\ \ | |/
| * Issue 21635: Fix caching in difflib.SequenceMatcher.get_matching_blocks().Raymond Hettinger2014-06-211-2/+2
| |
* | (Merge 3.4) Issue #20976: pyflakes: Remove unused importsVictor Stinner2014-03-201-1/+0
|\ \ | |/
| * Issue #20976: pyflakes: Remove unused importsVictor Stinner2014-03-201-1/+0
| |
* | #14332: provide a better explanation of junk in difflib docsAndrew Kuchling2014-03-191-13/+13
|/ | | | Initial patch by Alba Magallanes.
* Issue #19936: Added executable bits or shebang lines to Python scripts whichSerhiy Storchaka2014-01-161-2/+0
|\ | | | | | | | | | | | | 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-161-2/+0
| | | | | | | | | | | | | | 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-171-3/+3
|\ \ | |/
| * #18705: fix a number of typos. Patch by Févry Thibault.Ezio Melotti2013-08-171-3/+3
| |
* | Issue #13248: removed deprecated and undocumented difflib.isbjunk, isbpopular.Terry Jan Reedy2013-03-191-14/+0
| |
* | utilize yield fromPhilip Jenvey2012-10-011-14/+7
|/
* Fix comment in difflib.Florent Xicluna2011-12-101-2/+1
|
* #13012: use splitlines(keepends=True/False) instead of splitlines(0/1).Ezio Melotti2011-09-281-10/+10
|
* Issue 11747: Fix output format for context diffs.Raymond Hettinger2011-04-121-5/+25
|
* Issue #11747: Fix range formatting in context and unified diffs.Raymond Hettinger2011-04-111-11/+23
|
* Cleanup and modernize code prior to working on Issue 11747.Raymond Hettinger2011-04-111-26/+27
|
* #11565: Merge with 3.1.Ezio Melotti2011-03-161-1/+1
|\
| * #11565: Fix several typos. Patch by Piotr Kasprzyk.Ezio Melotti2011-03-161-1/+1
| |
| * Merged revisions 76469 via svnmerge fromSenthil Kumaran2009-11-231-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-151-4/+6
| | | | | | | | 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-031-17/+16
| | | | | | | | Will add gone in 3.3 test later.
* | (no commit message)Terry Reedy2010-12-031-2/+6
| |
* | Issue 2986: Add autojunk paramater to SequenceMatcher to turn off heuristic. ↵Terry Reedy2010-11-251-37/+36
| | | | | | | | Patch by Terry Reedy, Eli Bendersky, and Simon Cross
* | Merged revisions 80004 via svnmerge fromR. David Murray2010-04-121-16/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r80004 | r.david.murray | 2010-04-12 12:35:19 -0400 (Mon, 12 Apr 2010) | 13 lines Issue #7585: use tab between components in unified and context diff headers. Instead of spaces between the filename and date (or whatever the string is that follows the filename, if any) use tabs. This is what the unix 'diff' command does, for example, and difflib was intended to follow the 'standard' way of doing diffs. This improves compatibility with patch tools. The docs and examples are also changed to recommended that the date format used be the ISO 8601 format, which is what modern diff tools emit by default. Patch by Anatoly Techtonik. ........
* | convert shebang lines: python -> python3Benjamin Peterson2010-03-111-1/+1
| |
* | Merged revisions 76464 via svnmerge fromSenthil Kumaran2009-11-231-4/+5
|/ | | | | | | | | | | 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. ........
* Merged revisions 69846 via svnmerge fromMark Dickinson2009-02-211-1/+1
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r69846 | mark.dickinson | 2009-02-21 20:27:01 +0000 (Sat, 21 Feb 2009) | 2 lines Issue #5341: Fix a variety of spelling errors. ........
* Merged revisions 59883-59920 via svnmerge fromChristian Heimes2008-01-111-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r59887 | neal.norwitz | 2008-01-10 06:42:58 +0100 (Thu, 10 Jan 2008) | 1 line Reword entry, not sure I made it much better though. ........ r59888 | andrew.kuchling | 2008-01-10 14:37:12 +0100 (Thu, 10 Jan 2008) | 1 line Check for fd of -1 to save fsync() and fstat() call ........ r59891 | thomas.heller | 2008-01-10 19:45:40 +0100 (Thu, 10 Jan 2008) | 1 line Reflow a paragraph, and fix a typo. ........ r59892 | raymond.hettinger | 2008-01-10 20:15:10 +0100 (Thu, 10 Jan 2008) | 1 line Examples for named tuple subclassing should include __slots__ ........ r59895 | raymond.hettinger | 2008-01-10 21:37:12 +0100 (Thu, 10 Jan 2008) | 1 line Clarify how to add a field to a named tuple. ........ r59896 | amaury.forgeotdarc | 2008-01-10 22:59:42 +0100 (Thu, 10 Jan 2008) | 12 lines Closing issue1761. Surprising behaviour of the "$" regexp: it matches the end of the string, AND just before the newline at the end of the string:: re.sub('$', '#', 'foo\n') == 'foo#\n#' Python is consistent with Perl and the pcre library, so we just document it. Guido prefers "\Z" to match only the end of the string. ........ r59898 | raymond.hettinger | 2008-01-11 00:00:01 +0100 (Fri, 11 Jan 2008) | 1 line Neaten-up the named tuple docs ........ r59900 | raymond.hettinger | 2008-01-11 01:23:13 +0100 (Fri, 11 Jan 2008) | 1 line Run doctests on the collections module ........ r59903 | raymond.hettinger | 2008-01-11 02:25:54 +0100 (Fri, 11 Jan 2008) | 1 line Doctest results return a named tuple for readability ........ r59904 | raymond.hettinger | 2008-01-11 03:12:33 +0100 (Fri, 11 Jan 2008) | 1 line Comment-out missing constant (from rev 59819) ........ r59905 | raymond.hettinger | 2008-01-11 03:24:13 +0100 (Fri, 11 Jan 2008) | 1 line Have Decimal.as_tuple return a named tuple. ........ r59906 | raymond.hettinger | 2008-01-11 04:04:50 +0100 (Fri, 11 Jan 2008) | 1 line Let most inspect functions return named tuples ........ r59907 | raymond.hettinger | 2008-01-11 04:20:54 +0100 (Fri, 11 Jan 2008) | 1 line Improve usability of the SequenceMatcher by returning named tuples describing match ranges. ........ r59909 | thomas.heller | 2008-01-11 09:04:03 +0100 (Fri, 11 Jan 2008) | 1 line Add an important missing blank. ........ r59910 | georg.brandl | 2008-01-11 10:19:11 +0100 (Fri, 11 Jan 2008) | 2 lines Guard definition of TIPC_SUB_CANCEL with an #ifdef. ........ r59911 | georg.brandl | 2008-01-11 10:20:58 +0100 (Fri, 11 Jan 2008) | 2 lines News entries for rev. 5990[567]. ........ r59912 | georg.brandl | 2008-01-11 10:55:53 +0100 (Fri, 11 Jan 2008) | 2 lines Documentation for r5990[3567]. ........ r59913 | thomas.heller | 2008-01-11 13:41:39 +0100 (Fri, 11 Jan 2008) | 4 lines The sqlite3 dll, when compiled in debug mode, must be linked with /MDd to use the debug runtime library. Further, the dll will be named sqlite3_d.dll. ........ r59919 | thomas.heller | 2008-01-11 16:38:46 +0100 (Fri, 11 Jan 2008) | 6 lines Revert revision 59913, because it was wrong: The sqlite3 dll, when compiled in debug mode, must be linked with /MDd to use the debug runtime library. Further, the dll will be named sqlite3_d.dll. ........ r59920 | christian.heimes | 2008-01-11 16:42:29 +0100 (Fri, 11 Jan 2008) | 1 line Removed unused variable ........