Commit f4228b0e authored by Georg Brandl's avatar Georg Brandl

Merge.

parents d3fca8e0 9ee601e1
...@@ -104,6 +104,13 @@ def arbitrary_address(family): ...@@ -104,6 +104,13 @@ def arbitrary_address(family):
else: else:
raise ValueError('unrecognized family') raise ValueError('unrecognized family')
def _validate_family(family):
'''
Checks if the family is valid for the current environment.
'''
if sys.platform != 'win32' and family == 'AF_PIPE':
raise ValueError('Family %s is not recognized.' % family)
def address_type(address): def address_type(address):
''' '''
...@@ -436,6 +443,7 @@ class Listener(object): ...@@ -436,6 +443,7 @@ class Listener(object):
or default_family or default_family
address = address or arbitrary_address(family) address = address or arbitrary_address(family)
_validate_family(family)
if family == 'AF_PIPE': if family == 'AF_PIPE':
self._listener = PipeListener(address, backlog) self._listener = PipeListener(address, backlog)
else: else:
...@@ -473,6 +481,7 @@ def Client(address, family=None, authkey=None): ...@@ -473,6 +481,7 @@ def Client(address, family=None, authkey=None):
Returns a connection to the address of a `Listener` Returns a connection to the address of a `Listener`
''' '''
family = family or address_type(address) family = family or address_type(address)
_validate_family(family)
if family == 'AF_PIPE': if family == 'AF_PIPE':
c = PipeClient(address) c = PipeClient(address)
else: else:
......
...@@ -2638,8 +2638,20 @@ class TestWait(unittest.TestCase): ...@@ -2638,8 +2638,20 @@ class TestWait(unittest.TestCase):
p.join() p.join()
#
# Issue 14151: Test invalid family on invalid environment
#
class TestInvalidFamily(unittest.TestCase):
@unittest.skipIf(WIN32, "skipped on Windows")
def test_invalid_family(self):
with self.assertRaises(ValueError):
multiprocessing.connection.Listener(r'\\.\test')
testcases_other = [OtherTest, TestInvalidHandle, TestInitializers, testcases_other = [OtherTest, TestInvalidHandle, TestInitializers,
TestStdinBadfiledescriptor, TestWait] TestStdinBadfiledescriptor, TestWait, TestInvalidFamily]
# #
# #
......
...@@ -1859,16 +1859,6 @@ class BasicElementTest(unittest.TestCase): ...@@ -1859,16 +1859,6 @@ class BasicElementTest(unittest.TestCase):
gc_collect() gc_collect()
self.assertIsNone(wref()) self.assertIsNone(wref())
# A longer cycle: d->e->e2->d
e = ET.Element('joe')
d = Dummy()
d.dummyref = e
wref = weakref.ref(d)
e2 = ET.SubElement(e, 'foo', attr=d)
del d, e, e2
gc_collect()
self.assertIsNone(wref())
class ElementTreeTest(unittest.TestCase): class ElementTreeTest(unittest.TestCase):
def test_istype(self): def test_istype(self):
......
...@@ -10,9 +10,16 @@ What's New in Python 3.3.0 Alpha 3? ...@@ -10,9 +10,16 @@ What's New in Python 3.3.0 Alpha 3?
Core and Builtins Core and Builtins
----------------- -----------------
- Issue #13019: Fix potential reference leaks in bytearray.extend(). Patch
by Suman Saha.
Library Library
------- -------
- Issue #14151: Raise a ValueError, not a NameError, when trying to create
a multiprocessing Client or Listener with an AF_PIPE type address under
non-Windows platforms. Patch by Popa Claudiu.
What's New in Python 3.3.0 Alpha 2? What's New in Python 3.3.0 Alpha 2?
=================================== ===================================
......
...@@ -84,7 +84,10 @@ print("\n# ===================================================================== ...@@ -84,7 +84,10 @@ print("\n# =====================================================================
print("# Factorial") print("# Factorial")
print("# ======================================================================\n") print("# ======================================================================\n")
C.getcontext().prec = C.MAX_PREC c = C.getcontext()
c.prec = C.MAX_PREC
c.Emax = C.MAX_EMAX
c.Emin = C.MIN_EMIN
for n in [100000, 1000000]: for n in [100000, 1000000]:
......
...@@ -2289,8 +2289,10 @@ bytearray_extend(PyByteArrayObject *self, PyObject *arg) ...@@ -2289,8 +2289,10 @@ bytearray_extend(PyByteArrayObject *self, PyObject *arg)
} }
bytearray_obj = PyByteArray_FromStringAndSize(NULL, buf_size); bytearray_obj = PyByteArray_FromStringAndSize(NULL, buf_size);
if (bytearray_obj == NULL) if (bytearray_obj == NULL) {
Py_DECREF(it);
return NULL; return NULL;
}
buf = PyByteArray_AS_STRING(bytearray_obj); buf = PyByteArray_AS_STRING(bytearray_obj);
while ((item = PyIter_Next(it)) != NULL) { while ((item = PyIter_Next(it)) != NULL) {
...@@ -2323,8 +2325,10 @@ bytearray_extend(PyByteArrayObject *self, PyObject *arg) ...@@ -2323,8 +2325,10 @@ bytearray_extend(PyByteArrayObject *self, PyObject *arg)
return NULL; return NULL;
} }
if (bytearray_setslice(self, Py_SIZE(self), Py_SIZE(self), bytearray_obj) == -1) if (bytearray_setslice(self, Py_SIZE(self), Py_SIZE(self), bytearray_obj) == -1) {
Py_DECREF(bytearray_obj);
return NULL; return NULL;
}
Py_DECREF(bytearray_obj); Py_DECREF(bytearray_obj);
Py_RETURN_NONE; Py_RETURN_NONE;
......
...@@ -490,26 +490,22 @@ type_set_bases(PyTypeObject *type, PyObject *value, void *context) ...@@ -490,26 +490,22 @@ type_set_bases(PyTypeObject *type, PyObject *value, void *context)
for (i = 0; i < PyTuple_GET_SIZE(value); i++) { for (i = 0; i < PyTuple_GET_SIZE(value); i++) {
ob = PyTuple_GET_ITEM(value, i); ob = PyTuple_GET_ITEM(value, i);
if (!PyType_Check(ob)) { if (!PyType_Check(ob)) {
PyErr_Format( PyErr_Format(PyExc_TypeError,
PyExc_TypeError,
"%s.__bases__ must be tuple of classes, not '%s'", "%s.__bases__ must be tuple of classes, not '%s'",
type->tp_name, Py_TYPE(ob)->tp_name); type->tp_name, Py_TYPE(ob)->tp_name);
return -1; return -1;
} }
if (PyType_Check(ob)) {
if (PyType_IsSubtype((PyTypeObject*)ob, type)) { if (PyType_IsSubtype((PyTypeObject*)ob, type)) {
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"a __bases__ item causes an inheritance cycle"); "a __bases__ item causes an inheritance cycle");
return -1; return -1;
} }
} }
}
new_base = best_base(value); new_base = best_base(value);
if (!new_base) { if (!new_base)
return -1; return -1;
}
if (!compatible_for_assignment(type->tp_base, new_base, "__bases__")) if (!compatible_for_assignment(type->tp_base, new_base, "__bases__"))
return -1; return -1;
......
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9.00" Version="9,00"
Name="_decimal" Name="_decimal"
ProjectGUID="{0E9791DB-593A-465F-98BC-681011311617}" ProjectGUID="{0E9791DB-593A-465F-98BC-681011311617}"
RootNamespace="_decimal" RootNamespace="_decimal"
...@@ -42,8 +42,8 @@ ...@@ -42,8 +42,8 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\Modules\_decimal;..\Modules\_decimal\libmpdec"
AdditionalOptions="/D_CRT_SECURE_NO_WARNINGS /DCONFIG_32 /DPPRO /DMASM" AdditionalOptions="/D_CRT_SECURE_NO_WARNINGS /DCONFIG_32 /DPPRO /DMASM"
AdditionalIncludeDirectories="..\Modules\_decimal;..\Modules\_decimal\libmpdec"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
...@@ -104,8 +104,8 @@ ...@@ -104,8 +104,8 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\Modules\_decimal;..\Modules\_decimal\libmpdec"
AdditionalOptions="/D_CRT_SECURE_NO_WARNINGS /DCONFIG_64 /DMASM" AdditionalOptions="/D_CRT_SECURE_NO_WARNINGS /DCONFIG_64 /DMASM"
AdditionalIncludeDirectories="..\Modules\_decimal;..\Modules\_decimal\libmpdec"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
...@@ -166,8 +166,8 @@ ...@@ -166,8 +166,8 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\Modules\_decimal;..\Modules\_decimal\libmpdec"
AdditionalOptions="/D_CRT_SECURE_NO_WARNINGS /DCONFIG_32 /DPPRO /DMASM" AdditionalOptions="/D_CRT_SECURE_NO_WARNINGS /DCONFIG_32 /DPPRO /DMASM"
AdditionalIncludeDirectories="..\Modules\_decimal;..\Modules\_decimal\libmpdec"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
...@@ -230,8 +230,8 @@ ...@@ -230,8 +230,8 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\Modules\_decimal;..\Modules\_decimal\libmpdec"
AdditionalOptions="/D_CRT_SECURE_NO_WARNINGS /DCONFIG_64 /DMASM" AdditionalOptions="/D_CRT_SECURE_NO_WARNINGS /DCONFIG_64 /DMASM"
AdditionalIncludeDirectories="..\Modules\_decimal;..\Modules\_decimal\libmpdec"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
...@@ -293,8 +293,8 @@ ...@@ -293,8 +293,8 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/D_CRT_SECURE_NO_WARNINGS /DCONFIG_32 /DPPRO /DMASM"
AdditionalIncludeDirectories="..\Modules\_decimal;..\Modules\_decimal\libmpdec" AdditionalIncludeDirectories="..\Modules\_decimal;..\Modules\_decimal\libmpdec"
AdditionalOptions="/DCONFIG_32 /DPPRO /D_CRT_SECURE_NO_WARNINGS"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
...@@ -357,8 +357,8 @@ ...@@ -357,8 +357,8 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/D_CRT_SECURE_NO_WARNINGS /DCONFIG_64 /DMASM"
AdditionalIncludeDirectories="..\Modules\_decimal;..\Modules\_decimal\libmpdec" AdditionalIncludeDirectories="..\Modules\_decimal;..\Modules\_decimal\libmpdec"
AdditionalOptions="/DCONFIG_64 /D_CRT_SECURE_NO_WARNINGS"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
...@@ -421,8 +421,8 @@ ...@@ -421,8 +421,8 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/D_CRT_SECURE_NO_WARNINGS /DCONFIG_32 /DPPRO /DMASM"
AdditionalIncludeDirectories="..\Modules\_decimal;..\Modules\_decimal\libmpdec" AdditionalIncludeDirectories="..\Modules\_decimal;..\Modules\_decimal\libmpdec"
AdditionalOptions="/DCONFIG_32 /DPPRO /D_CRT_SECURE_NO_WARNINGS"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
...@@ -485,8 +485,8 @@ ...@@ -485,8 +485,8 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/D_CRT_SECURE_NO_WARNINGS /DCONFIG_64 /DMASM"
AdditionalIncludeDirectories="..\Modules\_decimal;..\Modules\_decimal\libmpdec" AdditionalIncludeDirectories="..\Modules\_decimal;..\Modules\_decimal\libmpdec"
AdditionalOptions="/DCONFIG_64 /D_CRT_SECURE_NO_WARNINGS"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
...@@ -532,10 +532,6 @@ ...@@ -532,10 +532,6 @@
<Filter <Filter
Name="Header Files" Name="Header Files"
> >
<File
RelativePath="..\Modules\_decimal\docstrings.h"
>
</File>
<File <File
RelativePath="..\Modules\_decimal\libmpdec\basearith.h" RelativePath="..\Modules\_decimal\libmpdec\basearith.h"
> >
...@@ -560,6 +556,10 @@ ...@@ -560,6 +556,10 @@
RelativePath="..\Modules\_decimal\libmpdec\difradix2.h" RelativePath="..\Modules\_decimal\libmpdec\difradix2.h"
> >
</File> </File>
<File
RelativePath="..\Modules\_decimal\docstrings.h"
>
</File>
<File <File
RelativePath="..\Modules\_decimal\libmpdec\fnt.h" RelativePath="..\Modules\_decimal\libmpdec\fnt.h"
> >
......
...@@ -97,7 +97,9 @@ extensions = [ ...@@ -97,7 +97,9 @@ extensions = [
'_sqlite3.pyd', '_sqlite3.pyd',
'_hashlib.pyd', '_hashlib.pyd',
'_multiprocessing.pyd', '_multiprocessing.pyd',
'_lzma.pyd' '_lzma.pyd',
'_decimal.pyd',
'_testbuffer.pyd'
] ]
# Well-known component UUIDs # Well-known component UUIDs
......
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