Merge branch 'python3.4'

Conflicts:
	python3.spec
This commit is contained in:
Slavek Kabrda 2014-05-27 17:15:10 +02:00
commit bea65b85a1
29 changed files with 941 additions and 759 deletions

View File

@ -89,9 +89,9 @@ diff -up Python-3.3.0rc2/Doc/howto/index.rst.systemtap Python-3.3.0rc2/Doc/howto
--- Python-3.3.0rc2/Doc/howto/index.rst.systemtap 2012-09-09 05:10:51.000000000 -0400
+++ Python-3.3.0rc2/Doc/howto/index.rst 2012-09-10 09:17:21.117511779 -0400
@@ -29,4 +29,5 @@ Currently, the HOWTOs are:
webservers.rst
argparse.rst
ipaddress.rst
clinic.rst
+ instrumentation.rst
diff -up Python-3.3.0rc2/Doc/howto/instrumentation.rst.systemtap Python-3.3.0rc2/Doc/howto/instrumentation.rst
@ -650,8 +650,8 @@ diff -up Python-3.3.0rc2/Makefile.pre.in.systemtap Python-3.3.0rc2/Makefile.pre.
+Python/ceval.o: $(OPCODETARGETS_H) $(srcdir)/Python/ceval_gil.h \
+ $(srcdir)/Python/ceval_systemtap.h @SYSTEMTAPDEPS@
Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \
$(BYTESTR_DEPS)
Python/frozen.o: Python/importlib.h
@@ -724,6 +726,13 @@ Objects/typeobject.o: $(srcdir)/Objects/
Objects/typeslots.inc: $(srcdir)/Include/typeslots.h $(srcdir)/Objects/typeslots.py
$(PYTHON) $(srcdir)/Objects/typeslots.py < $(srcdir)/Include/typeslots.h > Objects/typeslots.inc
@ -735,8 +735,8 @@ diff -up Python-3.3.0rc2/Python/ceval.c.systemtap Python-3.3.0rc2/Python/ceval.c
+ }
+
Py_LeaveRecursiveCall();
f->f_executing = 0;
tstate->frame = f->f_back;
diff -up Python-3.3.0rc2/Python/ceval_systemtap.h.systemtap Python-3.3.0rc2/Python/ceval_systemtap.h
--- Python-3.3.0rc2/Python/ceval_systemtap.h.systemtap 2012-09-10 09:17:21.122511781 -0400
+++ Python-3.3.0rc2/Python/ceval_systemtap.h 2012-09-10 09:17:21.122511781 -0400

View File

@ -1,6 +1,5 @@
diff -up cpython-59223da36dec/Lib/distutils/command/install.py.lib64 cpython-59223da36dec/Lib/distutils/command/install.py
--- cpython-59223da36dec/Lib/distutils/command/install.py.lib64 2012-08-07 06:10:57.000000000 -0400
+++ cpython-59223da36dec/Lib/distutils/command/install.py 2012-08-07 16:41:00.573477549 -0400
--- Python-3.4.0b1/Lib/distutils/command/install.py.lib64 2013-11-24 21:36:54.000000000 +0100
+++ Python-3.4.0b1/Lib/distutils/command/install.py 2013-11-27 11:10:43.821150774 +0100
@@ -45,14 +45,14 @@ else:
INSTALL_SCHEMES = {
'unix_prefix': {
@ -18,10 +17,9 @@ diff -up cpython-59223da36dec/Lib/distutils/command/install.py.lib64 cpython-592
'headers': '$base/include/python/$dist_name',
'scripts': '$base/bin',
'data' : '$base',
diff -up cpython-59223da36dec/Lib/distutils/sysconfig.py.lib64 cpython-59223da36dec/Lib/distutils/sysconfig.py
--- cpython-59223da36dec/Lib/distutils/sysconfig.py.lib64 2012-08-07 06:10:57.000000000 -0400
+++ cpython-59223da36dec/Lib/distutils/sysconfig.py 2012-08-07 16:41:00.573477549 -0400
@@ -139,8 +139,12 @@ def get_python_lib(plat_specific=0, stan
--- Python-3.4.0b1/Lib/distutils/sysconfig.py.lib64 2013-11-24 21:36:54.000000000 +0100
+++ Python-3.4.0b1/Lib/distutils/sysconfig.py 2013-11-27 11:10:43.821150774 +0100
@@ -141,8 +141,12 @@
prefix = plat_specific and EXEC_PREFIX or PREFIX
if os.name == "posix":
@ -35,13 +33,12 @@ diff -up cpython-59223da36dec/Lib/distutils/sysconfig.py.lib64 cpython-59223da36
if standard_lib:
return libpython
else:
diff -up cpython-59223da36dec/Lib/site.py.lib64 cpython-59223da36dec/Lib/site.py
--- cpython-59223da36dec/Lib/site.py.lib64 2012-08-07 06:10:57.000000000 -0400
+++ cpython-59223da36dec/Lib/site.py 2012-08-07 16:41:00.573477549 -0400
@@ -303,12 +303,16 @@ def getsitepackages(prefixes=None):
if sys.platform in ('os2emx', 'riscos'):
sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
elif os.sep == '/':
--- Python-3.4.0b1/Lib/site.py.lib64 2013-11-24 21:36:54.000000000 +0100
+++ Python-3.4.0b1/Lib/site.py 2013-11-27 11:10:43.822150773 +0100
@@ -304,12 +304,16 @@
seen.add(prefix)
if os.sep == '/':
+ sitepackages.append(os.path.join(prefix, "lib64",
+ "python" + sys.version[:3],
+ "site-packages"))
@ -55,10 +52,9 @@ diff -up cpython-59223da36dec/Lib/site.py.lib64 cpython-59223da36dec/Lib/site.py
sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
if sys.platform == "darwin":
# for framework builds *only* we add the standard Apple
diff -up cpython-59223da36dec/Lib/sysconfig.py.lib64 cpython-59223da36dec/Lib/sysconfig.py
--- cpython-59223da36dec/Lib/sysconfig.py.lib64 2012-08-07 06:10:57.000000000 -0400
+++ cpython-59223da36dec/Lib/sysconfig.py 2012-08-07 16:41:00.574477549 -0400
@@ -21,10 +21,10 @@ __all__ = [
--- Python-3.4.0b1/Lib/sysconfig.py.lib64 2013-11-24 21:36:54.000000000 +0100
+++ Python-3.4.0b1/Lib/sysconfig.py 2013-11-27 11:10:43.822150773 +0100
@@ -20,10 +20,10 @@
_INSTALL_SCHEMES = {
'posix_prefix': {
@ -72,7 +68,7 @@ diff -up cpython-59223da36dec/Lib/sysconfig.py.lib64 cpython-59223da36dec/Lib/sy
'include':
'{installed_base}/include/python{py_version_short}{abiflags}',
'platinclude':
@@ -81,10 +81,10 @@ _INSTALL_SCHEMES = {
@@ -61,10 +61,10 @@
'data': '{userbase}',
},
'posix_user': {
@ -86,10 +82,9 @@ diff -up cpython-59223da36dec/Lib/sysconfig.py.lib64 cpython-59223da36dec/Lib/sy
'include': '{userbase}/include/python{py_version_short}',
'scripts': '{userbase}/bin',
'data': '{userbase}',
diff -up cpython-59223da36dec/Lib/test/test_site.py.lib64 cpython-59223da36dec/Lib/test/test_site.py
--- cpython-59223da36dec/Lib/test/test_site.py.lib64 2012-08-07 06:10:57.000000000 -0400
+++ cpython-59223da36dec/Lib/test/test_site.py 2012-08-07 16:41:00.574477549 -0400
@@ -239,12 +239,15 @@ class HelperFunctionsTests(unittest.Test
--- Python-3.4.0b1/Lib/test/test_site.py.lib64 2013-11-24 21:36:55.000000000 +0100
+++ Python-3.4.0b1/Lib/test/test_site.py 2013-11-27 11:10:43.822150773 +0100
@@ -244,12 +244,15 @@
self.assertEqual(dirs[2], wanted)
elif os.sep == '/':
# OS X non-framwework builds, Linux, FreeBSD, etc
@ -108,10 +103,9 @@ diff -up cpython-59223da36dec/Lib/test/test_site.py.lib64 cpython-59223da36dec/L
else:
# other platforms
self.assertEqual(len(dirs), 2)
diff -up cpython-59223da36dec/Makefile.pre.in.lib64 cpython-59223da36dec/Makefile.pre.in
--- cpython-59223da36dec/Makefile.pre.in.lib64 2012-08-07 16:41:00.557477550 -0400
+++ cpython-59223da36dec/Makefile.pre.in 2012-08-07 16:41:00.575477549 -0400
@@ -108,7 +108,7 @@ LIBDIR= @libdir@
--- Python-3.4.0b1/Makefile.pre.in.lib64 2013-11-27 11:10:43.814150786 +0100
+++ Python-3.4.0b1/Makefile.pre.in 2013-11-27 11:10:43.823150771 +0100
@@ -115,7 +115,7 @@
MANDIR= @mandir@
INCLUDEDIR= @includedir@
CONFINCLUDEDIR= $(exec_prefix)/include
@ -120,9 +114,8 @@ diff -up cpython-59223da36dec/Makefile.pre.in.lib64 cpython-59223da36dec/Makefil
ABIFLAGS= @ABIFLAGS@
# Detailed destination directories
diff -up cpython-59223da36dec/Modules/getpath.c.lib64 cpython-59223da36dec/Modules/getpath.c
--- cpython-59223da36dec/Modules/getpath.c.lib64 2012-08-07 06:10:57.000000000 -0400
+++ cpython-59223da36dec/Modules/getpath.c 2012-08-07 16:41:00.575477549 -0400
--- Python-3.4.0b1/Modules/getpath.c.lib64 2013-11-24 21:36:56.000000000 +0100
+++ Python-3.4.0b1/Modules/getpath.c 2013-11-27 11:17:33.619449704 +0100
@@ -122,8 +122,8 @@
#endif
@ -134,16 +127,16 @@ diff -up cpython-59223da36dec/Modules/getpath.c.lib64 cpython-59223da36dec/Modul
#endif
#ifndef LANDMARK
@@ -135,7 +135,7 @@ static wchar_t exec_prefix[MAXPATHLEN+1]
static wchar_t progpath[MAXPATHLEN+1];
static wchar_t *module_search_path = NULL;
static int module_search_path_malloced = 0;
-static wchar_t *lib_python = L"lib/python" VERSION;
+static wchar_t *lib_python = L"lib64/python" VERSION;
@@ -498,7 +498,7 @@
_pythonpath = _Py_char2wchar(PYTHONPATH, NULL);
_prefix = _Py_char2wchar(PREFIX, NULL);
_exec_prefix = _Py_char2wchar(EXEC_PREFIX, NULL);
- lib_python = _Py_char2wchar("lib/python" VERSION, NULL);
+ lib_python = _Py_char2wchar("lib64/python" VERSION, NULL);
static void
reduce(wchar_t *dir)
@@ -677,7 +677,7 @@ calculate_path(void)
if (!_pythonpath || !_prefix || !_exec_prefix || !lib_python) {
Py_FatalError(
@@ -687,7 +687,7 @@
}
else
wcsncpy(zip_path, _prefix, MAXPATHLEN);
@ -152,7 +145,7 @@ diff -up cpython-59223da36dec/Modules/getpath.c.lib64 cpython-59223da36dec/Modul
bufsz = wcslen(zip_path); /* Replace "00" with version */
zip_path[bufsz - 6] = VERSION[0];
zip_path[bufsz - 5] = VERSION[2];
@@ -687,7 +687,7 @@ calculate_path(void)
@@ -699,7 +699,7 @@
fprintf(stderr,
"Could not find platform dependent libraries <exec_prefix>\n");
wcsncpy(exec_prefix, _exec_prefix, MAXPATHLEN);
@ -161,10 +154,9 @@ diff -up cpython-59223da36dec/Modules/getpath.c.lib64 cpython-59223da36dec/Modul
}
/* If we found EXEC_PREFIX do *not* reduce it! (Yet.) */
diff -up cpython-59223da36dec/setup.py.lib64 cpython-59223da36dec/setup.py
--- cpython-59223da36dec/setup.py.lib64 2012-08-07 06:10:57.000000000 -0400
+++ cpython-59223da36dec/setup.py 2012-08-07 16:41:32.153475390 -0400
@@ -438,7 +438,7 @@ class PyBuildExt(build_ext):
--- Python-3.4.0b1/setup.py.lib64 2013-11-24 21:36:56.000000000 +0100
+++ Python-3.4.0b1/setup.py 2013-11-27 11:10:43.824150769 +0100
@@ -441,7 +441,7 @@
# directories (i.e. '.' and 'Include') must be first. See issue
# 10520.
if not cross_compiling:
@ -173,7 +165,7 @@ diff -up cpython-59223da36dec/setup.py.lib64 cpython-59223da36dec/setup.py
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
# only change this for cross builds for 3.3, issues on Mageia
if cross_compiling:
@@ -708,11 +708,11 @@ class PyBuildExt(build_ext):
@@ -718,11 +718,11 @@
elif curses_library:
readline_libs.append(curses_library)
elif self.compiler.find_library_file(lib_dirs +
@ -187,7 +179,7 @@ diff -up cpython-59223da36dec/setup.py.lib64 cpython-59223da36dec/setup.py
extra_link_args=readline_extra_link_args,
libraries=readline_libs) )
else:
@@ -749,8 +749,8 @@ class PyBuildExt(build_ext):
@@ -759,8 +759,8 @@
if krb5_h:
ssl_incs += krb5_h
ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,

View File

@ -2,7 +2,7 @@ diff -up cpython-59223da36dec/Makefile.pre.in.no-static-lib cpython-59223da36dec
--- cpython-59223da36dec/Makefile.pre.in.no-static-lib 2012-08-07 16:43:43.296466422 -0400
+++ cpython-59223da36dec/Makefile.pre.in 2012-08-07 16:44:13.299464371 -0400
@@ -464,7 +464,7 @@ coverage:
$(RUNSHARED) $(PYTHON_FOR_BUILD) ./Tools/clinic/clinic.py --make
# Build the interpreter
-$(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
@ -11,7 +11,7 @@ diff -up cpython-59223da36dec/Makefile.pre.in.no-static-lib cpython-59223da36dec
platform: $(BUILDPYTHON) pybuilddir.txt
@@ -480,18 +480,6 @@ sharedmods: $(BUILDPYTHON) $(SYSCONFIGDA
$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
-# Build static library

View File

@ -1,39 +0,0 @@
diff -up Python-3.3.0b1/Modules/posixmodule.c.statvfs-f_flag-constants Python-3.3.0b1/Modules/posixmodule.c
--- Python-3.3.0b1/Modules/posixmodule.c.statvfs-f_flag-constants 2012-06-26 16:19:54.000000000 -0400
+++ Python-3.3.0b1/Modules/posixmodule.c 2012-07-20 13:39:18.595546387 -0400
@@ -11665,6 +11665,35 @@ all_ins(PyObject *d)
if (ins(d, "ST_NOSUID", (long)ST_NOSUID)) return -1;
#endif /* ST_NOSUID */
+ /* GNU extensions */
+#ifdef ST_NODEV
+ if (ins(d, "ST_NODEV", (long)ST_NODEV)) return -1;
+#endif /* ST_NODEV */
+#ifdef ST_NOEXEC
+ if (ins(d, "ST_NOEXEC", (long)ST_NOEXEC)) return -1;
+#endif /* ST_NOEXEC */
+#ifdef ST_SYNCHRONOUS
+ if (ins(d, "ST_SYNCHRONOUS", (long)ST_SYNCHRONOUS)) return -1;
+#endif /* ST_SYNCHRONOUS */
+#ifdef ST_MANDLOCK
+ if (ins(d, "ST_MANDLOCK", (long)ST_MANDLOCK)) return -1;
+#endif /* ST_MANDLOCK */
+#ifdef ST_WRITE
+ if (ins(d, "ST_WRITE", (long)ST_WRITE)) return -1;
+#endif /* ST_WRITE */
+#ifdef ST_APPEND
+ if (ins(d, "ST_APPEND", (long)ST_APPEND)) return -1;
+#endif /* ST_APPEND */
+#ifdef ST_NOATIME
+ if (ins(d, "ST_NOATIME", (long)ST_NOATIME)) return -1;
+#endif /* ST_NOATIME */
+#ifdef ST_NODIRATIME
+ if (ins(d, "ST_NODIRATIME", (long)ST_NODIRATIME)) return -1;
+#endif /* ST_NODIRATIME */
+#ifdef ST_RELATIME
+ if (ins(d, "ST_RELATIME", (long)ST_RELATIME)) return -1;
+#endif /* ST_RELATIME */
+
/* FreeBSD sendfile() constants */
#ifdef SF_NODISKIO
if (ins(d, "SF_NODISKIO", (long)SF_NODISKIO)) return -1;

View File

@ -16,5 +16,5 @@ diff -up Python-2.7/Python/pythonrun.c.less-verbose-COUNT_ALLOCS Python-2.7/Pyth
+ if (Py_GETENV("PYTHONDUMPCOUNTS"))
+ dump_counts(stdout);
#endif
PRINT_TOTAL_REFS();
/* dump hash stats */
_PyHash_Fini();

View File

@ -6,11 +6,11 @@ diff -up Python-3.2.2/Lib/unittest/case.py.add-rpmbuild-hooks-to-unittest Python
import functools
import difflib
+import os
import logging
import pprint
import re
import warnings
@@ -101,6 +102,43 @@ def expectedFailure(func):
return wrapper
raise self.test_case.failureException(msg)
+# Non-standard/downstream-only hooks for handling issues with specific test
@ -50,7 +50,7 @@ diff -up Python-3.2.2/Lib/unittest/case.py.add-rpmbuild-hooks-to-unittest Python
+ func(*args, **kwargs)
+ return wrapper
+
class _AssertRaisesBaseContext(object):
class _AssertRaisesBaseContext(_BaseTestCaseContext):
def __init__(self, expected, test_case, callable_obj=None,
diff -up Python-3.2.2/Lib/unittest/__init__.py.add-rpmbuild-hooks-to-unittest Python-3.2.2/Lib/unittest/__init__.py

View File

@ -4,14 +4,14 @@ diff -up Python-3.3.0b2/Lib/test/test_sys.py.fix-COUNT_ALLOCS-failure-in-test_sy
@@ -835,12 +835,17 @@ class SizeofTest(unittest.TestCase):
# type
# static type: PyTypeObject
s = vsize('P2n15Pl4Pn9Pn11PI')
s = vsize('P2n15Pl4Pn9Pn11PIP')
+ # COUNT_ALLOCS adds a further 3 Py_ssize_t and 2 pointers:
+ if hasattr(sys, 'getcounts'):
+ s += struct.calcsize('3P2P')
check(int, s)
# (PyTypeObject + PyNumberMethods + PyMappingMethods +
# PySequenceMethods + PyBufferProcs + 4P)
s = vsize('P2n15Pl4Pn9Pn11PI') + struct.calcsize('34P 3P 10P 2P 4P')
s = vsize('P2n15Pl4Pn9Pn11PIP') + struct.calcsize('34P 3P 10P 2P 4P')
# Separate block for PyDictKeysObject with 4 entries
s += struct.calcsize("2nPn") + 4*struct.calcsize("n2P")
+ if hasattr(sys, 'getcounts'):

View File

@ -1,22 +0,0 @@
diff -up Python-3.2b2/Lib/test/test_gc.py.fix-test-gc-COUNT_ALLOCS Python-3.2b2/Lib/test/test_gc.py
--- Python-3.2b2/Lib/test/test_gc.py.fix-test-gc-COUNT_ALLOCS 2010-12-28 20:39:40.779059772 -0500
+++ Python-3.2b2/Lib/test/test_gc.py 2010-12-28 20:41:15.890940017 -0500
@@ -102,10 +102,16 @@ class GCTests(unittest.TestCase):
del a
self.assertNotEqual(gc.collect(), 0)
del B, C
- self.assertNotEqual(gc.collect(), 0)
+ if hasattr(sys, 'getcounts'):
+ self.assertEqual(gc.collect(), 0)
+ else:
+ self.assertNotEqual(gc.collect(), 0)
A.a = A()
del A
- self.assertNotEqual(gc.collect(), 0)
+ if hasattr(sys, 'getcounts'):
+ self.assertEqual(gc.collect(), 0)
+ else:
+ self.assertNotEqual(gc.collect(), 0)
self.assertEqual(gc.collect(), 0)
def test_method(self):

View File

@ -0,0 +1,113 @@
diff -r e245b0d7209b Lib/test/test_gc.py
--- a/Lib/test/test_gc.py Sun Oct 20 02:01:29 2013 -0700
+++ b/Lib/test/test_gc.py Fri Nov 08 13:25:29 2013 +0100
@@ -127,10 +127,16 @@
del a
self.assertNotEqual(gc.collect(), 0)
del B, C
- self.assertNotEqual(gc.collect(), 0)
+ if hasattr(sys, 'getcounts'):
+ self.assertEqual(gc.collect(), 0)
+ else:
+ self.assertNotEqual(gc.collect(), 0)
A.a = A()
del A
- self.assertNotEqual(gc.collect(), 0)
+ if hasattr(sys, 'getcounts'):
+ self.assertEqual(gc.collect(), 0)
+ else:
+ self.assertNotEqual(gc.collect(), 0)
self.assertEqual(gc.collect(), 0)
def test_method(self):
@@ -618,6 +624,8 @@
stderr = run_command(code % "gc.DEBUG_SAVEALL")
self.assertNotIn(b"uncollectable objects at shutdown", stderr)
+ @unittest.skipIf(hasattr(sys, 'getcounts'),
+ 'types are immortal if COUNT_ALLOCS is used')
def test_gc_main_module_at_shutdown(self):
# Create a reference cycle through the __main__ module and check
# it gets collected at interpreter shutdown.
@@ -632,6 +640,8 @@
rc, out, err = assert_python_ok('-c', code)
self.assertEqual(out.strip(), b'__del__ called')
+ @unittest.skipIf(hasattr(sys, 'getcounts'),
+ 'types are immortal if COUNT_ALLOCS is used')
def test_gc_ordinary_module_at_shutdown(self):
# Same as above, but with a non-__main__ module.
with temp_dir() as script_dir:
diff -r e245b0d7209b Lib/test/test_module.py
--- a/Lib/test/test_module.py Sun Oct 20 02:01:29 2013 -0700
+++ b/Lib/test/test_module.py Fri Nov 08 13:25:29 2013 +0100
@@ -81,6 +81,8 @@
gc_collect()
self.assertEqual(f().__dict__["bar"], 4)
+ @unittest.skipIf(hasattr(sys, 'getcounts'),
+ 'types are immortal if COUNT_ALLOCS is used')
def test_clear_dict_in_ref_cycle(self):
destroyed = []
m = ModuleType("foo")
@@ -96,6 +98,8 @@
gc_collect()
self.assertEqual(destroyed, [1])
+ @unittest.skipIf(hasattr(sys, 'getcounts'),
+ 'types are immortal if COUNT_ALLOCS is used')
def test_weakref(self):
m = ModuleType("foo")
wr = weakref.ref(m)
@@ -190,6 +194,8 @@
self.assertEqual(r[-len(ends_with):], ends_with,
'{!r} does not end with {!r}'.format(r, ends_with))
+ @unittest.skipIf(hasattr(sys, 'getcounts'),
+ 'skipping since COUNT_ALLOCS was used, see issue19527')
def test_module_finalization_at_shutdown(self):
# Module globals and builtins should still be available during shutdown
rc, out, err = assert_python_ok("-c", "from test import final_a")
--- a/Lib/test/test_io.py.orig 2014-01-09 14:43:44.000000000 +0100
+++ b/Lib/test/test_io.py 2014-01-09 14:50:30.839597351 +0100
@@ -2611,6 +2611,8 @@
""".format(iomod=iomod, kwargs=kwargs)
return assert_python_ok("-c", code)
+ @unittest.skipIf(hasattr(sys, 'getrefcount'),
+ 'types are immortal if COUNT_ALLOCS is used')
def test_create_at_shutdown_without_encoding(self):
rc, out, err = self._check_create_at_shutdown()
if err:
@@ -2621,6 +2623,8 @@
else:
self.assertEqual("ok", out.decode().strip())
+ @unittest.skipIf(hasattr(sys, 'getrefcount'),
+ 'types are immortal if COUNT_ALLOCS is used')
def test_create_at_shutdown_with_encoding(self):
rc, out, err = self._check_create_at_shutdown(encoding='utf-8',
errors='strict')
--- a/Lib/test/test_logging.py.orig 2014-01-09 14:53:07.016388198 +0100
+++ b/Lib/test/test_logging.py 2014-01-09 14:54:25.654282973 +0100
@@ -3398,6 +3398,8 @@
logging.setLoggerClass(logging.Logger)
self.assertEqual(logging.getLoggerClass(), logging.Logger)
+ @unittest.skipIf(hasattr(sys, 'getcounts'),
+ 'types are immortal if COUNT_ALLOCS is used')
def test_logging_at_shutdown(self):
# Issue #20037
code = """if 1:
--- a/Lib/test/test_warnings.py.orig 2014-01-09 15:10:12.454997100 +0100
+++ b/Lib/test/test_warnings.py 2014-01-09 15:11:14.028913478 +0100
@@ -780,6 +780,8 @@
assert_python_ok('-c', 'pass', '-W', 'always', PYTHONPATH=cwd)
class FinalizationTest(unittest.TestCase):
+ @unittest.skipIf(hasattr(sys, 'getcounts'),
+ 'types are immortal if COUNT_ALLOCS is used')
def test_finalization(self):
# Issue #19421: warnings.warn() should not crash
# during Python finalization

View File

@ -1,22 +0,0 @@
diff -up Python-2.7.2/Lib/test/test_openpty.py.skip-failing-pty-tests-in-rpmbuild Python-2.7.2/Lib/test/test_openpty.py
--- Python-2.7.2/Lib/test/test_openpty.py.skip-failing-pty-tests-in-rpmbuild 2011-09-09 05:09:28.698920379 -0400
+++ Python-2.7.2/Lib/test/test_openpty.py 2011-09-09 05:10:54.805914490 -0400
@@ -8,6 +8,7 @@ if not hasattr(os, "openpty"):
class OpenptyTest(unittest.TestCase):
+ @unittest._skipInRpmBuild('sometimes fails in Koji, possibly due to a mock issue (rhbz#714627)')
def test(self):
master, slave = os.openpty()
if not os.isatty(slave):
diff -up Python-2.7.2/Lib/test/test_pty.py.skip-failing-pty-tests-in-rpmbuild Python-2.7.2/Lib/test/test_pty.py
--- Python-2.7.2/Lib/test/test_pty.py.skip-failing-pty-tests-in-rpmbuild 2011-09-09 05:09:36.781919825 -0400
+++ Python-2.7.2/Lib/test/test_pty.py 2011-09-09 05:11:14.741913127 -0400
@@ -109,6 +109,7 @@ class PtyTest(unittest.TestCase):
os.close(master_fd)
+ @unittest._skipInRpmBuild('sometimes fails in Koji, possibly due to a mock issue (rhbz#714627)')
def test_fork(self):
debug("calling pty.fork()")
pid, master_fd = pty.fork()

View File

@ -31,7 +31,7 @@ diff -up Python-2.7.2/Python/ceval.c.tsc-on-ppc Python-2.7.2/Python/ceval.c
-ppc_getcounter(uint64 *v)
+ppc32_getcounter(uint64 *v)
{
- register unsigned long tbu, tb, tbu2;
- unsigned long tbu, tb, tbu2;
+ union { long long ll; long ii[2]; } u;
+ long tmp;

View File

@ -1,7 +1,6 @@
diff -up Python-3.2.2/Lib/hashlib.py.hashlib-fips Python-3.2.2/Lib/hashlib.py
--- Python-3.2.2/Lib/hashlib.py.hashlib-fips 2011-09-03 12:16:41.000000000 -0400
+++ Python-3.2.2/Lib/hashlib.py 2011-09-14 01:55:48.090252006 -0400
@@ -23,6 +23,16 @@ the zlib module.
--- Python-3.4.0b1/Lib/hashlib.py.hashlib-fips 2013-11-24 21:36:54.000000000 +0100
+++ Python-3.4.0b1/Lib/hashlib.py 2013-11-27 11:45:17.073617547 +0100
@@ -23,6 +23,16 @@
Choose your hash function wisely. Some have known collision weaknesses.
sha384 and sha512 will be slow on 32 bit platforms.
@ -18,7 +17,27 @@ diff -up Python-3.2.2/Lib/hashlib.py.hashlib-fips Python-3.2.2/Lib/hashlib.py
Hash objects have these methods:
- update(arg): Update the hash object with the bytes in arg. Repeated calls
are equivalent to a single call with the concatenation of all
@@ -96,33 +106,36 @@ def __get_openssl_constructor(name):
@@ -63,6 +73,19 @@
__all__ = __always_supported + ('new', 'algorithms_guaranteed',
'algorithms_available', 'pbkdf2_hmac')
+import functools
+def __ignore_usedforsecurity(func):
+ """Used for sha3_* functions. Until OpenSSL implements them, we want
+ to use them from Python _sha3 module, but we want them to accept
+ usedforsecurity argument too."""
+ # TODO: remove this function when OpenSSL implements sha3
+ @functools.wraps(func)
+ def inner(*args, **kwargs):
+ if 'usedforsecurity' in kwargs:
+ kwargs.pop('usedforsecurity')
+ return func(*args, **kwargs)
+ return inner
+
__builtin_constructor_cache = {}
@@ -108,34 +131,41 @@
f = getattr(_hashlib, 'openssl_' + name)
# Allow the C module to raise ValueError. The function will be
# defined but the hash not actually available thanks to OpenSSL.
@ -30,16 +49,17 @@ diff -up Python-3.2.2/Lib/hashlib.py.hashlib-fips Python-3.2.2/Lib/hashlib.py
# Use the C function directly (very fast)
return f
except (AttributeError, ValueError):
- return __get_builtin_constructor(name)
+ raise
+ # TODO: We want to just raise here when OpenSSL implements sha3
+ # because we want to make sure that Fedora uses everything from OpenSSL
return __get_builtin_constructor(name)
+def __py_new(name, data=b'', usedforsecurity=True):
+ """new(name, data=b'', usedforsecurity=True) - Return a new hashing object using
+ the named algorithm; optionally initialized with data (which must be bytes).
-def __py_new(name, data=b''):
- """new(name, data=b'') - Return a new hashing object using the named algorithm;
- optionally initialized with data (which must be bytes).
+def __py_new(name, data=b'', usedforsecurity=True):
+ """new(name, data=b'', usedforsecurity=True) - Return a new hashing object using
+ the named algorithm; optionally initialized with data (which must be bytes).
+ The 'usedforsecurity' keyword argument does nothing, and is for compatibilty
+ with the OpenSSL implementation
"""
@ -64,19 +84,41 @@ diff -up Python-3.2.2/Lib/hashlib.py.hashlib-fips Python-3.2.2/Lib/hashlib.py
- # hash, try using our builtin implementations.
- # This allows for SHA224/256 and SHA384/512 support even though
- # the OpenSSL library prior to 0.9.8 doesn't provide them.
- return __get_builtin_constructor(name)(data)
-
+ raise
+ # TODO: We want to just raise here when OpenSSL implements sha3
+ # because we want to make sure that Fedora uses everything from OpenSSL
return __get_builtin_constructor(name)(data)
-
try:
import _hashlib
diff -up Python-3.2.2/Lib/test/test_hashlib.py.hashlib-fips Python-3.2.2/Lib/test/test_hashlib.py
--- Python-3.2.2/Lib/test/test_hashlib.py.hashlib-fips 2011-09-03 12:16:43.000000000 -0400
+++ Python-3.2.2/Lib/test/test_hashlib.py 2011-09-14 01:45:48.462251974 -0400
@@ -22,6 +22,19 @@ from test.support import _4G, precisionb
# Were we compiled --with-pydebug or with #define Py_DEBUG?
new = __hash_new
@@ -215,7 +245,10 @@
# try them all, some may not work due to the OpenSSL
# version not supporting that algorithm.
try:
- globals()[__func_name] = __get_hash(__func_name)
+ func = __get_hash(__func_name)
+ if 'sha3_' in __func_name:
+ func = __ignore_usedforsecurity(func)
+ globals()[__func_name] = func
except ValueError:
import logging
logging.exception('code for hash %s was not found.', __func_name)
@@ -223,3 +256,4 @@
# Cleanup locals()
del __always_supported, __func_name, __get_hash
del __py_new, __hash_new, __get_openssl_constructor
+del __ignore_usedforsecurity
--- Python-3.4.0b1/Lib/test/test_hashlib.py 2013-11-27 11:55:42.769601363 +0100
+++ Python-3.4.0b1/Lib/test/test_hashlib.py 2013-11-28 09:33:03.929008508 +0100
@@ -24,7 +24,22 @@
COMPILED_WITH_PYDEBUG = hasattr(sys, 'gettotalrefcount')
c_hashlib = import_fresh_module('hashlib', fresh=['_hashlib'])
-py_hashlib = import_fresh_module('hashlib', blocked=['_hashlib'])
+# skipped on Fedora, since we always use OpenSSL implementation
+# py_hashlib = import_fresh_module('hashlib', blocked=['_hashlib'])
+
+def openssl_enforces_fips():
+ # Use the "openssl" command (if present) to try to determine if the local
+ # OpenSSL is configured to enforce FIPS
@ -93,7 +135,7 @@ diff -up Python-3.2.2/Lib/test/test_hashlib.py.hashlib-fips Python-3.2.2/Lib/tes
def hexstr(s):
assert isinstance(s, bytes), repr(s)
@@ -31,6 +44,16 @@ def hexstr(s):
@@ -34,6 +49,16 @@
r += h[(i >> 4) & 0xF] + h[i & 0xF]
return r
@ -110,7 +152,7 @@ diff -up Python-3.2.2/Lib/test/test_hashlib.py.hashlib-fips Python-3.2.2/Lib/tes
class HashLibTestCase(unittest.TestCase):
supported_hash_names = ( 'md5', 'MD5', 'sha1', 'SHA1',
@@ -59,11 +82,11 @@ class HashLibTestCase(unittest.TestCase)
@@ -66,11 +91,11 @@
# For each algorithm, test the direct constructor and the use
# of hashlib.new given the algorithm name.
for algorithm, constructors in self.constructors_to_test.items():
@ -125,71 +167,45 @@ diff -up Python-3.2.2/Lib/test/test_hashlib.py.hashlib-fips Python-3.2.2/Lib/tes
constructors.add(_test_algorithm_via_hashlib_new)
_hashlib = self._conditional_import_module('_hashlib')
@@ -75,22 +98,7 @@ class HashLibTestCase(unittest.TestCase)
@@ -82,26 +107,12 @@
for algorithm, constructors in self.constructors_to_test.items():
constructor = getattr(_hashlib, 'openssl_'+algorithm, None)
if constructor:
- constructors.add(constructor)
-
+ constructors.add(suppress_fips(constructor))
def add_builtin_constructor(name):
constructor = getattr(hashlib, "__get_builtin_constructor")(name)
self.constructors_to_test[name].add(constructor)
- _md5 = self._conditional_import_module('_md5')
- if _md5:
- self.constructors_to_test['md5'].add(_md5.md5)
- add_builtin_constructor('md5')
- _sha1 = self._conditional_import_module('_sha1')
- if _sha1:
- self.constructors_to_test['sha1'].add(_sha1.sha1)
- add_builtin_constructor('sha1')
- _sha256 = self._conditional_import_module('_sha256')
- if _sha256:
- self.constructors_to_test['sha224'].add(_sha256.sha224)
- self.constructors_to_test['sha256'].add(_sha256.sha256)
- add_builtin_constructor('sha224')
- add_builtin_constructor('sha256')
- _sha512 = self._conditional_import_module('_sha512')
- if _sha512:
- self.constructors_to_test['sha384'].add(_sha512.sha384)
- self.constructors_to_test['sha512'].add(_sha512.sha512)
+ constructors.add(suppress_fips(constructor))
- add_builtin_constructor('sha384')
- add_builtin_constructor('sha512')
super(HashLibTestCase, self).__init__(*args, **kwargs)
@@ -138,7 +146,7 @@ class HashLibTestCase(unittest.TestCase)
@@ -157,9 +169,6 @@
else:
del sys.modules['_md5']
self.assertRaises(TypeError, get_builtin_constructor, 3)
- constructor = get_builtin_constructor('md5')
- self.assertIs(constructor, _md5.md5)
- self.assertEqual(sorted(builtin_constructor_cache), ['MD5', 'md5'])
def test_hexdigest(self):
for name in self.supported_hash_names:
- h = hashlib.new(name)
+ h = hashlib.new(name, usedforsecurity=False)
assert isinstance(h.digest(), bytes), name
self.assertEqual(hexstr(h.digest()), h.hexdigest())
@@ -149,12 +157,12 @@ class HashLibTestCase(unittest.TestCase)
cees = b'c' * 126
for name in self.supported_hash_names:
- m1 = hashlib.new(name)
+ m1 = hashlib.new(name, usedforsecurity=False)
m1.update(aas)
m1.update(bees)
m1.update(cees)
- m2 = hashlib.new(name)
+ m2 = hashlib.new(name, usedforsecurity=False)
m2.update(aas + bees + cees)
self.assertEqual(m1.digest(), m2.digest())
@@ -324,13 +332,13 @@ class HashLibTestCase(unittest.TestCase)
# for multithreaded operation (which is hardwired to 2048).
gil_minsize = 2048
- m = hashlib.md5()
+ m = hashlib.md5(usedforsecurity=False)
m.update(b'1')
m.update(b'#' * gil_minsize)
m.update(b'1')
self.assertEqual(m.hexdigest(), 'cb1e1a2cbc80be75e19935d621fb9b21')
- m = hashlib.md5(b'x' * gil_minsize)
+ m = hashlib.md5(b'x' * gil_minsize, usedforsecurity=False)
self.assertEqual(m.hexdigest(), 'cfb767f225d58469c5de3632a8803958')
@unittest.skipUnless(threading, 'Threading required for this test.')
@@ -370,6 +378,67 @@ class HashLibTestCase(unittest.TestCase)
for cons in self.hash_constructors:
@@ -558,6 +567,65 @@
self.assertEqual(expected_hash, hasher.hexdigest())
@ -245,31 +261,36 @@ diff -up Python-3.2.2/Lib/test/test_hashlib.py.hashlib-fips Python-3.2.2/Lib/tes
+ m = _hashlib.new('md5', usedforsecurity=False)
+ m.update(b'abc\n')
+ self.assertEquals(m.hexdigest(), "0bee89b07a248e27c83fc3d5951213c1")
+
+
+ m = _hashlib.openssl_md5(b'abc\n', usedforsecurity=False)
+ self.assertEquals(m.hexdigest(), "0bee89b07a248e27c83fc3d5951213c1")
+
+ m = _hashlib.new('md5', b'abc\n', usedforsecurity=False)
+ self.assertEquals(m.hexdigest(), "0bee89b07a248e27c83fc3d5951213c1")
+
+
+
def test_main():
support.run_unittest(HashLibTestCase)
diff -up Python-3.2.2/Modules/_hashopenssl.c.hashlib-fips Python-3.2.2/Modules/_hashopenssl.c
--- Python-3.2.2/Modules/_hashopenssl.c.hashlib-fips 2011-09-03 12:16:46.000000000 -0400
+++ Python-3.2.2/Modules/_hashopenssl.c 2011-09-14 00:52:41.225252001 -0400
@@ -37,6 +37,8 @@
#endif
class KDFTests(unittest.TestCase):
@@ -639,6 +707,7 @@
with self.assertRaisesRegex(ValueError, 'unsupported hash type'):
pbkdf2('unknown', b'pass', b'salt', 1)
+ @unittest.skip('skipped on Fedora, as we always use OpenSSL pbkdf2_hmac')
def test_pbkdf2_hmac_py(self):
self._test_pbkdf2_hmac(py_hashlib.pbkdf2_hmac)
--- Python-3.4.0b1/Modules/_hashopenssl.c.hashlib-fips 2013-11-24 21:36:56.000000000 +0100
+++ Python-3.4.0b1/Modules/_hashopenssl.c 2013-11-27 12:01:57.443537463 +0100
@@ -19,6 +19,8 @@
/* EVP is the preferred interface to hashing in OpenSSL */
+#include <openssl/ssl.h>
+#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/hmac.h>
/* We use the object interface to discover what hashes OpenSSL supports. */
#include <openssl/objects.h>
@@ -68,11 +70,19 @@ typedef struct {
@@ -48,11 +50,19 @@
static PyTypeObject EVPtype;
@ -293,7 +314,7 @@ diff -up Python-3.2.2/Modules/_hashopenssl.c.hashlib-fips Python-3.2.2/Modules/_
DEFINE_CONSTS_FOR_NEW(md5)
DEFINE_CONSTS_FOR_NEW(sha1)
@@ -117,6 +127,48 @@ EVP_hash(EVPobject *self, const void *vp
@@ -97,6 +107,48 @@
}
}
@ -342,7 +363,7 @@ diff -up Python-3.2.2/Modules/_hashopenssl.c.hashlib-fips Python-3.2.2/Modules/_
/* Internal methods for a hash object */
static void
@@ -303,15 +355,16 @@ EVP_repr(EVPobject *self)
@@ -281,15 +333,16 @@
static int
EVP_tp_init(EVPobject *self, PyObject *args, PyObject *kwds)
{
@ -362,7 +383,7 @@ diff -up Python-3.2.2/Modules/_hashopenssl.c.hashlib-fips Python-3.2.2/Modules/_
return -1;
}
@@ -332,7 +385,12 @@ EVP_tp_init(EVPobject *self, PyObject *a
@@ -310,7 +363,12 @@
PyBuffer_Release(&view);
return -1;
}
@ -376,7 +397,7 @@ diff -up Python-3.2.2/Modules/_hashopenssl.c.hashlib-fips Python-3.2.2/Modules/_
self->name = name_obj;
Py_INCREF(self->name);
@@ -416,7 +474,8 @@ static PyTypeObject EVPtype = {
@@ -394,7 +452,8 @@
static PyObject *
EVPnew(PyObject *name_obj,
const EVP_MD *digest, const EVP_MD_CTX *initial_ctx,
@ -386,7 +407,7 @@ diff -up Python-3.2.2/Modules/_hashopenssl.c.hashlib-fips Python-3.2.2/Modules/_
{
EVPobject *self;
@@ -431,7 +490,12 @@ EVPnew(PyObject *name_obj,
@@ -409,7 +468,12 @@
if (initial_ctx) {
EVP_MD_CTX_copy(&self->ctx, initial_ctx);
} else {
@ -400,7 +421,7 @@ diff -up Python-3.2.2/Modules/_hashopenssl.c.hashlib-fips Python-3.2.2/Modules/_
}
if (cp && len) {
@@ -455,21 +519,29 @@ PyDoc_STRVAR(EVP_new__doc__,
@@ -433,21 +497,29 @@
An optional string argument may be provided and will be\n\
automatically hashed.\n\
\n\
@ -434,7 +455,7 @@ diff -up Python-3.2.2/Modules/_hashopenssl.c.hashlib-fips Python-3.2.2/Modules/_
return NULL;
}
@@ -483,7 +555,8 @@ EVP_new(PyObject *self, PyObject *args,
@@ -461,7 +533,8 @@
digest = EVP_get_digestbyname(name);
@ -444,7 +465,7 @@ diff -up Python-3.2.2/Modules/_hashopenssl.c.hashlib-fips Python-3.2.2/Modules/_
if (data_obj)
PyBuffer_Release(&view);
@@ -547,58 +620,115 @@ generate_hash_name_list(void)
@@ -742,57 +815,115 @@
/*
@ -461,7 +482,7 @@ diff -up Python-3.2.2/Modules/_hashopenssl.c.hashlib-fips Python-3.2.2/Modules/_
#define GEN_CONSTRUCTOR(NAME) \
static PyObject * \
- EVP_new_ ## NAME (PyObject *self, PyObject *args) \
+ EVP_new_ ## NAME (PyObject *self, PyObject *args, PyObject *kwdict) \
+ EVP_new_ ## NAME (PyObject *self, PyObject *args, PyObject *kwdict) \
{ \
- PyObject *data_obj = NULL; \
- Py_buffer view = { 0 }; \
@ -487,8 +508,8 @@ diff -up Python-3.2.2/Modules/_hashopenssl.c.hashlib-fips Python-3.2.2/Modules/_
+ return implement_specific_EVP_new(self, args, kwdict, \
+ "|Oi:" #NAME, \
+ &cached_info_ ## NAME ); \
}
+ }
+
+static PyObject *
+implement_specific_EVP_new(PyObject *self, PyObject *args, PyObject *kwdict,
+ const char *format,
@ -533,8 +554,8 @@ diff -up Python-3.2.2/Modules/_hashopenssl.c.hashlib-fips Python-3.2.2/Modules/_
+ } else {
+ PyErr_SetString(PyExc_ValueError, "Error initializing hash");
+ }
+ }
+
}
+ if (data_obj)
+ PyBuffer_Release(&view);
+
@ -560,10 +581,9 @@ diff -up Python-3.2.2/Modules/_hashopenssl.c.hashlib-fips Python-3.2.2/Modules/_
- EVP_DigestInit(CONST_new_ ## NAME ## _ctx_p, EVP_get_digestbyname(#NAME)); \
- } \
- } \
-} while (0);
+/*
+ Macro/function pair to set up the constructors.
+
+ Try to initialize a context for each hash twice, once with
+ EVP_MD_CTX_FLAG_NON_FIPS_ALLOW and once without.
+
@ -572,7 +592,7 @@ diff -up Python-3.2.2/Modules/_hashopenssl.c.hashlib-fips Python-3.2.2/Modules/_
+*/
+#define INIT_CONSTRUCTOR_CONSTANTS(NAME) do { \
+ init_constructor_constant(&cached_info_ ## NAME, #NAME); \
+} while (0);
} while (0);
+static void
+init_constructor_constant(EVPCachedInfo *cached_info, const char *name)
+{
@ -594,15 +614,16 @@ diff -up Python-3.2.2/Modules/_hashopenssl.c.hashlib-fips Python-3.2.2/Modules/_
+ }
+ }
+}
+
+
GEN_CONSTRUCTOR(md5)
GEN_CONSTRUCTOR(sha1)
#ifdef _OPENSSL_SUPPORTS_SHA2
@@ -641,12 +774,10 @@ PyInit__hashlib(void)
@@ -843,13 +974,10 @@
{
PyObject *m, *openssl_md_meth_names;
- OpenSSL_add_all_digests();
- ERR_load_crypto_strings();
+ SSL_load_error_strings();
+ SSL_library_init();

View File

@ -19,8 +19,8 @@
--- Lib/test/test_gdb.py.old 2012-04-11 21:04:01.367073855 -0400
+++ Lib/test/test_gdb.py 2012-04-12 08:52:58.320288761 -0400
@@ -144,6 +153,10 @@
'Do you need "set solib-search-path" or '
'"set sysroot"?',
'Missing separate debuginfo for ',
'Try: zypper install -C ',
)
+ ignore_patterns += ('warning: Unable to open',
+ 'Missing separate debuginfo for',

View File

@ -1,56 +1,54 @@
diff -up Python-3.3.0b1/Lib/test/test_os.py.uid-gid-overflows Python-3.3.0b1/Lib/test/test_os.py
--- Python-3.3.0b1/Lib/test/test_os.py.uid-gid-overflows 2012-06-26 16:19:48.000000000 -0400
+++ Python-3.3.0b1/Lib/test/test_os.py 2012-07-20 14:21:46.856688739 -0400
@@ -1174,30 +1174,36 @@ if sys.platform != 'win32':
def test_setuid(self):
if os.getuid() != 0:
self.assertRaises(os.error, os.setuid, 0)
+ self.assertRaises(TypeError, os.setuid, 'not an int')
self.assertRaises(OverflowError, os.setuid, 1<<32)
--- Python-3.4.0b1/Lib/test/test_os.py.orig 2013-11-27 12:07:32.368411798 +0100
+++ Python-3.4.0b1/Lib/test/test_os.py 2013-11-27 12:12:11.220265174 +0100
@@ -1319,30 +1319,36 @@
def test_setuid(self):
if os.getuid() != 0:
self.assertRaises(OSError, os.setuid, 0)
+ self.assertRaises(TypeError, os.setuid, 'not an int')
self.assertRaises(OverflowError, os.setuid, 1<<32)
if hasattr(os, 'setgid'):
def test_setgid(self):
if os.getuid() != 0 and not HAVE_WHEEL_GROUP:
self.assertRaises(os.error, os.setgid, 0)
+ self.assertRaises(TypeError, os.setgid, 'not an int')
self.assertRaises(OverflowError, os.setgid, 1<<32)
@unittest.skipUnless(hasattr(os, 'setgid'), 'test needs os.setgid()')
def test_setgid(self):
if os.getuid() != 0 and not HAVE_WHEEL_GROUP:
self.assertRaises(OSError, os.setgid, 0)
+ self.assertRaises(TypeError, os.setgid, 'not an int')
self.assertRaises(OverflowError, os.setgid, 1<<32)
if hasattr(os, 'seteuid'):
def test_seteuid(self):
if os.getuid() != 0:
self.assertRaises(os.error, os.seteuid, 0)
+ self.assertRaises(TypeError, os.seteuid, 'not an int')
self.assertRaises(OverflowError, os.seteuid, 1<<32)
@unittest.skipUnless(hasattr(os, 'seteuid'), 'test needs os.seteuid()')
def test_seteuid(self):
if os.getuid() != 0:
self.assertRaises(OSError, os.seteuid, 0)
+ self.assertRaises(TypeError, os.seteuid, 'not an int')
self.assertRaises(OverflowError, os.seteuid, 1<<32)
if hasattr(os, 'setegid'):
def test_setegid(self):
if os.getuid() != 0 and not HAVE_WHEEL_GROUP:
self.assertRaises(os.error, os.setegid, 0)
+ self.assertRaises(TypeError, os.setegid, 'not an int')
self.assertRaises(OverflowError, os.setegid, 1<<32)
@unittest.skipUnless(hasattr(os, 'setegid'), 'test needs os.setegid()')
def test_setegid(self):
if os.getuid() != 0 and not HAVE_WHEEL_GROUP:
self.assertRaises(OSError, os.setegid, 0)
+ self.assertRaises(TypeError, os.setegid, 'not an int')
self.assertRaises(OverflowError, os.setegid, 1<<32)
if hasattr(os, 'setreuid'):
def test_setreuid(self):
if os.getuid() != 0:
self.assertRaises(os.error, os.setreuid, 0, 0)
+ self.assertRaises(TypeError, os.setreuid, 'not an int', 0)
+ self.assertRaises(TypeError, os.setreuid, 0, 'not an int')
self.assertRaises(OverflowError, os.setreuid, 1<<32, 0)
self.assertRaises(OverflowError, os.setreuid, 0, 1<<32)
@unittest.skipUnless(hasattr(os, 'setreuid'), 'test needs os.setreuid()')
def test_setreuid(self):
if os.getuid() != 0:
self.assertRaises(OSError, os.setreuid, 0, 0)
+ self.assertRaises(TypeError, os.setreuid, 'not an int', 0)
+ self.assertRaises(TypeError, os.setreuid, 0, 'not an int')
self.assertRaises(OverflowError, os.setreuid, 1<<32, 0)
self.assertRaises(OverflowError, os.setreuid, 0, 1<<32)
@@ -1212,6 +1218,8 @@ if sys.platform != 'win32':
def test_setregid(self):
if os.getuid() != 0 and not HAVE_WHEEL_GROUP:
self.assertRaises(os.error, os.setregid, 0, 0)
+ self.assertRaises(TypeError, os.setregid, 'not an int', 0)
+ self.assertRaises(TypeError, os.setregid, 0, 'not an int')
self.assertRaises(OverflowError, os.setregid, 1<<32, 0)
self.assertRaises(OverflowError, os.setregid, 0, 1<<32)
@@ -1358,6 +1364,8 @@
def test_setregid(self):
if os.getuid() != 0 and not HAVE_WHEEL_GROUP:
self.assertRaises(OSError, os.setregid, 0, 0)
+ self.assertRaises(TypeError, os.setregid, 'not an int', 0)
+ self.assertRaises(TypeError, os.setregid, 0, 'not an int')
self.assertRaises(OverflowError, os.setregid, 1<<32, 0)
self.assertRaises(OverflowError, os.setregid, 0, 1<<32)
diff -up Python-3.3.0b1/Lib/test/test_pwd.py.uid-gid-overflows Python-3.3.0b1/Lib/test/test_pwd.py
--- Python-3.3.0b1/Lib/test/test_pwd.py.uid-gid-overflows 2012-06-26 16:19:48.000000000 -0400
+++ Python-3.3.0b1/Lib/test/test_pwd.py 2012-07-20 14:21:46.857688726 -0400
@@ -87,9 +87,9 @@ class PwdTest(unittest.TestCase):
--- Python-3.4.0b1/Lib/test/test_pwd.py.orig 2013-11-24 21:36:55.000000000 +0100
+++ Python-3.4.0b1/Lib/test/test_pwd.py 2013-11-27 12:07:32.369411798 +0100
@@ -89,9 +89,9 @@
# In some cases, byuids isn't a complete list of all users in the
# system, so if we try to pick a value not in byuids (via a perturbing
# loop, say), pwd.getpwuid() might still be able to find data for that

View File

@ -1,14 +1,12 @@
diff -up Python-3.3.0/Lib/test/support.py.rhbz913732 Python-3.3.0/Lib/test/support.py
--- Python-3.3.0/Lib/test/support.py.rhbz913732 2013-03-04 16:25:53.885258476 -0500
+++ Python-3.3.0/Lib/test/support.py 2013-03-04 16:25:58.499258157 -0500
@@ -544,7 +544,8 @@ def bind_port(sock, host=HOST):
--- Python-3.4.0b1/Lib/test/support/__init__.py.orig 2013-11-27 12:14:26.507216624 +0100
+++ Python-3.4.0b1/Lib/test/support/__init__.py 2013-11-27 12:17:01.490805587 +0100
@@ -593,7 +593,8 @@
if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR) == 1:
raise TestFailed("tests should never set the SO_REUSEADDR " \
"socket option on TCP/IP sockets!")
- if hasattr(socket, 'SO_REUSEPORT'):
+ if hasattr(socket, 'SO_REUSEPORT') \
+ and 'WITHIN_PYTHON_RPM_BUILD' not in os.environ: # rhbz#913732
if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) == 1:
raise TestFailed("tests should never set the SO_REUSEPORT " \
"socket option on TCP/IP sockets!")
diff -up Python-3.3.0/Lib/test/test_support.py.rhbz913732 Python-3.3.0/Lib/test/test_support.py
try:
if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) == 1:
raise TestFailed("tests should never set the SO_REUSEPORT " \

View File

@ -1,13 +0,0 @@
Index: Python-3.3.0/Lib/platform.py
===================================================================
--- Python-3.3.0.orig/Lib/platform.py
+++ Python-3.3.0/Lib/platform.py
@@ -331,7 +331,7 @@ def linux_distribution(distname='', vers
return _dist_try_harder(distname,version,id)
# Read the first line
- with open('/etc/'+file, 'r') as f:
+ with open('/etc/'+file, 'r', encoding='utf-8', errors='surrogateescape') as f:
firstline = f.readline()
_distname, _version, _id = _parse_release_file(firstline)

View File

@ -1,13 +0,0 @@
diff -up Python-3.3.1/Misc/NEWS.fix-test_gdb-test_threads Python-3.3.1/Misc/NEWS
diff -up Python-3.3.1/Tools/gdb/libpython.py.fix-test_gdb-test_threads Python-3.3.1/Tools/gdb/libpython.py
--- Python-3.3.1/Tools/gdb/libpython.py.fix-test_gdb-test_threads 2013-05-09 12:12:01.621592211 -0400
+++ Python-3.3.1/Tools/gdb/libpython.py 2013-05-09 12:12:01.632592209 -0400
@@ -1465,7 +1465,7 @@ class Frame(object):
# This assumes the _POSIX_THREADS version of Python/ceval_gil.h:
name = self._gdbframe.name()
if name:
- return name.startswith('pthread_cond_timedwait')
+ return 'pthread_cond_timedwait' in name
def is_gc_collect(self):
'''Is this frame "collect" within the garbage-collector?'''

View File

@ -1,49 +0,0 @@
# HG changeset patch
# User Antoine Pitrou <solipsis@pitrou.net>
# Date 1368892602 -7200
# Node ID c627638753e2d25a98950585b259104a025937a9
# Parent 9682241dc8fcb4b1aef083bd30860efa070c3d6d
Issue #17980: Fix possible abuse of ssl.match_hostname() for denial of service using certificates with many wildcards (CVE-2013-2099).
diff --git a/Lib/ssl.py b/Lib/ssl.py
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@ -129,9 +129,16 @@ class CertificateError(ValueError):
pass
-def _dnsname_to_pat(dn):
+def _dnsname_to_pat(dn, max_wildcards=1):
pats = []
for frag in dn.split(r'.'):
+ if frag.count('*') > max_wildcards:
+ # Issue #17980: avoid denials of service by refusing more
+ # than one wildcard per fragment. A survery of established
+ # policy among SSL implementations showed it to be a
+ # reasonable choice.
+ raise CertificateError(
+ "too many wildcards in certificate DNS name: " + repr(dn))
if frag == '*':
# When '*' is a fragment by itself, it matches a non-empty dotless
# fragment.
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -349,6 +349,17 @@ class BasicSocketTests(unittest.TestCase
self.assertRaises(ValueError, ssl.match_hostname, None, 'example.com')
self.assertRaises(ValueError, ssl.match_hostname, {}, 'example.com')
+ # Issue #17980: avoid denials of service by refusing more than one
+ # wildcard per fragment.
+ cert = {'subject': ((('commonName', 'a*b.com'),),)}
+ ok(cert, 'axxb.com')
+ cert = {'subject': ((('commonName', 'a*b.co*'),),)}
+ ok(cert, 'axxb.com')
+ cert = {'subject': ((('commonName', 'a*b*.com'),),)}
+ with self.assertRaises(ssl.CertificateError) as cm:
+ ssl.match_hostname(cert, 'axxbxxc.com')
+ self.assertIn("too many wildcards", str(cm.exception))
+
def test_server_side(self):
# server_hostname doesn't work for server sockets
ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)

View File

@ -1,241 +0,0 @@
diff -r e0f86c3b3685 Lib/test/nullbytecert.pem
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Lib/test/nullbytecert.pem Sun Aug 11 18:17:23 2013 +0200
@@ -0,0 +1,90 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 0 (0x0)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=US, ST=Oregon, L=Beaverton, O=Python Software Foundation, OU=Python Core Development, CN=null.python.org\x00example.org/emailAddress=python-dev@python.org
+ Validity
+ Not Before: Aug 7 13:11:52 2013 GMT
+ Not After : Aug 7 13:12:52 2013 GMT
+ Subject: C=US, ST=Oregon, L=Beaverton, O=Python Software Foundation, OU=Python Core Development, CN=null.python.org\x00example.org/emailAddress=python-dev@python.org
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ Public-Key: (2048 bit)
+ Modulus:
+ 00:b5:ea:ed:c9:fb:46:7d:6f:3b:76:80:dd:3a:f3:
+ 03:94:0b:a7:a6:db:ec:1d:df:ff:23:74:08:9d:97:
+ 16:3f:a3:a4:7b:3e:1b:0e:96:59:25:03:a7:26:e2:
+ 88:a9:cf:79:cd:f7:04:56:b0:ab:79:32:6e:59:c1:
+ 32:30:54:eb:58:a8:cb:91:f0:42:a5:64:27:cb:d4:
+ 56:31:88:52:ad:cf:bd:7f:f0:06:64:1f:cc:27:b8:
+ a3:8b:8c:f3:d8:29:1f:25:0b:f5:46:06:1b:ca:02:
+ 45:ad:7b:76:0a:9c:bf:bb:b9:ae:0d:16:ab:60:75:
+ ae:06:3e:9c:7c:31:dc:92:2f:29:1a:e0:4b:0c:91:
+ 90:6c:e9:37:c5:90:d7:2a:d7:97:15:a3:80:8f:5d:
+ 7b:49:8f:54:30:d4:97:2c:1c:5b:37:b5:ab:69:30:
+ 68:43:d3:33:78:4b:02:60:f5:3c:44:80:a1:8f:e7:
+ f0:0f:d1:5e:87:9e:46:cf:62:fc:f9:bf:0c:65:12:
+ f1:93:c8:35:79:3f:c8:ec:ec:47:f5:ef:be:44:d5:
+ ae:82:1e:2d:9a:9f:98:5a:67:65:e1:74:70:7c:cb:
+ d3:c2:ce:0e:45:49:27:dc:e3:2d:d4:fb:48:0e:2f:
+ 9e:77:b8:14:46:c0:c4:36:ca:02:ae:6a:91:8c:da:
+ 2f:85
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Basic Constraints: critical
+ CA:FALSE
+ X509v3 Subject Key Identifier:
+ 88:5A:55:C0:52:FF:61:CD:52:A3:35:0F:EA:5A:9C:24:38:22:F7:5C
+ X509v3 Key Usage:
+ Digital Signature, Non Repudiation, Key Encipherment
+ X509v3 Subject Alternative Name:
+ *************************************************************
+ WARNING: The values for DNS, email and URI are WRONG. OpenSSL
+ doesn't print the text after a NULL byte.
+ *************************************************************
+ DNS:altnull.python.org, email:null@python.org, URI:http://null.python.org, IP Address:192.0.2.1, IP Address:2001:DB8:0:0:0:0:0:1
+ Signature Algorithm: sha1WithRSAEncryption
+ ac:4f:45:ef:7d:49:a8:21:70:8e:88:59:3e:d4:36:42:70:f5:
+ a3:bd:8b:d7:a8:d0:58:f6:31:4a:b1:a4:a6:dd:6f:d9:e8:44:
+ 3c:b6:0a:71:d6:7f:b1:08:61:9d:60:ce:75:cf:77:0c:d2:37:
+ 86:02:8d:5e:5d:f9:0f:71:b4:16:a8:c1:3d:23:1c:f1:11:b3:
+ 56:6e:ca:d0:8d:34:94:e6:87:2a:99:f2:ae:ae:cc:c2:e8:86:
+ de:08:a8:7f:c5:05:fa:6f:81:a7:82:e6:d0:53:9d:34:f4:ac:
+ 3e:40:fe:89:57:7a:29:a4:91:7e:0b:c6:51:31:e5:10:2f:a4:
+ 60:76:cd:95:51:1a:be:8b:a1:b0:fd:ad:52:bd:d7:1b:87:60:
+ d2:31:c7:17:c4:18:4f:2d:08:25:a3:a7:4f:b7:92:ca:e2:f5:
+ 25:f1:54:75:81:9d:b3:3d:61:a2:f7:da:ed:e1:c6:6f:2c:60:
+ 1f:d8:6f:c5:92:05:ab:c9:09:62:49:a9:14:ad:55:11:cc:d6:
+ 4a:19:94:99:97:37:1d:81:5f:8b:cf:a3:a8:96:44:51:08:3d:
+ 0b:05:65:12:eb:b6:70:80:88:48:72:4f:c6:c2:da:cf:cd:8e:
+ 5b:ba:97:2f:60:b4:96:56:49:5e:3a:43:76:63:04:be:2a:f6:
+ c1:ca:a9:94
+-----BEGIN CERTIFICATE-----
+MIIE2DCCA8CgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBxTELMAkGA1UEBhMCVVMx
+DzANBgNVBAgMBk9yZWdvbjESMBAGA1UEBwwJQmVhdmVydG9uMSMwIQYDVQQKDBpQ
+eXRob24gU29mdHdhcmUgRm91bmRhdGlvbjEgMB4GA1UECwwXUHl0aG9uIENvcmUg
+RGV2ZWxvcG1lbnQxJDAiBgNVBAMMG251bGwucHl0aG9uLm9yZwBleGFtcGxlLm9y
+ZzEkMCIGCSqGSIb3DQEJARYVcHl0aG9uLWRldkBweXRob24ub3JnMB4XDTEzMDgw
+NzEzMTE1MloXDTEzMDgwNzEzMTI1MlowgcUxCzAJBgNVBAYTAlVTMQ8wDQYDVQQI
+DAZPcmVnb24xEjAQBgNVBAcMCUJlYXZlcnRvbjEjMCEGA1UECgwaUHl0aG9uIFNv
+ZnR3YXJlIEZvdW5kYXRpb24xIDAeBgNVBAsMF1B5dGhvbiBDb3JlIERldmVsb3Bt
+ZW50MSQwIgYDVQQDDBtudWxsLnB5dGhvbi5vcmcAZXhhbXBsZS5vcmcxJDAiBgkq
+hkiG9w0BCQEWFXB5dGhvbi1kZXZAcHl0aG9uLm9yZzCCASIwDQYJKoZIhvcNAQEB
+BQADggEPADCCAQoCggEBALXq7cn7Rn1vO3aA3TrzA5QLp6bb7B3f/yN0CJ2XFj+j
+pHs+Gw6WWSUDpybiiKnPec33BFawq3kyblnBMjBU61ioy5HwQqVkJ8vUVjGIUq3P
+vX/wBmQfzCe4o4uM89gpHyUL9UYGG8oCRa17dgqcv7u5rg0Wq2B1rgY+nHwx3JIv
+KRrgSwyRkGzpN8WQ1yrXlxWjgI9de0mPVDDUlywcWze1q2kwaEPTM3hLAmD1PESA
+oY/n8A/RXoeeRs9i/Pm/DGUS8ZPINXk/yOzsR/XvvkTVroIeLZqfmFpnZeF0cHzL
+08LODkVJJ9zjLdT7SA4vnne4FEbAxDbKAq5qkYzaL4UCAwEAAaOB0DCBzTAMBgNV
+HRMBAf8EAjAAMB0GA1UdDgQWBBSIWlXAUv9hzVKjNQ/qWpwkOCL3XDALBgNVHQ8E
+BAMCBeAwgZAGA1UdEQSBiDCBhYIeYWx0bnVsbC5weXRob24ub3JnAGV4YW1wbGUu
+Y29tgSBudWxsQHB5dGhvbi5vcmcAdXNlckBleGFtcGxlLm9yZ4YpaHR0cDovL251
+bGwucHl0aG9uLm9yZwBodHRwOi8vZXhhbXBsZS5vcmeHBMAAAgGHECABDbgAAAAA
+AAAAAAAAAAEwDQYJKoZIhvcNAQEFBQADggEBAKxPRe99SaghcI6IWT7UNkJw9aO9
+i9eo0Fj2MUqxpKbdb9noRDy2CnHWf7EIYZ1gznXPdwzSN4YCjV5d+Q9xtBaowT0j
+HPERs1ZuytCNNJTmhyqZ8q6uzMLoht4IqH/FBfpvgaeC5tBTnTT0rD5A/olXeimk
+kX4LxlEx5RAvpGB2zZVRGr6LobD9rVK91xuHYNIxxxfEGE8tCCWjp0+3ksri9SXx
+VHWBnbM9YaL32u3hxm8sYB/Yb8WSBavJCWJJqRStVRHM1koZlJmXNx2BX4vPo6iW
+RFEIPQsFZRLrtnCAiEhyT8bC2s/Njlu6ly9gtJZWSV46Q3ZjBL4q9sHKqZQ=
+-----END CERTIFICATE-----
diff -r e0f86c3b3685 Lib/test/test_ssl.py
--- a/Lib/test/test_ssl.py Sun Aug 11 13:04:50 2013 +0300
+++ b/Lib/test/test_ssl.py Sun Aug 11 18:17:23 2013 +0200
@@ -55,6 +55,7 @@
WRONGCERT = data_file("XXXnonexisting.pem")
BADKEY = data_file("badkey.pem")
NOKIACERT = data_file("nokia.pem")
+NULLBYTECERT = data_file("nullbytecert.pem")
DHFILE = data_file("dh512.pem")
BYTES_DHFILE = os.fsencode(DHFILE)
@@ -162,6 +163,27 @@
('DNS', 'projects.forum.nokia.com'))
)
+ def test_parse_cert_CVE_2013_4073(self):
+ p = ssl._ssl._test_decode_cert(NULLBYTECERT)
+ if support.verbose:
+ sys.stdout.write("\n" + pprint.pformat(p) + "\n")
+ subject = ((('countryName', 'US'),),
+ (('stateOrProvinceName', 'Oregon'),),
+ (('localityName', 'Beaverton'),),
+ (('organizationName', 'Python Software Foundation'),),
+ (('organizationalUnitName', 'Python Core Development'),),
+ (('commonName', 'null.python.org\x00example.org'),),
+ (('emailAddress', 'python-dev@python.org'),))
+ self.assertEqual(p['subject'], subject)
+ self.assertEqual(p['issuer'], subject)
+ self.assertEqual(p['subjectAltName'],
+ (('DNS', 'altnull.python.org\x00example.com'),
+ ('email', 'null@python.org\x00user@example.org'),
+ ('URI', 'http://null.python.org\x00http://example.org'),
+ ('IP Address', '192.0.2.1'),
+ ('IP Address', '2001:DB8:0:0:0:0:0:1\n'))
+ )
+
def test_DER_to_PEM(self):
with open(SVN_PYTHON_ORG_ROOT_CERT, 'r') as f:
pem = f.read()
@@ -294,6 +316,13 @@
fail(cert, 'foo.a.com')
fail(cert, 'bar.foo.com')
+ # NULL bytes are bad, CVE-2013-4073
+ cert = {'subject': ((('commonName',
+ 'null.python.org\x00example.org'),),)}
+ ok(cert, 'null.python.org\x00example.org') # or raise an error?
+ fail(cert, 'example.org')
+ fail(cert, 'null.python.org')
+
# Slightly fake real-world example
cert = {'notAfter': 'Jun 26 21:41:46 2011 GMT',
'subject': ((('commonName', 'linuxfrz.org'),),),
diff -r e0f86c3b3685 Modules/_ssl.c
--- a/Modules/_ssl.c Sun Aug 11 13:04:50 2013 +0300
+++ b/Modules/_ssl.c Sun Aug 11 18:17:23 2013 +0200
@@ -771,12 +771,14 @@
ext->value->length));
for(j = 0; j < sk_GENERAL_NAME_num(names); j++) {
-
/* get a rendering of each name in the set of names */
+ int gntype;
+ ASN1_STRING *as = NULL;
name = sk_GENERAL_NAME_value(names, j);
- if (name->type == GEN_DIRNAME) {
-
+ gntype = name-> type;
+ switch (gntype) {
+ case GEN_DIRNAME:
/* we special-case DirName as a tuple of
tuples of attributes */
@@ -798,11 +800,62 @@
goto fail;
}
PyTuple_SET_ITEM(t, 1, v);
+ break;
- } else {
+ case GEN_EMAIL:
+ case GEN_DNS:
+ case GEN_URI:
+ /* GENERAL_NAME_print() doesn't handle NUL bytes in ASN1_string
+ correctly. */
+ t = PyTuple_New(2);
+ if (t == NULL)
+ goto fail;
+ switch (gntype) {
+ case GEN_EMAIL:
+ v = PyUnicode_FromString("email");
+ as = name->d.rfc822Name;
+ break;
+ case GEN_DNS:
+ v = PyUnicode_FromString("DNS");
+ as = name->d.dNSName;
+ break;
+ case GEN_URI:
+ v = PyUnicode_FromString("URI");
+ as = name->d.uniformResourceIdentifier;
+ break;
+ }
+ if (v == NULL) {
+ Py_DECREF(t);
+ goto fail;
+ }
+ PyTuple_SET_ITEM(t, 0, v);
+ v = PyUnicode_FromStringAndSize((char *)ASN1_STRING_data(as),
+ ASN1_STRING_length(as));
+ if (v == NULL) {
+ Py_DECREF(t);
+ goto fail;
+ }
+ PyTuple_SET_ITEM(t, 1, v);
+ break;
+ default:
/* for everything else, we use the OpenSSL print form */
-
+ switch (gntype) {
+ /* check for new general name type */
+ case GEN_OTHERNAME:
+ case GEN_X400:
+ case GEN_EDIPARTY:
+ case GEN_IPADD:
+ case GEN_RID:
+ break;
+ default:
+ if (PyErr_WarnFormat(PyExc_RuntimeWarning, 1,
+ "Unknown general name type %d",
+ gntype) == -1) {
+ goto fail;
+ }
+ break;
+ }
(void) BIO_reset(biobuf);
GENERAL_NAME_print(biobuf, name);
len = BIO_gets(biobuf, buf, sizeof(buf)-1);
@@ -829,6 +882,7 @@
goto fail;
}
PyTuple_SET_ITEM(t, 1, v);
+ break;
}
/* and add that rendering to the list */

View File

@ -1,30 +1,3 @@
diff -r 7fa3e824a4ee Lib/py_compile.py
--- a/Lib/py_compile.py Tue Oct 29 22:25:06 2013 -0400
+++ b/Lib/py_compile.py Wed Oct 30 11:08:31 2013 +0100
@@ -108,15 +108,15 @@
byte-compile all installed files (or all files in selected
directories).
"""
- with tokenize.open(file) as f:
- try:
- st = os.fstat(f.fileno())
- except AttributeError:
- st = os.stat(file)
- timestamp = int(st.st_mtime)
- size = st.st_size & 0xFFFFFFFF
- codestring = f.read()
try:
+ with tokenize.open(file) as f:
+ try:
+ st = os.fstat(f.fileno())
+ except AttributeError:
+ st = os.stat(file)
+ timestamp = int(st.st_mtime)
+ size = st.st_size & 0xFFFFFFFF
+ codestring = f.read()
codeobject = builtins.compile(codestring, dfile or file, 'exec',
optimize=optimize)
except Exception as err:
diff -r 7fa3e824a4ee Lib/test/test_py_compile.py
--- a/Lib/test/test_py_compile.py Tue Oct 29 22:25:06 2013 -0400
+++ b/Lib/test/test_py_compile.py Wed Oct 30 11:08:31 2013 +0100
@ -36,6 +9,6 @@ diff -r 7fa3e824a4ee Lib/test/test_py_compile.py
+ bad_coding = os.path.join(os.path.dirname(__file__), 'bad_coding2.py')
+ self.assertIsNone(py_compile.compile(bad_coding, doraise=False))
+
def test_main():
support.run_unittest(PyCompileTests)
def test_relative_path(self):
py_compile.compile(os.path.relpath(self.source_path),
os.path.relpath(self.pyc_path))

View File

@ -0,0 +1,11 @@
diff -r 28c04e954bb6 Lib/lib2to3/main.py
--- a/Lib/lib2to3/main.py Tue Oct 29 22:25:55 2013 -0400
+++ b/Lib/lib2to3/main.py Wed Nov 06 14:33:07 2013 +0100
@@ -213,6 +213,7 @@
# Set up logging handler
level = logging.DEBUG if options.verbose else logging.INFO
+ logging.root.handlers = []
logging.basicConfig(format='%(name)s: %(message)s', level=level)
logger = logging.getLogger('lib2to3.main')

View File

@ -0,0 +1,227 @@
unchanged:
--- Python-3.4.0rc3/Lib/ensurepip/__init__.py 2014-03-10 07:56:33.000000000 +0100
+++ Python-3.4.0rc3-rewheel/Lib/ensurepip/__init__.py 2014-03-12 09:57:12.917120853 +0100
@@ -1,8 +1,10 @@
import os
import os.path
import pkgutil
+import shutil
import sys
import tempfile
+from ensurepip import rewheel
__all__ = ["version", "bootstrap"]
@@ -38,6 +40,8 @@ def _run_pip(args, additional_paths=None
# Install the bundled software
import pip
+ if args[0] in ["install", "list", "wheel"]:
+ args.append('--pre')
pip.main(args)
@@ -87,20 +90,40 @@ def bootstrap(*, root=None, upgrade=Fals
# omit pip and easy_install
os.environ["ENSUREPIP_OPTIONS"] = "install"
- with tempfile.TemporaryDirectory() as tmpdir:
- # Put our bundled wheels into a temporary directory and construct the
- # additional paths that need added to sys.path
- additional_paths = []
+ whls = []
+ rewheel_dir = None
+ # try to see if we have system-wide versions of _PROJECTS
+ dep_records = rewheel.find_system_records([p[0] for p in _PROJECTS])
+ # TODO: check if system-wide versions are the newest ones
+ # if --upgrade is used?
+ if all(dep_records):
+ # if we have all _PROJECTS installed system-wide, we'll recreate
+ # wheels from them and install those
+ rewheel_dir = tempfile.TemporaryDirectory()
+ for dr in dep_records:
+ new_whl = rewheel.rewheel_from_record(dr, rewheel_dir.name)
+ whls.append(os.path.join(rewheel_dir.name, new_whl))
+ else:
+ # if we don't have all the _PROJECTS installed system-wide,
+ # let's just fall back to bundled wheels
for project, version in _PROJECTS:
- wheel_name = "{}-{}-py2.py3-none-any.whl".format(project, version)
- whl = pkgutil.get_data(
+ whl = os.path.join(
+ os.path.dirname(__file__),
"ensurepip",
- "_bundled/{}".format(wheel_name),
+ "bundled",
+ "{}-{}-py2.py3-none-any.whl".format(project, version)
)
- with open(os.path.join(tmpdir, wheel_name), "wb") as fp:
- fp.write(whl)
+ whls.append(whl)
- additional_paths.append(os.path.join(tmpdir, wheel_name))
+ with tempfile.TemporaryDirectory() as tmpdir:
+ # Put our bundled wheels into a temporary directory and construct the
+ # additional paths that need added to sys.path
+ additional_paths = []
+ for whl in whls:
+ shutil.copy(whl, tmpdir)
+ additional_paths.append(os.path.join(tmpdir, os.path.basename(whl)))
+ if rewheel_dir:
+ rewheel_dir.cleanup()
# Construct the arguments to be passed to the pip command
args = ["install", "--no-index", "--find-links", tmpdir]
unchanged:
--- Python-3.4.0rc3/Lib/ensurepip/rewheel/__init__.py 1970-01-01 01:00:00.000000000 +0100
+++ Python-3.4.0rc3-rewheel/Lib/ensurepip/rewheel/__init__.py 2014-03-12 09:55:30.413152104 +0100
@@ -0,0 +1,136 @@
+import argparse
+import csv
+import email.parser
+import os
+import io
+import re
+import site
+import subprocess
+import sys
+import zipfile
+
+def run():
+ parser = argparse.ArgumentParser(description='Recreate wheel of package with given RECORD.')
+ parser.add_argument('record_path',
+ help='Path to RECORD file')
+ parser.add_argument('-o', '--output-dir',
+ help='Dir where to place the wheel, defaults to current working dir.',
+ dest='outdir',
+ default=os.path.curdir)
+
+ ns = parser.parse_args()
+ retcode = 0
+ try:
+ print(rewheel_from_record(**vars(ns)))
+ except BaseException as e:
+ print('Failed: {}'.format(e))
+ retcode = 1
+ sys.exit(1)
+
+def find_system_records(projects):
+ """Return list of paths to RECORD files for system-installed projects.
+
+ If a project is not installed, the resulting list contains None instead
+ of a path to its RECORD
+ """
+ records = []
+ # get system site-packages dirs
+ sys_sitepack = site.getsitepackages([sys.base_prefix, sys.base_exec_prefix])
+ sys_sitepack = [sp for sp in sys_sitepack if os.path.exists(sp)]
+ # try to find all projects in all system site-packages
+ for project in projects:
+ path = None
+ for sp in sys_sitepack:
+ dist_info_re = os.path.join(sp, project) + '-[^\{0}]+\.dist-info'.format(os.sep)
+ candidates = [os.path.join(sp, p) for p in os.listdir(sp)]
+ # filter out candidate dirs based on the above regexp
+ filtered = [c for c in candidates if re.match(dist_info_re, c)]
+ # if we have 0 or 2 or more dirs, something is wrong...
+ if len(filtered) == 1:
+ path = filtered[0]
+ if path is not None:
+ records.append(os.path.join(path, 'RECORD'))
+ else:
+ records.append(None)
+ return records
+
+def rewheel_from_record(record_path, outdir):
+ """Recreates a whee of package with given record_path and returns path
+ to the newly created wheel."""
+ site_dir = os.path.dirname(os.path.dirname(record_path))
+ record_relpath = record_path[len(site_dir):].strip(os.path.sep)
+ to_write, to_omit = get_records_to_pack(site_dir, record_relpath)
+ new_wheel_name = get_wheel_name(record_path)
+ new_wheel_path = os.path.join(outdir, new_wheel_name + '.whl')
+
+ new_wheel = zipfile.ZipFile(new_wheel_path, mode='w', compression=zipfile.ZIP_DEFLATED)
+ # we need to write a new record with just the files that we will write,
+ # e.g. not binaries and *.pyc/*.pyo files
+ new_record = io.StringIO()
+ writer = csv.writer(new_record)
+
+ # handle files that we can write straight away
+ for f, sha_hash, size in to_write:
+ new_wheel.write(os.path.join(site_dir, f), arcname=f)
+ writer.writerow([f, sha_hash,size])
+
+ # rewrite the old wheel file with a new computed one
+ writer.writerow([record_relpath, '', ''])
+ new_wheel.writestr(record_relpath, new_record.getvalue())
+
+ new_wheel.close()
+
+ return new_wheel.filename
+
+def get_wheel_name(record_path):
+ """Return proper name of the wheel, without .whl."""
+ wheel_info_path = os.path.join(os.path.dirname(record_path), 'WHEEL')
+ wheel_info = email.parser.Parser().parsestr(open(wheel_info_path).read())
+ metadata_path = os.path.join(os.path.dirname(record_path), 'METADATA')
+ metadata = email.parser.Parser().parsestr(open(metadata_path).read())
+
+ # construct name parts according to wheel spec
+ distribution = metadata.get('Name')
+ version = metadata.get('Version')
+ build_tag = '' # nothing for now
+ lang_tag = []
+ for t in wheel_info.get_all('Tag'):
+ lang_tag.append(t.split('-')[0])
+ lang_tag = '.'.join(lang_tag)
+ abi_tag, plat_tag = wheel_info.get('Tag').split('-')[1:3]
+ # leave out build tag, if it is empty
+ to_join = filter(None, [distribution, version, build_tag, lang_tag, abi_tag, plat_tag])
+ return '-'.join(list(to_join))
+
+def get_records_to_pack(site_dir, record_relpath):
+ """Accepts path of sitedir and path of RECORD file relative to it.
+ Returns two lists:
+ - list of files that can be written to new RECORD straight away
+ - list of files that shouldn't be written or need some processing
+ (pyc and pyo files, scripts)
+ """
+ record_contents = open(os.path.join(site_dir, record_relpath)).read()
+ # temporary fix for https://github.com/pypa/pip/issues/1376
+ # we need to ignore files under ".data" directory
+ data_dir = os.path.dirname(record_relpath).strip(os.path.sep)
+ data_dir = data_dir[:-len('dist-info')] + 'data'
+
+ to_write = []
+ to_omit = []
+ for l in record_contents.splitlines():
+ spl = l.split(',')
+ if len(spl) == 3:
+ # new record will omit (or write differently):
+ # - abs paths, paths with ".." (entry points),
+ # - pyc+pyo files
+ # - the old RECORD file
+ # TODO: is there any better way to recognize an entry point?
+ if os.path.isabs(spl[0]) or spl[0].startswith('..') or \
+ spl[0].endswith('.pyc') or spl[0].endswith('.pyo') or \
+ spl[0] == record_relpath or spl[0].startswith(data_dir):
+ to_omit.append(spl)
+ else:
+ to_write.append(spl)
+ else:
+ pass # bad RECORD or empty line
+ return to_write, to_omit
only in patch2:
unchanged:
--- Python-3.4.0/Makefile.pre.in 2014-04-01 12:02:48.188136172 +0200
+++ Python-3.4.0-new/Makefile.pre.in 2014-04-01 12:03:23.770394025 +0200
@@ -1140,7 +1140,7 @@ LIBSUBDIRS= tkinter tkinter/test tkinter
test/test_asyncio \
collections concurrent concurrent/futures encodings \
email email/mime test/test_email test/test_email/data \
- ensurepip ensurepip/_bundled \
+ ensurepip ensurepip/_bundled ensurepip/rewheel \
html json test/test_json http dbm xmlrpc \
sqlite3 sqlite3/test \
logging csv wsgiref urllib \

View File

@ -0,0 +1,86 @@
diff --git a/Makefile.pre.in b/Makefile.pre.in
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -71,12 +71,17 @@
BASECFLAGS= @BASECFLAGS@
BASECPPFLAGS= @BASECPPFLAGS@
CONFIGURE_CFLAGS= @CFLAGS@
+# CFLAGS_NODIST is used for building the interpreter and stdlib C extensions.
+# Use it when a compiler flag should _not_ be part of the distutils CFLAGS
+# once Python is installed (Issue #21121).
+CONFIGURE_CFLAGS_NODIST=@CFLAGS_NODIST@
CONFIGURE_CPPFLAGS= @CPPFLAGS@
CONFIGURE_LDFLAGS= @LDFLAGS@
# Avoid assigning CFLAGS, LDFLAGS, etc. so users can use them on the
# command line to append to these values without stomping the pre-set
# values.
PY_CFLAGS= $(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)
+PY_CFLAGS_NODIST=$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST)
# Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
# be able to build extension modules using the directories specified in the
# environment variables
@@ -91,7 +96,7 @@
# Extra C flags added for building the interpreter object files.
CFLAGSFORSHARED=@CFLAGSFORSHARED@
# C flags used for building the interpreter object files
-PY_CORE_CFLAGS= $(PY_CFLAGS) $(PY_CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
+PY_CORE_CFLAGS= $(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
# Machine-dependent subdirectories
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -662,6 +662,7 @@
LIBTOOL_CRUFT
OTHER_LIBTOOL_OPT
UNIVERSAL_ARCH_FLAGS
+CFLAGS_NODIST
BASECFLAGS
OPT
ABIFLAGS
@@ -6504,7 +6505,7 @@
if test $ac_cv_declaration_after_statement_warning = yes
then
- BASECFLAGS="$BASECFLAGS -Werror=declaration-after-statement"
+ CFLAGS_NODIST="$CFLAGS_NODIST -Werror=declaration-after-statement"
fi
# if using gcc on alpha, use -mieee to get (near) full IEEE 754
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1147,6 +1147,7 @@
fi
AC_SUBST(BASECFLAGS)
+AC_SUBST(CFLAGS_NODIST)
# The -arch flags for universal builds on OSX
UNIVERSAL_ARCH_FLAGS=
@@ -1231,7 +1232,7 @@
if test $ac_cv_declaration_after_statement_warning = yes
then
- BASECFLAGS="$BASECFLAGS -Werror=declaration-after-statement"
+ CFLAGS_NODIST="$CFLAGS_NODIST -Werror=declaration-after-statement"
fi
# if using gcc on alpha, use -mieee to get (near) full IEEE 754
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -19,6 +19,12 @@
cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ
+# Add special CFLAGS reserved for building the interpreter and the stdlib
+# modules (Issue #21121).
+cflags = sysconfig.get_config_var('CFLAGS')
+py_cflags_nodist = sysconfig.get_config_var('PY_CFLAGS_NODIST')
+sysconfig.get_config_vars()['CFLAGS'] = cflags + ' ' + py_cflags_nodist
+
def get_platform():
# cross build
if "_PYTHON_HOST_PLATFORM" in os.environ:

View File

@ -0,0 +1,30 @@
Subject: python3.test gdb match addr before builtin
From: Michel Normand <normand@linux.vnet.ibm.com>
For ppc64le archi and python3... and gdb... versions
the test_gdb.py need a change of re.match to handle address before the builtin_id word.
Of course there is no error if this substring is not present.
===
...
#0 0x00003fffb7dd0898 in builtin_id (self=<module at remote 0x3fffb7901440>, v=<unknown at remote 0x3fffb7f68910>) at /builddir/build/BUILD/Python-3.3.2/Python/bltinmodule.c:966
....xxxxxxxxxxxxxxxxxxxxxx <= added regexp
===
Signed-off-by: Michel Normand <normand@linux.vnet.ibm.com>
---
Lib/test/test_gdb.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: Python-3.3.2/Lib/test/test_gdb.py
===================================================================
--- Python-3.3.2.orig/Lib/test/test_gdb.py
+++ Python-3.3.2/Lib/test/test_gdb.py
@@ -230,7 +230,7 @@ class DebuggerTests(unittest.TestCase):
# gdb can insert additional '\n' and space characters in various places
# in its output, depending on the width of the terminal it's connected
# to (using its "wrap_here" function)
- m = re.match('.*#0\s+builtin_id\s+\(self\=.*,\s+v=\s*(.*?)\)\s+at\s+\S*Python/bltinmodule.c.*',
+ m = re.match('.*#0\s+(?: 0x[0-9a-f]+\s+in\s+)?builtin_id\s+\(self\=.*,\s+v=\s*(.*?)\)\s+at\s+\S*Python/bltinmodule.c.*',
gdb_output, re.DOTALL)
if not m:
self.fail('Unexpected gdb output: %r\n%s' % (gdb_output, gdb_output))

View File

@ -16,10 +16,12 @@ not_compiled = [
'test/badsyntax_future7.py',
'test/badsyntax_future8.py',
'test/badsyntax_future9.py',
'test/badsyntax_future10.py',
'test/badsyntax_pep3120.py',
'lib2to3/tests/data/bom.py',
'lib2to3/tests/data/crlf.py',
'lib2to3/tests/data/different_encoding.py',
'lib2to3/tests/data/false_encoding.py',
'lib2to3/tests/data/py2_test_grammar.py',
'.debug-gdb.py',
]

View File

@ -1,12 +0,0 @@
diff -up Python-3.2.1/Lib/test/test_subprocess.py.non-readable-path Python-3.2.1/Lib/test/test_subprocess.py
--- Python-3.2.1/Lib/test/test_subprocess.py.non-readable-path 2011-07-09 02:58:51.000000000 -0400
+++ Python-3.2.1/Lib/test/test_subprocess.py 2011-07-11 11:34:16.284426005 -0400
@@ -618,7 +618,7 @@ class ProcessTestCase(BaseTestCase):
for i in range(1024):
# Windows raises IOError. Others raise OSError.
with self.assertRaises(EnvironmentError) as c:
- subprocess.Popen(['nonexisting_i_hope'],
+ subprocess.Popen(['/usr/bin/nonexisting_i_hope'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
# ignore errors that indicate the command was not found

View File

@ -2,10 +2,12 @@
# Conditionals and other variables controlling the build
# ======================================================
%global pybasever 3.3
%global with_rewheel 1
%global pybasever 3.4
# pybasever without the dot:
%global pyshortver 33
%global pyshortver 34
%global pylibdir %{_libdir}/python%{pybasever}
%global dynload_dir %{pylibdir}/lib-dynload
@ -35,9 +37,9 @@
# For example,
# foo/bar.py
# now has bytecode at:
# foo/__pycache__/bar.cpython-33.pyc
# foo/__pycache__/bar.cpython-33.pyo
%global bytecode_suffixes .cpython-33.py?
# foo/__pycache__/bar.cpython-34.pyc
# foo/__pycache__/bar.cpython-34.pyo
%global bytecode_suffixes .cpython-34.py?
# Python's configure script defines SOVERSION, and this is used in the Makefile
# to determine INSTSONAME, the name of the libpython DSO:
@ -82,11 +84,11 @@
# (/usr/bin/python, rather than the freshly built python), thus leading to
# numerous syntax errors, and incorrect magic numbers in the .pyc files. We
# thus override __os_install_post to avoid invoking this script:
%global __os_install_post /usr/lib/rpm/redhat/brp-compress \
%{!?__debug_package:/usr/lib/rpm/redhat/brp-strip %{__strip}} \
/usr/lib/rpm/redhat/brp-strip-static-archive %{__strip} \
/usr/lib/rpm/redhat/brp-strip-comment-note %{__strip} %{__objdump} \
/usr/lib/rpm/redhat/brp-python-hardlink
%global __os_install_post /usr/lib/rpm/brp-compress \
%{!?__debug_package:/usr/lib/rpm/brp-strip %{__strip}} \
/usr/lib/rpm/brp-strip-static-archive %{__strip} \
/usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump} \
/usr/lib/rpm/brp-python-hardlink
# to remove the invocation of brp-python-bytecompile, whilst keeping the
# invocation of brp-python-hardlink (since this should still work for python3
# pyc/pyo files)
@ -125,8 +127,8 @@
# ==================
Summary: Version 3 of the Python programming language aka Python 3000
Name: python3
Version: %{pybasever}.2
Release: 14%{?dist}
Version: %{pybasever}.1
Release: 3%{?dist}
License: Python
Group: Development/Languages
@ -158,6 +160,8 @@ BuildRequires: libffi-devel
BuildRequires: libGL-devel
BuildRequires: libX11-devel
BuildRequires: ncurses-devel
# workaround http://bugs.python.org/issue19804 (test_uuid requires ifconfig)
BuildRequires: net-tools
BuildRequires: openssl-devel
BuildRequires: pkgconfig
BuildRequires: readline-devel
@ -182,6 +186,11 @@ BuildRequires: valgrind-devel
BuildRequires: xz-devel
BuildRequires: zlib-devel
%if 0%{?with_rewheel}
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%endif
# =======================
# Source code and patches
@ -237,7 +246,7 @@ Patch1: Python-3.1.1-rpath.patch
# (where sys.getfilesystemencoding() == 'ascii')
Patch55: 00055-systemtap.patch
Patch102: python-3.3.0b1-lib64.patch
Patch102: 00102-lib64.patch
# 00104 #
# Only used when "%{_lib}" == "lib64"
@ -263,10 +272,8 @@ Patch111: 00111-no-static-lib.patch
Patch113: 00113-more-configuration-flags.patch
# 00114 #
# Add flags for statvfs.f_flag to the constant list in posixmodule (i.e. "os")
# (rhbz:553020); partially upstream as http://bugs.python.org/issue7647
# Not yet sent upstream
Patch114: 00114-statvfs-f_flag-constants.patch
# Upstream as of Python 3.4.0.b2
# Patch114: 00114-statvfs-f_flag-constants.patch
# 00125 #
# COUNT_ALLOCS is useful for debugging, but the upstream behaviour of always
@ -276,17 +283,6 @@ Patch114: 00114-statvfs-f_flag-constants.patch
# Not yet sent upstream
Patch125: 00125-less-verbose-COUNT_ALLOCS.patch
# In my koji builds, /root/bin is in the PATH for some reason
# This leads to test_subprocess.py failing, due to "test_leaking_fds_on_error"
# trying every dir in PATH for "nonexisting_i_hope", which leads to it raising
# OSError: [Errno 13] Permission denied
# when it tries to read /root/bin, rather than raising "No such file"
#
# Work around this by specifying an absolute path for the non-existant
# executable
# Not yet sent upstream
Patch129: python-3.2.1-fix-test-subprocess-with-nonreadable-path-dir.patch
# 00130 #
# Python 2's:
# Patch130: python-2.7.2-add-extension-suffix-to-python-config.patch
@ -353,13 +349,11 @@ Patch140: python3-arm-skip-failing-fragile-test.patch
# to be relevant for python3
# 00141 #
# Fix test_gc's test_newinstance case when configured with COUNT_ALLOCS:
# Not yet sent upstream
Patch141: 00141-fix-test_gc_with_COUNT_ALLOCS.patch
# 00142 #
# Some pty tests fail when run in mock (rhbz#714627):
Patch142: 00142-skip-failing-pty-tests-in-rpmbuild.patch
# Fix tests for case when tests for case when configured with
# COUNT_ALLOCS (debug build): http://bugs.python.org/issue19527
# Applies to: test_gc, test_module, test_io, test_logging, test_warnings,
# test_threading
Patch141: 00141-fix-tests_with_COUNT_ALLOCS.patch
# 00143 #
# Fix the --with-tsc option on ppc64, and rework it on 32-bit ppc to avoid
@ -393,6 +387,13 @@ Patch143: 00143-tsc-on-ppc.patch
# - don't build the _md5 and _sha* modules; rely on the _hashlib implementation
# of hashlib
# (rhbz#563986)
# Note: Up to Python 3.4.0.b1, upstream had their own implementation of what
# they assumed would become sha3. This patch was adapted to give it the
# usedforsecurity argument, even though it did nothing (OpenSSL didn't have
# sha3 implementation at that time).In 3.4.0.b2, sha3 implementation was reverted
# (see http://bugs.python.org/issue16113), but the alterations were left in the
# patch, since they may be useful again if upstream decides to rerevert sha3
# implementation and OpenSSL still doesn't support it. For now, they're harmless.
Patch146: 00146-hashlib-fips.patch
# 00147 #
@ -559,11 +560,8 @@ Patch173: 00173-workaround-ENOPROTOOPT-in-bind_port.patch
# Patch176: 00176-upstream-issue16754-so-extension.patch
# 00177 #
# Patch for potential unicode error when determining OS release names
# http://bugs.python.org/issue17429
# (rhbz#922149)
# Does not affect python2 (python2 uses a byte string so it doesn't need to decode)
Patch177: 00177-platform-unicode.patch
# Fixed upstream as of Python 3.4.0.b2
# Patch177: 00177-platform-unicode.patch
# 00178 #
# Don't duplicate various FLAGS in sysconfig values
@ -595,10 +593,8 @@ Patch180: 00180-python-add-support-for-ppc64p7.patch
# Patch182: 00182-fix-test_gdb-test_threads.patch
# 00183 #
# Upstream fix for CVE-2013-2099 (ssl.match_hostname DOS)
# http://bugs.python.org/issue17980
# http://hg.python.org/cpython/rev/c627638753e2
Patch183: 00183-cve-2013-2099-fix-ssl-match_hostname-dos.patch
# Fixed upstream as of Python 3.4.0a4
# Patch183: 00183-cve-2013-2099-fix-ssl-match_hostname-dos.patch
# 00184 #
# Fix for https://bugzilla.redhat.com/show_bug.cgi?id=979696
@ -609,38 +605,77 @@ Patch183: 00183-cve-2013-2099-fix-ssl-match_hostname-dos.patch
Patch184: 00184-ctypes-should-build-with-libffi-multilib-wrapper.patch
# 00185 #
# Fix for CVE-2013-4238 --
# SSL module fails to handle NULL bytes inside subjectAltNames general names
# http://bugs.python.org/issue18709
# rhbz#996399
Patch185: 00185-CVE-2013-4238-hostname-check-bypass-in-SSL-module.patch
# Fixed upstream as of Python 3.4.0a4
# Patch185: 00185-CVE-2013-4238-hostname-check-bypass-in-SSL-module.patch
# 00186 #
# Fix for https://bugzilla.redhat.com/show_bug.cgi?id=1023607
# Fixes the problem of some *.py files not being bytecompiled properly
# during build. This was result of py_compile.compile raising exception
# when trying to convert test file with bad encoding, and thus not
# continuing bytecompilation for other files.
# Previously, this fixed a problem where some *.py files were not being
# bytecompiled properly during build. This was result of py_compile.compile
# raising exception when trying to convert test file with bad encoding, and
# thus not continuing bytecompilation for other files.
# This was fixed upstream, but the test hasn't been merged yet, so we keep it
Patch186: 00186-dont-raise-from-py_compile.patch
# 00187 #
# Fix for rhbz#1023742
# Change behavior of ssl.match_hostname() to follow RFC 6125
# See http://bugs.python.org/issue17997#msg194950 for more.
Patch187: 00187-change-match_hostname-to-follow-RFC-6125.patch
# Fixed upstream as of Python 3.4.0b1
# Patch187: 00187-remove-pthread-atfork.patch
# 00192 #
# 00188 #
# Downstream only patch that should be removed when we compile all guaranteed
# hashlib algorithms properly. The problem is this:
# - during tests, test_hashlib is imported and executed before test_lib2to3
# - if at least one hash function has failed, trying to import it triggers an
# exception that is being caught and exception is logged:
# http://hg.python.org/cpython/file/2de806c8b070/Lib/hashlib.py#l217
# - logging the exception makes logging module run basicConfig
# - when lib2to3 tests are run again, lib2to3 runs basicConfig again, which
# doesn't do anything, because it was run previously
# (logging.root.handlers != []), which means that the default setup
# (most importantly logging level) is not overriden. That means that a test
# relying on this will fail (test_filename_changing_on_output_single_dir)
Patch188: 00188-fix-lib2to3-tests-when-hashlib-doesnt-compile-properly.patch
# 00189 #
#
# Fixing buffer overflow (upstream patch)
# rhbz#1062375
Patch192: 00192-buffer-overflow.patch
# Add the rewheel module, allowing to recreate wheels from already installed
# ones
# https://github.com/bkabrda/rewheel
%if 0%{with_rewheel}
Patch189: 00189-add-rewheel-module.patch
%endif
# 00190 #
#
# Fix tests with SQLite >= 3.8.4
# http://bugs.python.org/issue20901
# http://hg.python.org/cpython/rev/4d626a9df062
# FIXED UPSTREAM
# Patch190: 00190-fix-tests-with-sqlite-3.8.4.patch
# 00193
#
# Skip correct number of *.pyc file bytes in ModuleFinder.load_module
# rhbz#1060338
# http://bugs.python.org/issue20778
Patch193: 00193-skip-correct-num-of-pycfile-bytes-in-modulefinder.patch
# FIXED UPSTREAM
# Patch193: 00193-skip-correct-num-of-pycfile-bytes-in-modulefinder.patch
# Tests requiring SIGHUP to work don't work in Koji
# see rhbz#1088233
Patch194: temporarily-disable-tests-requiring-SIGHUP.patch
# 00195
#
# Don't declare Werror=declaration-after-statement for extension
# modules through setup.py
# http://bugs.python.org/issue21121
Patch195: 00195-dont-add-Werror-declaration-after-statement.patch
# 00196
#
# Fix test_gdb failure on ppc64le
Patch196: 00196-test-gdb-match-addr-before-builtin.patch
# (New patches go here ^^^)
@ -681,6 +716,11 @@ Provides: python(abi) = %{pybasever}
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%if 0%{with_rewheel}
Requires: python-setuptools
Requires: python-pip
%endif
%description
Python 3 is a new version of the language that is incompatible with the 2.x
line of releases. The language is mostly the same, but many details, especially
@ -704,7 +744,8 @@ This package contains files used to embed Python 3 into applications.
%package devel
Summary: Libraries and header files needed for Python 3 development
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: %{name} = %{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Conflicts: %{name} < %{version}-%{release}
%description devel
@ -781,7 +822,7 @@ can load its own extensions.
# ======================================================
%prep
%setup -q -n Python-%{version}
%setup -q -n Python-%{version}%{?prerel}
chmod +x %{SOURCE1}
%if 0%{?with_systemtap}
@ -808,6 +849,8 @@ rm -r Modules/zlib || exit 1
#
# For example, in our builds hashlib.md5 is implemented within _hashlib via
# OpenSSL (and thus respects FIPS mode), and does not fall back to _md5
# TODO: there seems to be no OpenSSL support in Python for sha3 so far
# when it is there, also remove _sha3/ dir
for f in md5module.c sha1module.c sha256module.c sha512module.c; do
rm Modules/$f
done
@ -831,12 +874,10 @@ done
%patch111 -p1
# 112: not for python3
%patch113 -p1
%patch114 -p1
# 00114: Upstream as of Python 3.4.0.b2
%patch125 -p1 -b .less-verbose-COUNT_ALLOCS
%patch129 -p1
%ifarch ppc %{power64}
%patch131 -p1
%endif
@ -854,7 +895,6 @@ done
%endif
# 00140: not for python3
%patch141 -p1
%patch142 -p1
%patch143 -p1 -b .tsc-on-ppc
# 00144: not for python3
# 00145: not for python3
@ -893,19 +933,28 @@ done
#00174: TODO
# 00175: upstream as of Python 3.3.2
# 00176: upstream as of Python 3.3.1
%patch177 -p1
# 00177: upstream as of Python 3.4.0.b2
%patch178 -p1
%patch179 -p1
%patch180 -p1
# 00181: not for python3
# 00182: upstream as of Python 3.3.2
%patch183 -p1
%patch184 -p1
%patch185 -p1
# 00183 upstream as of Python 3.4.0a4
%patch184 -p1
# 00185 upstream as of Python 3.4.0a4
%patch186 -p1
%patch187 -p1
%patch192 -p1
%patch193 -p1
# 00187: upstream as of Python 3.4.0b1
%patch188 -p1
%if 0%{with_rewheel}
%patch189 -p1
%endif
# 00190: upstream as of Python 3.4.1
# 00193: upstream as of Python 3.4.1
%patch194 -p1
%patch195 -p1
%patch196 -p1
# Currently (2010-01-15), http://docs.python.org/library is for 2.6, and there
# are many differences between 2.6 and the Python 3 library.
@ -1005,7 +1054,8 @@ BuildPython() {
# missing symbol AnnotateRWLockDestroy
#
# Invoke the build:
make EXTRA_CFLAGS="$CFLAGS" %{?_smp_mflags}
# TODO: it seems that 3.4.0a4 fails with %{?_smp_flags}, have to figure out why
make EXTRA_CFLAGS="$CFLAGS"
popd
echo FINISHED: BUILD OF PYTHON FOR CONFIGURATION: $ConfDir
@ -1018,9 +1068,9 @@ BuildPython debug \
python-debug \
python%{pybasever}-debug \
%ifarch %{ix86} x86_64 ppc %{power64}
"--with-pydebug --with-tsc --with-count-allocs --with-call-profile" \
"--with-pydebug --with-tsc --with-count-allocs --with-call-profile --without-ensurepip" \
%else
"--with-pydebug --with-count-allocs --with-call-profile" \
"--with-pydebug --with-count-allocs --with-call-profile --without-ensurepip" \
%endif
false
%endif # with_debug_build
@ -1028,7 +1078,7 @@ BuildPython debug \
BuildPython optimized \
python \
python%{pybasever} \
"" \
"--without-ensurepip" \
true
# ======================================================
@ -1347,7 +1397,10 @@ CheckPython() {
# @unittest._expectedFailureInRpmBuild
WITHIN_PYTHON_RPM_BUILD= \
LD_LIBRARY_PATH=$ConfDir $ConfDir/python -m test.regrtest \
--verbose --findleaks
--verbose --findleaks \
%ifarch ppc64le
-x test_faulthandler
%endif
echo FINISHED: CHECKING OF PYTHON FOR CONFIGURATION: $ConfName
@ -1390,7 +1443,7 @@ rm -fr %{buildroot}
%{_bindir}/python%{pybasever}
%{_bindir}/python%{pybasever}m
%{_bindir}/pyvenv
%{_bindir}/pyvenv-3.3
%{_bindir}/pyvenv-%{pybasever}
%{_mandir}/*/*
%files libs
@ -1424,6 +1477,7 @@ rm -fr %{buildroot}
%{dynload_dir}/_lzma.%{SOABI_optimized}.so
%{dynload_dir}/_multibytecodec.%{SOABI_optimized}.so
%{dynload_dir}/_multiprocessing.%{SOABI_optimized}.so
%{dynload_dir}/_opcode.%{SOABI_optimized}.so
%{dynload_dir}/_pickle.%{SOABI_optimized}.so
%{dynload_dir}/_posixsubprocess.%{SOABI_optimized}.so
%{dynload_dir}/_random.%{SOABI_optimized}.so
@ -1432,7 +1486,6 @@ rm -fr %{buildroot}
%{dynload_dir}/_ssl.%{SOABI_optimized}.so
%{dynload_dir}/_struct.%{SOABI_optimized}.so
%{dynload_dir}/array.%{SOABI_optimized}.so
%{dynload_dir}/atexit.%{SOABI_optimized}.so
%{dynload_dir}/audioop.%{SOABI_optimized}.so
%{dynload_dir}/binascii.%{SOABI_optimized}.so
%{dynload_dir}/cmath.%{SOABI_optimized}.so
@ -1463,6 +1516,11 @@ rm -fr %{buildroot}
%dir %{pylibdir}/__pycache__/
%{pylibdir}/__pycache__/*%{bytecode_suffixes}
%dir %{pylibdir}/asyncio/
%dir %{pylibdir}/asyncio/__pycache__/
%{pylibdir}/asyncio/*.py
%{pylibdir}/asyncio/__pycache__/*%{bytecode_suffixes}
%dir %{pylibdir}/collections/
%dir %{pylibdir}/collections/__pycache__/
%{pylibdir}/collections/*.py
@ -1506,6 +1564,20 @@ rm -fr %{buildroot}
%doc %{pylibdir}/email/architecture.rst
%{pylibdir}/encodings
%dir %{pylibdir}/ensurepip/
%dir %{pylibdir}/ensurepip/__pycache__/
%{pylibdir}/ensurepip/*.py
%{pylibdir}/ensurepip/__pycache__/*%{bytecode_suffixes}
%exclude %{pylibdir}/ensurepip/_bundled
%if 0%{?with_rewheel}
%dir %{pylibdir}/ensurepip/rewheel/
%dir %{pylibdir}/ensurepip/rewheel/__pycache__/
%{pylibdir}/ensurepip/rewheel/*.py
%{pylibdir}/ensurepip/rewheel/__pycache__/*%{bytecode_suffixes}
%endif
%{pylibdir}/html
%{pylibdir}/http
%{pylibdir}/idlelib
@ -1534,10 +1606,12 @@ rm -fr %{buildroot}
%dir %{pylibdir}/test/
%dir %{pylibdir}/test/__pycache__/
%dir %{pylibdir}/test/support/
%dir %{pylibdir}/test/support/__pycache__/
%{pylibdir}/test/__init__.py
%{pylibdir}/test/support.py
%{pylibdir}/test/__pycache__/__init__%{bytecode_suffixes}
%{pylibdir}/test/__pycache__/support%{bytecode_suffixes}
%{pylibdir}/test/support/__init__.py
%{pylibdir}/test/support/__pycache__/__init__%{bytecode_suffixes}
%exclude %{pylibdir}/turtle.py
%exclude %{pylibdir}/__pycache__/turtle*%{bytecode_suffixes}
@ -1628,6 +1702,7 @@ rm -fr %{buildroot}
%{dynload_dir}/_ctypes_test.%{SOABI_optimized}.so
%{dynload_dir}/_testbuffer.%{SOABI_optimized}.so
%{dynload_dir}/_testcapi.%{SOABI_optimized}.so
%{dynload_dir}/_testimportmultiple.%{SOABI_optimized}.so
%{pylibdir}/lib2to3/tests
%{pylibdir}/tkinter/test
%{pylibdir}/unittest/test
@ -1675,6 +1750,7 @@ rm -fr %{buildroot}
%{dynload_dir}/_lzma.%{SOABI_debug}.so
%{dynload_dir}/_multibytecodec.%{SOABI_debug}.so
%{dynload_dir}/_multiprocessing.%{SOABI_debug}.so
%{dynload_dir}/_opcode.%{SOABI_debug}.so
%{dynload_dir}/_pickle.%{SOABI_debug}.so
%{dynload_dir}/_posixsubprocess.%{SOABI_debug}.so
%{dynload_dir}/_random.%{SOABI_debug}.so
@ -1683,7 +1759,6 @@ rm -fr %{buildroot}
%{dynload_dir}/_ssl.%{SOABI_debug}.so
%{dynload_dir}/_struct.%{SOABI_debug}.so
%{dynload_dir}/array.%{SOABI_debug}.so
%{dynload_dir}/atexit.%{SOABI_debug}.so
%{dynload_dir}/audioop.%{SOABI_debug}.so
%{dynload_dir}/binascii.%{SOABI_debug}.so
%{dynload_dir}/cmath.%{SOABI_debug}.so
@ -1733,6 +1808,7 @@ rm -fr %{buildroot}
%{dynload_dir}/_ctypes_test.%{SOABI_debug}.so
%{dynload_dir}/_testbuffer.%{SOABI_debug}.so
%{dynload_dir}/_testcapi.%{SOABI_debug}.so
%{dynload_dir}/_testimportmultiple.%{SOABI_debug}.so
%endif # with_debug_build
@ -1755,29 +1831,70 @@ rm -fr %{buildroot}
# ======================================================
%changelog
* Thu May 22 2014 Miro Hrončok <mhroncok@redhat.com> - 3.3.2-14
* Tue May 27 2014 Matej Stuchlik <mstuchli@redhat.com> - 3.4.1-3
- Update the rewheel module
* Mon May 26 2014 Miro Hrončok <mhroncok@redhat.com> - 3.4.1-2
- Fix multilib dependencies.
Resolves: rhbz#1091815
* Sun May 25 2014 Matej Stuchlik <mstuchli@redhat.com> - 3.4.1-1
- Update to Python 3.4.1
* Sun May 25 2014 Matej Stuchlik <mstuchli@redhat.com> - 3.4.0-8
- Fix test_gdb failure on ppc64le
Resolves: rhbz#1095355
* Thu May 22 2014 Miro Hrončok <mhroncok@redhat.com> - 3.4.0-7
- Add macro %%python3_version_nodots
* Wed May 21 2014 Jaroslav Škarvada <jskarvad@redhat.com> - 3.3.2-13
- Rebuilt for https://fedoraproject.org/wiki/Changes/f21tcl86
* Sun May 18 2014 Matej Stuchlik <mstuchli@redhat.com> - 3.4.0-6
- Disable test_faulthandler, test_gdb on aarch64
Resolves: rhbz#1045193
* Wed Mar 05 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 3.3.2-12
- Fix loading of pyc files by ModuleFinder.load_module.
Resolves: rhbz#1060338
* Fri May 16 2014 Matej Stuchlik <mstuchli@redhat.com> - 3.4.0-5
- Don't add Werror=declaration-after-statement for extension
modules through setup.py (PyBT#21121)
* Wed Feb 19 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 3.3.2-11
- Enable loading sqlite extensions.
Resolves: rhbz#1066938
* Mon May 12 2014 Matej Stuchlik <mstuchli@redhat.com> - 3.4.0-4
- Add setuptools and pip to Requires
* Mon Feb 10 2014 Tomas Radej <tradej@redhat.com> - 3.3.2-10
- Fixed buffer overflow (upstream patch)
Resolves: rhbz#1062374
* Tue Apr 29 2014 Matej Stuchlik <mstuchli@redhat.com> - 3.4.0-3
- Point __os_install_post to correct brp-* files
* Tue Feb 04 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 3.3.2-9
- Install macros in _rpmconfigdir.
* Tue Apr 15 2014 Matej Stuchlik <mstuchli@redhat.com> - 3.4.0-2
- Temporarily disable tests requiring SIGHUP (rhbz#1088233)
* Tue Nov 05 2013 Matej Stuchlik <mstuchli@redhat.com> - 3.3.2-8
- Changed behavior of ssl.match_hostname() to follow RFC 6125 (rhbz#1023742)
* Tue Apr 15 2014 Matej Stuchlik <mstuchli@redhat.com> - 3.4.0-1
- Update to Python 3.4 final
- Add patch adding the rewheel module
- Merge patches from master
* Wed Jan 08 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 3.4.0-0.1.b2
- Update to Python 3.4 beta 2.
- Refreshed patches: 55 (systemtap), 146 (hashlib-fips), 154 (test_gdb noise)
- Dropped patches: 114 (statvfs constants), 177 (platform unicode)
* Mon Nov 25 2013 Bohuslav Kabrda <bkabrda@redhat.com> - 3.4.0-0.1.b1
- Update to Python 3.4 beta 1.
- Refreshed patches: 102 (lib64), 111 (no static lib), 125 (less verbose COUNT
ALLOCS), 141 (fix COUNT_ALLOCS in test_module), 146 (hashlib fips),
157 (UID+GID overflows), 173 (ENOPROTOOPT in bind_port)
- Removed patch 00187 (remove pthread atfork; upstreamed)
* Mon Nov 04 2013 Bohuslav Kabrda <bkabrda@redhat.com> - 3.4.0-0.1.a4
- Update to Python 3.4 alpha 4.
- Refreshed patches: 55 (systemtap), 102 (lib64), 111 (no static lib),
114 (statvfs flags), 132 (unittest rpmbuild hooks), 134 (fix COUNT_ALLOCS in
test_sys), 143 (tsc on ppc64), 146 (hashlib fips), 153 (test gdb noise),
157 (UID+GID overflows), 173 (ENOPROTOOPT in bind_port), 186 (dont raise
from py_compile)
- Removed patches: 129 (test_subprocess nonreadable dir - no longer fails in
Koji), 142 (the mock issue that caused this is fixed)
- Added patch 187 (remove thread atfork) - will be in next version
- Refreshed script for checking pyc and pyo timestamps with new ignored files.
- The fips patch is disabled for now until upstream makes a final decision
what to do with sha3 implementation for 3.4.0.
* Wed Oct 30 2013 Bohuslav Kabrda <bkabrda@redhat.com> - 3.3.2-7
- Bytecompile all *.py files properly during build (rhbz#1023607)

View File

@ -1 +1 @@
c94b78ea3b68a9bbc9906af4d5b4fdc7 Python-3.3.2.tar.xz
6cafc183b4106476dd73d5738d7f616a Python-3.4.1.tar.xz

View File

@ -0,0 +1,25 @@
diff -up Python-3.4.0/Lib/test/test_asyncio/test_events.py.orig Python-3.4.0/Lib/test/test_asyncio/test_events.py
--- Python-3.4.0/Lib/test/test_asyncio/test_events.py.orig 2014-04-15 13:18:49.696215288 +0200
+++ Python-3.4.0/Lib/test/test_asyncio/test_events.py 2014-04-15 13:18:56.104258453 +0200
@@ -1528,7 +1528,7 @@ class SubprocessTestsMixin:
self.loop.run_until_complete(proto.completed)
self.check_terminated(proto.returncode)
- @unittest.skipIf(sys.platform == 'win32', "Don't have SIGHUP")
+ @unittest.skipIf(True, "Temporarily skipped (rhbz#1088233)")
def test_subprocess_send_signal(self):
prog = os.path.join(os.path.dirname(__file__), 'echo.py')
diff -up Python-3.4.0/Lib/test/test_asyncio/test_subprocess.py.orig Python-3.4.0/Lib/test/test_asyncio/test_subprocess.py
--- Python-3.4.0/Lib/test/test_asyncio/test_subprocess.py.orig 2014-04-17 12:03:32.777827520 +0200
+++ Python-3.4.0/Lib/test/test_asyncio/test_subprocess.py 2014-04-17 12:04:37.614210481 +0200
@@ -108,7 +108,7 @@ class SubprocessMixin:
else:
self.assertEqual(-signal.SIGTERM, returncode)
- @unittest.skipIf(sys.platform == 'win32', "Don't have SIGHUP")
+ @unittest.skipIf(True, "Temporarily skipped (rhbz#1088233)")
def test_send_signal(self):
args = PROGRAM_BLOCKED
create = asyncio.create_subprocess_exec(*args, loop=self.loop)