mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Only the parts which are relevant for 3.x branch.
Merged revisions 78757-78758,78769,78815 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r78757 | florent.xicluna | 2010-03-07 13:14:25 +0100 (dim, 07 mar 2010) | 2 lines Fix some py3k warnings in the standard library. ........ r78758 | florent.xicluna | 2010-03-07 13:18:33 +0100 (dim, 07 mar 2010) | 4 lines Issue #7849: Now the utility ``check_warnings`` verifies if the warnings are effectively raised. A new utility ``check_py3k_warnings`` deals with py3k warnings. ........ r78769 | florent.xicluna | 2010-03-07 20:14:12 +0100 (dim, 07 mar 2010) | 2 lines Refresh the documentation for the test.test_support module. ........ r78815 | florent.xicluna | 2010-03-09 20:57:01 +0100 (mar, 09 mar 2010) | 2 lines #7772: Fix test_py3kwarn. Now the test suite could pass with "-3" flag. ........
This commit is contained in:
parent
8142d8d751
commit
b14930cd93
5 changed files with 123 additions and 35 deletions
15
Lib/_pyio.py
15
Lib/_pyio.py
|
@ -828,7 +828,7 @@ class BytesIO(BufferedIOBase):
|
|||
if self.closed:
|
||||
raise ValueError("seek on closed file")
|
||||
try:
|
||||
pos = pos.__index__()
|
||||
pos.__index__
|
||||
except AttributeError as err:
|
||||
raise TypeError("an integer is required") from err
|
||||
if whence == 0:
|
||||
|
@ -853,8 +853,13 @@ class BytesIO(BufferedIOBase):
|
|||
raise ValueError("truncate on closed file")
|
||||
if pos is None:
|
||||
pos = self._pos
|
||||
elif pos < 0:
|
||||
raise ValueError("negative truncate position %r" % (pos,))
|
||||
else:
|
||||
try:
|
||||
pos.__index__
|
||||
except AttributeError as err:
|
||||
raise TypeError("an integer is required") from err
|
||||
if pos < 0:
|
||||
raise ValueError("negative truncate position %r" % (pos,))
|
||||
del self._buffer[pos:]
|
||||
return pos
|
||||
|
||||
|
@ -1803,6 +1808,10 @@ class TextIOWrapper(TextIOBase):
|
|||
if n is None:
|
||||
n = -1
|
||||
decoder = self._decoder or self._get_decoder()
|
||||
try:
|
||||
n.__index__
|
||||
except AttributeError as err:
|
||||
raise TypeError("an integer is required") from err
|
||||
if n < 0:
|
||||
# Read everything.
|
||||
result = (self._get_decoded_chars() +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue