diff --git a/CHANGES b/CHANGES index 32a0114..fe8f627 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,9 @@ Changes since 2.4.26: Lib/ * added 'strf_secs' and 'strp_secs' to ldap.functions.__all__ +* fixed regression introduced with 2.4.26: + ldif.LDIFParser did not accept LDIF entry records + without trailing empty separator line ---------------------------------------------------------------- Released 2.4.26 2016-07-24 @@ -1279,4 +1282,4 @@ Released 2.0.0pre02 2002-02-01 ---------------------------------------------------------------- Released 1.10alpha3 2000-09-19 -$Id: CHANGES,v 1.390 2016/07/25 08:15:14 stroeder Exp $ +$Id: CHANGES,v 1.391 2016/07/30 19:01:59 stroeder Exp $ diff --git a/Lib/ldif.py b/Lib/ldif.py index 8afea75..172d0c3 100644 --- a/Lib/ldif.py +++ b/Lib/ldif.py @@ -3,7 +3,7 @@ See http://www.python-ldap.org/ for details. -$Id: ldif.py,v 1.98 2016/07/30 16:18:47 stroeder Exp $ +$Id: ldif.py,v 1.99 2016/07/30 19:01:59 stroeder Exp $ Python compability note: Tested with Python 2.0+, but should work with Python 1.5.2+. @@ -297,10 +297,7 @@ def _readline(self): self.line_counter = self.line_counter + 1 self.byte_counter = self.byte_counter + len(s) if not s: - raise EOFError('EOF reached after %d lines (%d bytes)' % ( - self.line_counter, - self.byte_counter, - )) + return None elif s[-2:]=='\r\n': return s[:-2] elif s[-1:]=='\n': @@ -312,6 +309,11 @@ def _unfold_lines(self): """ Unfold several folded lines with trailing space into one line """ + if self._last_line is None: + raise EOFError('EOF reached after %d lines (%d bytes)' % ( + self.line_counter, + self.byte_counter, + )) unfolded_lines = [ self._last_line ] next_line = self._readline() while next_line and next_line[0]==' ':