Commit 3b4b23ea authored by Antoine Pitrou's avatar Antoine Pitrou

Merged revisions 77571 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r77571 | antoine.pitrou | 2010-01-17 13:16:23 +0100 (dim., 17 janv. 2010) | 4 lines

  Issue #7561: Fix crashes when using bytearray objects with the posix
  module.
........
parent e3b2e12e
...@@ -564,6 +564,14 @@ class ExecTests(unittest.TestCase): ...@@ -564,6 +564,14 @@ class ExecTests(unittest.TestCase):
def test_execvpe_with_bad_arglist(self): def test_execvpe_with_bad_arglist(self):
self.assertRaises(ValueError, os.execvpe, 'notepad', [], None) self.assertRaises(ValueError, os.execvpe, 'notepad', [], None)
class ArgTests(unittest.TestCase):
def test_bytearray(self):
# Issue #7561: posix module didn't release bytearray exports properly.
b = bytearray(os.sep.encode('ascii'))
self.assertRaises(OSError, os.mkdir, b)
# Check object is still resizable.
b[:] = b''
class Win32ErrorTests(unittest.TestCase): class Win32ErrorTests(unittest.TestCase):
def test_rename(self): def test_rename(self):
self.assertRaises(WindowsError, os.rename, support.TESTFN, support.TESTFN+".bak") self.assertRaises(WindowsError, os.rename, support.TESTFN, support.TESTFN+".bak")
...@@ -750,6 +758,7 @@ else: ...@@ -750,6 +758,7 @@ else:
def test_main(): def test_main():
support.run_unittest( support.run_unittest(
ArgTests,
FileTests, FileTests,
StatAttributeTests, StatAttributeTests,
EnvironTests, EnvironTests,
......
...@@ -67,6 +67,9 @@ Core and Builtins ...@@ -67,6 +67,9 @@ Core and Builtins
Library Library
------- -------
- Issue #7561: Fix crashes when using bytearray objects with the posix
module.
- Issue #1670765: Prevent email.generator.Generator from re-wrapping - Issue #1670765: Prevent email.generator.Generator from re-wrapping
headers in multipart/signed MIME parts, which fixes one of the sources of headers in multipart/signed MIME parts, which fixes one of the sources of
invalid modifications to such parts by Generator. invalid modifications to such parts by Generator.
......
...@@ -580,7 +580,7 @@ static void ...@@ -580,7 +580,7 @@ static void
release_bytes(PyObject* o) release_bytes(PyObject* o)
{ {
if (PyByteArray_Check(o)) if (PyByteArray_Check(o))
o->ob_type->tp_as_buffer->bf_releasebuffer(NULL, 0); o->ob_type->tp_as_buffer->bf_releasebuffer(o, 0);
Py_DECREF(o); Py_DECREF(o);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment