]> granicus.if.org Git - python/commitdiff
Issue #15539: Fix a number of bugs in Tools/scripts/pindent.py.
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 11 Jan 2013 10:12:32 +0000 (12:12 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Fri, 11 Jan 2013 10:12:32 +0000 (12:12 +0200)
Now pindent.py works with a "with" statement.  pindent.py no longer produces
improper indentation.  pindent.py now works with continued lines broken after
"class" or "def" keywords and with continuations at the start of line.  Added
regression tests for pindent.py.  Modernized pindent.py.

1  2 
Misc/NEWS
Tools/scripts/pindent.py

diff --cc Misc/NEWS
index f1f3039c4eaf3e04ff38ea547ba4ed132d5638cc,c32428201211bba15027323dae711c33b9f12f15..691d72759c6dcfd64b5d56e508aed26ad7a84eb1
+++ b/Misc/NEWS
@@@ -621,8 -424,8 +621,10 @@@ Extension Module
  Tests
  -----
  
+ - Issue #15539: Added regression tests for Tools/scripts/pindent.py.
 +- Issue #16836: Enable IPv6 support even if IPv6 is disabled on the build host.
 +
  - Issue #16925: test_configparser now works with unittest test discovery.
    Patch by Zachary Ware.
  
@@@ -777,22 -573,13 +779,27 @@@ Documentatio
  Tools/Demos
  -----------
  
+ - Issue #15539: Fix a number of bugs in Tools/scripts/pindent.py.  Now
+   pindent.py works with a "with" statement.  pindent.py no longer produces
+   improper indentation.  pindent.py now works with continued lines broken after
+   "class" or "def" keywords and with continuations at the start of line.
 +- Issue #11797: Add a 2to3 fixer that maps reload() to imp.reload().
 +
 +- Issue #10966: Remove the concept of unexpected skipped tests.
 +
 +- Issue #9893: Removed the Misc/Vim directory.
 +
 +- Removed the Misc/TextMate directory.
 +
 +- Issue #16245: Add the Tools/scripts/parse_html5_entities.py script to parse
 +  the list of HTML5 entities and update the html.entities.html5 dictionary.
 +
  - Issue #15378: Fix Tools/unicode/comparecodecs.py.  Patch by Serhiy Storchaka.
  
 +- Issue #13301: use ast.literal_eval() instead of eval() in Tools/i18n/msgfmt.py
 +  Patch by Serhiy Storchaka.
 +
  
  What's New in Python 3.3.0?
  ===========================
index 0151773de20fbbe83f27b61177ec6ae8e1f295a5,fd04c923076ff3e2f0e420ff6184f40e820490a7..25006ae35d6a06c90d127bf4f9cf915643b8ee36
@@@ -427,11 -379,11 +379,11 @@@ def complete_file(filename, stepsize = 
      # end if
      import os
      try: os.rename(filename, filename + '~')
 -    except os.error: pass
 +    except OSError: pass
      # end try
-     f = open(filename, 'w')
-     f.write(result)
-     f.close()
+     with open(filename, 'w') as f:
+         f.write(result)
+     # end with
      return 1
  # end def complete_file
  
@@@ -442,11 -396,11 +396,11 @@@ def delete_file(filename, stepsize = ST
      # end if
      import os
      try: os.rename(filename, filename + '~')
 -    except os.error: pass
 +    except OSError: pass
      # end try
-     f = open(filename, 'w')
-     f.write(result)
-     f.close()
+     with open(filename, 'w') as f:
+         f.write(result)
+     # end with
      return 1
  # end def delete_file
  
@@@ -457,11 -413,11 +413,11 @@@ def reformat_file(filename, stepsize = 
      # end if
      import os
      try: os.rename(filename, filename + '~')
 -    except os.error: pass
 +    except OSError: pass
      # end try
-     f = open(filename, 'w')
-     f.write(result)
-     f.close()
+     with open(filename, 'w') as f:
+         f.write(result)
+     # end with
      return 1
  # end def reformat_file