Rebased to 3.5.3 from F25

Enable profile guided optimizations for x86_64 and i686 architectures

Sync with python3 package from F25:

- Rebased patch250
- Make pip installable in a new venv when using the --system-site-packages flag
- Fix syntax error in %%py_byte_compile macro
- Add patch 259 to work around magic number bump in Python 3.5.3
This commit is contained in:
Charalampos Stratakis 2017-05-11 14:57:29 +02:00
parent 0221a74981
commit 9dab8a4c1f
12 changed files with 6025 additions and 198 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
Python-3.5.1.tar.xz
/Python-3.5.2.tar.xz
/Python-3.5.3.tar.xz

View File

@ -1,7 +1,8 @@
diff -up Python-3.3.0rc2/configure.ac.systemtap Python-3.3.0rc2/configure.ac
--- Python-3.3.0rc2/configure.ac.systemtap 2012-09-09 05:11:14.000000000 -0400
+++ Python-3.3.0rc2/configure.ac 2012-09-10 09:17:21.114511781 -0400
@@ -2678,6 +2678,23 @@ if test "$with_valgrind" != no; then
diff --git a/configure.ac b/configure.ac
index f50a6c8..b0650a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3277,6 +3277,23 @@ if test "$with_valgrind" != no; then
OPT="-DDYNAMIC_ANNOTATIONS_ENABLED=1 $OPT"
fi
@ -25,10 +26,11 @@ diff -up Python-3.3.0rc2/configure.ac.systemtap Python-3.3.0rc2/configure.ac
# -I${DLINCLDIR} is added to the compile rule for importdl.o
AC_SUBST(DLINCLDIR)
DLINCLDIR=.
diff -up Python-3.3.0rc2/configure.systemtap Python-3.3.0rc2/configure
--- Python-3.3.0rc2/configure.systemtap 2012-09-09 05:11:14.000000000 -0400
+++ Python-3.3.0rc2/configure 2012-09-10 09:17:21.116511780 -0400
@@ -618,6 +618,8 @@ TRUE
diff --git a/configure b/configure
index 0906ae0..4acd1cd 100755
--- a/configure
+++ b/configure
@@ -642,6 +642,8 @@ TRUE
MACHDEP_OBJS
DYNLOADFILE
DLINCLDIR
@ -37,7 +39,7 @@ diff -up Python-3.3.0rc2/configure.systemtap Python-3.3.0rc2/configure
THREADOBJ
LDLAST
USE_THREAD_MODULE
@@ -779,6 +781,7 @@ with_doc_strings
@@ -835,6 +837,7 @@ with_doc_strings
with_tsc
with_pymalloc
with_valgrind
@ -45,7 +47,7 @@ diff -up Python-3.3.0rc2/configure.systemtap Python-3.3.0rc2/configure
with_fpectl
with_libm
with_libc
@@ -1456,6 +1459,7 @@ Optional Packages:
@@ -1540,6 +1543,7 @@ Optional Packages:
--with(out)-tsc enable/disable timestamp counter profile
--with(out)-pymalloc disable/enable specialized mallocs
--with-valgrind Enable Valgrind support
@ -53,7 +55,7 @@ diff -up Python-3.3.0rc2/configure.systemtap Python-3.3.0rc2/configure
--with-fpectl enable SIGFPE catching
--with-libm=STRING math library
--with-libc=STRING C library
@@ -10065,6 +10069,31 @@ fi
@@ -11181,6 +11185,31 @@ fi
OPT="-DDYNAMIC_ANNOTATIONS_ENABLED=1 $OPT"
fi
@ -85,18 +87,21 @@ diff -up Python-3.3.0rc2/configure.systemtap Python-3.3.0rc2/configure
# -I${DLINCLDIR} is added to the compile rule for importdl.o
DLINCLDIR=.
diff -up Python-3.3.0rc2/Doc/howto/index.rst.systemtap Python-3.3.0rc2/Doc/howto/index.rst
--- 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:
diff --git a/Doc/howto/index.rst b/Doc/howto/index.rst
index de65950..593341c 100644
--- a/Doc/howto/index.rst
+++ b/Doc/howto/index.rst
@@ -28,4 +28,5 @@ Currently, the HOWTOs are:
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
--- Python-3.3.0rc2/Doc/howto/instrumentation.rst.systemtap 2012-09-10 09:17:21.117511779 -0400
+++ Python-3.3.0rc2/Doc/howto/instrumentation.rst 2012-09-10 09:17:21.117511779 -0400
diff --git a/Doc/howto/instrumentation.rst b/Doc/howto/instrumentation.rst
new file mode 100644
index 0000000..b6924e1
--- /dev/null
+++ b/Doc/howto/instrumentation.rst
@@ -0,0 +1,295 @@
+.. _instrumentation:
+
@ -393,9 +398,11 @@ diff -up Python-3.3.0rc2/Doc/howto/instrumentation.rst.systemtap Python-3.3.0rc2
+ delete fn_calls;
+ }
+
diff -up Python-3.3.0rc2/Lib/test/test_systemtap.py.systemtap Python-3.3.0rc2/Lib/test/test_systemtap.py
--- Python-3.3.0rc2/Lib/test/test_systemtap.py.systemtap 2012-09-10 09:17:21.117511779 -0400
+++ Python-3.3.0rc2/Lib/test/test_systemtap.py 2012-09-10 09:17:21.117511779 -0400
diff --git a/Lib/test/test_systemtap.py b/Lib/test/test_systemtap.py
new file mode 100644
index 0000000..a669064
--- /dev/null
+++ b/Lib/test/test_systemtap.py
@@ -0,0 +1,234 @@
+# Verify that systemtap static probes work
+#
@ -631,10 +638,11 @@ diff -up Python-3.3.0rc2/Lib/test/test_systemtap.py.systemtap Python-3.3.0rc2/Li
+
+if __name__ == "__main__":
+ test_main()
diff -up Python-3.3.0rc2/Makefile.pre.in.systemtap Python-3.3.0rc2/Makefile.pre.in
--- Python-3.3.0rc2/Makefile.pre.in.systemtap 2012-09-09 05:11:05.000000000 -0400
+++ Python-3.3.0rc2/Makefile.pre.in 2012-09-10 09:19:51.195501518 -0400
@@ -363,6 +363,7 @@ PYTHON_OBJS= \
diff --git a/Makefile.pre.in b/Makefile.pre.in
index a88b7d5..3585b88 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -415,6 +415,7 @@ PYTHON_OBJS= \
Python/formatter_unicode.o \
Python/fileutils.o \
Python/$(DYNLOADFILE) \
@ -642,9 +650,9 @@ diff -up Python-3.3.0rc2/Makefile.pre.in.systemtap Python-3.3.0rc2/Makefile.pre.
$(LIBOBJS) \
$(MACHDEP_OBJS) \
$(THREADOBJ)
@@ -713,7 +714,8 @@ Objects/setobject.o: $(srcdir)/Objects/s
@@ -868,7 +869,8 @@ Objects/setobject.o: $(srcdir)/Objects/stringlib/eq.h
$(OPCODETARGETS_H): $(OPCODETARGETGEN_FILES)
$(OPCODETARGETGEN) $(OPCODETARGETS_H)
$(PYTHON_FOR_GEN) $(OPCODETARGETGEN) $(OPCODETARGETS_H)
-Python/ceval.o: $(OPCODETARGETS_H) $(srcdir)/Python/ceval_gil.h
+Python/ceval.o: $(OPCODETARGETS_H) $(srcdir)/Python/ceval_gil.h \
@ -652,9 +660,9 @@ diff -up Python-3.3.0rc2/Makefile.pre.in.systemtap Python-3.3.0rc2/Makefile.pre.
Python/frozen.o: Python/importlib.h Python/importlib_external.h
@@ -724,6 +726,13 @@ Objects/typeobject.o: $(srcdir)/Objects/
@@ -876,6 +878,13 @@ Objects/typeobject.o: Objects/typeslots.inc
Objects/typeslots.inc: $(srcdir)/Include/typeslots.h $(srcdir)/Objects/typeslots.py
$(PYTHON) $(srcdir)/Objects/typeslots.py < $(srcdir)/Include/typeslots.h > Objects/typeslots.inc
$(PYTHON_FOR_GEN) $(srcdir)/Objects/typeslots.py < $(srcdir)/Include/typeslots.h Objects/typeslots.inc
+# Only needed with --with-systemtap; not a public header:
+$(srcdir)/Python/pysystemtap.h: $(srcdir)/Python/pysystemtap.d
@ -666,18 +674,19 @@ diff -up Python-3.3.0rc2/Makefile.pre.in.systemtap Python-3.3.0rc2/Makefile.pre.
############################################################################
# Header files
@@ -1345,6 +1354,7 @@ clean: pycremoval
@@ -1597,6 +1606,7 @@ clean: pycremoval
-rm -f Lib/lib2to3/*Grammar*.pickle
-rm -f Programs/_testembed Programs/_freeze_importlib
-rm -rf build
-find build -type f -a ! -name '*.gc??' -exec rm -f {} ';'
+ -rm -f $(srcdir)/Python/pysystemtap.h
profile-removal:
find . -name '*.gc??' -exec rm -f {} ';'
diff -up Python-3.3.0rc2/pyconfig.h.in.systemtap Python-3.3.0rc2/pyconfig.h.in
--- Python-3.3.0rc2/pyconfig.h.in.systemtap 2012-09-09 05:11:14.000000000 -0400
+++ Python-3.3.0rc2/pyconfig.h.in 2012-09-10 09:17:21.120511781 -0400
@@ -1306,6 +1306,9 @@
diff --git a/pyconfig.h.in b/pyconfig.h.in
index 39ccf53..9052dbc 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -1375,6 +1375,9 @@
/* Define if you want to compile in Python-specific mallocs */
#undef WITH_PYMALLOC
@ -687,10 +696,11 @@ diff -up Python-3.3.0rc2/pyconfig.h.in.systemtap Python-3.3.0rc2/pyconfig.h.in
/* Define if you want to compile in rudimentary thread support */
#undef WITH_THREAD
diff -up Python-3.3.0rc2/Python/ceval.c.systemtap Python-3.3.0rc2/Python/ceval.c
--- Python-3.3.0rc2/Python/ceval.c.systemtap 2012-09-09 05:11:12.000000000 -0400
+++ Python-3.3.0rc2/Python/ceval.c 2012-09-10 09:17:21.122511781 -0400
@@ -18,6 +18,8 @@
diff --git a/Python/ceval.c b/Python/ceval.c
index 7b40518..0e49de5 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -20,6 +20,8 @@
#include <ctype.h>
@ -699,7 +709,7 @@ diff -up Python-3.3.0rc2/Python/ceval.c.systemtap Python-3.3.0rc2/Python/ceval.c
#ifndef WITH_TSC
#define READ_TIMESTAMP(var)
@@ -1160,6 +1162,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int
@@ -1160,6 +1162,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
}
}
@ -710,7 +720,7 @@ diff -up Python-3.3.0rc2/Python/ceval.c.systemtap Python-3.3.0rc2/Python/ceval.c
co = f->f_code;
names = co->co_names;
consts = co->co_consts;
@@ -3077,6 +3083,11 @@ fast_yield:
@@ -3640,6 +3646,11 @@ fast_yield:
/* pop frame */
exit_eval_frame:
@ -722,9 +732,11 @@ 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
diff --git a/Python/ceval_systemtap.h b/Python/ceval_systemtap.h
new file mode 100644
index 0000000..38697ad
--- /dev/null
+++ b/Python/ceval_systemtap.h
@@ -0,0 +1,86 @@
+/*
+ Support for SystemTap static markers
@ -812,9 +824,11 @@ diff -up Python-3.3.0rc2/Python/ceval_systemtap.h.systemtap Python-3.3.0rc2/Pyth
+#define systemtap_function_return(f)
+
+#endif
diff -up Python-3.3.0rc2/Python/pysystemtap.d.systemtap Python-3.3.0rc2/Python/pysystemtap.d
--- Python-3.3.0rc2/Python/pysystemtap.d.systemtap 2012-09-10 09:17:21.122511781 -0400
+++ Python-3.3.0rc2/Python/pysystemtap.d 2012-09-10 09:17:21.122511781 -0400
diff --git a/Python/pysystemtap.d b/Python/pysystemtap.d
new file mode 100644
index 0000000..c2cdef0
--- /dev/null
+++ b/Python/pysystemtap.d
@@ -0,0 +1,4 @@
+provider python {
+ probe function__entry(const char *, const char *, int, PyFrameObject *);

View File

@ -282,7 +282,7 @@ index c9b113e..60e2392 100644
self._test_pbkdf2_hmac(py_hashlib.pbkdf2_hmac)
diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c
index 44765ac..b8cf490 100644
index ff57614..8cd1b77 100644
--- a/Modules/_hashopenssl.c
+++ b/Modules/_hashopenssl.c
@@ -20,6 +20,8 @@
@ -292,9 +292,9 @@ index 44765ac..b8cf490 100644
+#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. */
@@ -45,11 +47,19 @@ typedef struct {
#include <openssl/objects.h>
@@ -55,10 +57,19 @@ typedef struct {
static PyTypeObject EVPtype;
@ -311,14 +311,13 @@ index 44765ac..b8cf490 100644
-#define DEFINE_CONSTS_FOR_NEW(Name) \
- static PyObject *CONST_ ## Name ## _name_obj = NULL; \
- static EVP_MD_CTX CONST_new_ ## Name ## _ctx; \
- static EVP_MD_CTX *CONST_new_ ## Name ## _ctx_p = NULL;
+#define DEFINE_CONSTS_FOR_NEW(Name) \
+ static EVPCachedInfo cached_info_ ##Name;
DEFINE_CONSTS_FOR_NEW(md5)
DEFINE_CONSTS_FOR_NEW(sha1)
@@ -92,6 +102,48 @@ EVP_hash(EVPobject *self, const void *vp, Py_ssize_t len)
@@ -139,6 +150,48 @@ EVP_hash(EVPobject *self, const void *vp, Py_ssize_t len)
}
}
@ -367,7 +366,7 @@ index 44765ac..b8cf490 100644
/* Internal methods for a hash object */
static void
@@ -259,15 +311,16 @@ EVP_repr(EVPobject *self)
@@ -327,15 +380,16 @@ EVP_repr(EVPobject *self)
static int
EVP_tp_init(EVPobject *self, PyObject *args, PyObject *kwds)
{
@ -387,21 +386,21 @@ index 44765ac..b8cf490 100644
return -1;
}
@@ -288,7 +341,12 @@ EVP_tp_init(EVPobject *self, PyObject *args, PyObject *kwds)
@@ -356,7 +410,12 @@ EVP_tp_init(EVPobject *self, PyObject *args, PyObject *kwds)
PyBuffer_Release(&view);
return -1;
}
- EVP_DigestInit(&self->ctx, digest);
+ mc_ctx_init(&self->ctx, usedforsecurity);
+ if (!EVP_DigestInit_ex(&self->ctx, digest, NULL)) {
- EVP_DigestInit(self->ctx, digest);
+ mc_ctx_init(self->ctx, usedforsecurity);
+ if (!EVP_DigestInit_ex(self->ctx, digest, NULL)) {
+ set_evp_exception();
+ PyBuffer_Release(&view);
+ return -1;
+ Py_RETURN_NONE;
+ }
self->name = name_obj;
Py_INCREF(self->name);
@@ -372,7 +430,8 @@ static PyTypeObject EVPtype = {
@@ -440,7 +499,8 @@ static PyTypeObject EVPtype = {
static PyObject *
EVPnew(PyObject *name_obj,
const EVP_MD *digest, const EVP_MD_CTX *initial_ctx,
@ -411,13 +410,13 @@ index 44765ac..b8cf490 100644
{
EVPobject *self;
@@ -387,7 +446,12 @@ EVPnew(PyObject *name_obj,
@@ -455,7 +515,12 @@ EVPnew(PyObject *name_obj,
if (initial_ctx) {
EVP_MD_CTX_copy(&self->ctx, initial_ctx);
EVP_MD_CTX_copy(self->ctx, initial_ctx);
} else {
- EVP_DigestInit(&self->ctx, digest);
+ mc_ctx_init(&self->ctx, usedforsecurity);
+ if (!EVP_DigestInit_ex(&self->ctx, digest, NULL)) {
- EVP_DigestInit(self->ctx, digest);
+ mc_ctx_init(self->ctx, usedforsecurity);
+ if (!EVP_DigestInit_ex(self->ctx, digest, NULL)) {
+ set_evp_exception();
+ Py_DECREF(self);
+ return NULL;
@ -425,7 +424,7 @@ index 44765ac..b8cf490 100644
}
if (cp && len) {
@@ -411,21 +475,29 @@ PyDoc_STRVAR(EVP_new__doc__,
@@ -479,21 +544,29 @@ PyDoc_STRVAR(EVP_new__doc__,
An optional string argument may be provided and will be\n\
automatically hashed.\n\
\n\
@ -459,7 +458,7 @@ index 44765ac..b8cf490 100644
return NULL;
}
@@ -439,7 +511,8 @@ EVP_new(PyObject *self, PyObject *args, PyObject *kwdict)
@@ -507,7 +580,8 @@ EVP_new(PyObject *self, PyObject *args, PyObject *kwdict)
digest = EVP_get_digestbyname(name);
@ -469,13 +468,13 @@ index 44765ac..b8cf490 100644
if (data_obj)
PyBuffer_Release(&view);
@@ -722,57 +795,114 @@ generate_hash_name_list(void)
@@ -769,57 +843,114 @@ generate_hash_name_list(void)
/*
- * This macro generates constructor function definitions for specific
- * hash algorithms. These constructors are much faster than calling
- * the generic one passing it a python string and are noticably
- * the generic one passing it a python string and are noticeably
- * faster than calling a python new() wrapper. Thats important for
+ * This macro and function generates a family of constructor function
+ * definitions for specific hash algorithms. These constructors are much
@ -512,8 +511,8 @@ index 44765ac..b8cf490 100644
+ 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,
@ -531,8 +530,8 @@ index 44765ac..b8cf490 100644
+ if (!PyArg_ParseTupleAndKeywords(args, kwdict, format, kwlist,
+ &data_obj, &usedforsecurity)) {
+ return NULL;
+ }
+
}
+ if (data_obj)
+ GET_BUFFER_VIEW_OR_ERROUT(data_obj, &view);
+
@ -581,7 +580,7 @@ index 44765ac..b8cf490 100644
- if (CONST_ ## NAME ## _name_obj == NULL) { \
- CONST_ ## NAME ## _name_obj = PyUnicode_FromString(#NAME); \
- if (EVP_get_digestbyname(#NAME)) { \
- CONST_new_ ## NAME ## _ctx_p = &CONST_new_ ## NAME ## _ctx; \
- CONST_new_ ## NAME ## _ctx_p = EVP_MD_CTX_new(); \
- EVP_DigestInit(CONST_new_ ## NAME ## _ctx_p, EVP_get_digestbyname(#NAME)); \
- } \
- } \
@ -621,7 +620,7 @@ index 44765ac..b8cf490 100644
GEN_CONSTRUCTOR(md5)
GEN_CONSTRUCTOR(sha1)
@@ -819,13 +949,10 @@ PyInit__hashlib(void)
@@ -866,13 +997,10 @@ PyInit__hashlib(void)
{
PyObject *m, *openssl_md_meth_names;

View File

@ -1,8 +1,8 @@
Index: Include/object.h
===================================================================
--- Include/object.h (revision 87911)
+++ Include/object.h (working copy)
@@ -914,6 +914,49 @@
diff --git Include/object.h Include/object.h
index 50d9747..9b7e89e 100644
--- Include/object.h
+++ Include/object.h
@@ -1059,6 +1059,49 @@ PyAPI_FUNC(void)
_PyObject_DebugTypeStats(FILE *out);
#endif /* ifndef Py_LIMITED_API */
@ -52,17 +52,17 @@ Index: Include/object.h
#ifdef __cplusplus
}
#endif
Index: Objects/object.c
===================================================================
--- Objects/object.c (revision 87911)
+++ Objects/object.c (working copy)
@@ -1899,6 +1899,35 @@
diff --git Objects/object.c Objects/object.c
index d21fd90..d07b49c 100644
--- Objects/object.c
+++ Objects/object.c
@@ -2034,6 +2034,35 @@ _PyTrash_thread_destroy_chain(void)
}
}
+PyAPI_FUNC(void)
+_PyObject_AssertFailed(PyObject *obj, const char *msg, const char *expr,
+ const char *file, int line, const char *function)
+ const char *file, int line, const char *function)
+{
+ fprintf(stderr,
+ "%s:%d: %s: Assertion \"%s\" failed.\n",
@ -92,23 +92,38 @@ Index: Objects/object.c
#ifndef Py_TRACE_REFS
/* For Py_LIMITED_API, we need an out-of-line version of _Py_Dealloc.
Define this here, so we can undefine the macro. */
Index: Lib/test/test_gc.py
===================================================================
--- Lib/test/test_gc.py (revision 87911)
+++ Lib/test/test_gc.py (working copy)
@@ -1,7 +1,7 @@
diff --git Lib/test/test_gc.py Lib/test/test_gc.py
index a4d684b..e77029e 100644
--- Lib/test/test_gc.py
+++ Lib/test/test_gc.py
@@ -1,10 +1,11 @@
import unittest
from test.support import (verbose, refcount_test, run_unittest,
strip_python_stderr, cpython_only, start_threads,
- temp_dir)
+ temp_dir, import_module)
strip_python_stderr, cpython_only, start_threads,
- temp_dir, requires_type_collecting)
+ temp_dir, requires_type_collecting, import_module)
from test.support.script_helper import assert_python_ok, make_script
import sys
@@ -512,6 +512,48 @@
+import sysconfig
import time
import gc
import weakref
@@ -50,6 +51,8 @@ class GC_Detector(object):
# gc collects it.
self.wr = weakref.ref(C1055820(666), it_happened)
+BUILD_WITH_NDEBUG = ('-DNDEBUG' in sysconfig.get_config_vars()['PY_CFLAGS'])
+
@with_tp_del
class Uncollectable(object):
"""Create a reference cycle with multiple __del__ methods.
@@ -864,6 +867,50 @@ class GCCallbackTests(unittest.TestCase):
self.assertEqual(len(gc.garbage), 0)
+ @unittest.skipIf(BUILD_WITH_NDEBUG,
+ 'built with -NDEBUG')
+ def test_refcount_errors(self):
+ self.preclean()
+ # Verify the "handling" of objects with broken refcounts
@ -154,9 +169,10 @@ Index: Lib/test/test_gc.py
class GCTogglingTests(unittest.TestCase):
def setUp(self):
gc.enable()
diff -up Modules/gcmodule.c.orig2 Modules/gcmodule.c
--- Modules/gcmodule.c.orig2 2014-12-08 10:54:14.251742911 +0100
+++ Modules/gcmodule.c 2014-12-08 10:52:45.674771917 +0100
diff --git Modules/gcmodule.c Modules/gcmodule.c
index cb7222d..6a9be80 100644
--- Modules/gcmodule.c
+++ Modules/gcmodule.c
@@ -341,7 +341,8 @@ update_refs(PyGC_Head *containers)
{
PyGC_Head *gc = containers->gc.gc_next;
@ -188,7 +204,7 @@ diff -up Modules/gcmodule.c.orig2 Modules/gcmodule.c
if (_PyGCHead_REFS(gc) > 0)
_PyGCHead_DECREF(gc);
}
@@ -436,9 +440,10 @@ visit_reachable(PyObject *op, PyGC_Head
@@ -436,9 +440,10 @@ visit_reachable(PyObject *op, PyGC_Head *reachable)
* If gc_refs == GC_UNTRACKED, it must be ignored.
*/
else {
@ -202,7 +218,7 @@ diff -up Modules/gcmodule.c.orig2 Modules/gcmodule.c
}
}
return 0;
@@ -480,7 +485,7 @@ move_unreachable(PyGC_Head *young, PyGC_
@@ -480,7 +485,7 @@ move_unreachable(PyGC_Head *young, PyGC_Head *unreachable)
*/
PyObject *op = FROM_GC(gc);
traverseproc traverse = Py_TYPE(op)->tp_traverse;
@ -211,7 +227,7 @@ diff -up Modules/gcmodule.c.orig2 Modules/gcmodule.c
_PyGCHead_SET_REFS(gc, GC_REACHABLE);
(void) traverse(op,
(visitproc)visit_reachable,
@@ -543,7 +548,7 @@ move_legacy_finalizers(PyGC_Head *unreac
@@ -543,7 +548,7 @@ move_legacy_finalizers(PyGC_Head *unreachable, PyGC_Head *finalizers)
for (gc = unreachable->gc.gc_next; gc != unreachable; gc = next) {
PyObject *op = FROM_GC(gc);
@ -220,7 +236,7 @@ diff -up Modules/gcmodule.c.orig2 Modules/gcmodule.c
next = gc->gc.gc_next;
if (has_legacy_finalizer(op)) {
@@ -619,7 +624,7 @@ handle_weakrefs(PyGC_Head *unreachable,
@@ -619,7 +624,7 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
PyWeakReference **wrlist;
op = FROM_GC(gc);
@ -229,7 +245,7 @@ diff -up Modules/gcmodule.c.orig2 Modules/gcmodule.c
next = gc->gc.gc_next;
if (! PyType_SUPPORTS_WEAKREFS(Py_TYPE(op)))
@@ -640,9 +645,9 @@ handle_weakrefs(PyGC_Head *unreachable,
@@ -640,9 +645,9 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
* the callback pointer intact. Obscure: it also
* changes *wrlist.
*/
@ -241,7 +257,7 @@ diff -up Modules/gcmodule.c.orig2 Modules/gcmodule.c
if (wr->wr_callback == NULL)
continue; /* no callback */
@@ -676,7 +681,7 @@ handle_weakrefs(PyGC_Head *unreachable,
@@ -676,7 +681,7 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
*/
if (IS_TENTATIVELY_UNREACHABLE(wr))
continue;
@ -250,7 +266,7 @@ diff -up Modules/gcmodule.c.orig2 Modules/gcmodule.c
/* Create a new reference so that wr can't go away
* before we can process it again.
@@ -685,7 +690,8 @@ handle_weakrefs(PyGC_Head *unreachable,
@@ -685,7 +690,8 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
/* Move wr to wrcb_to_call, for the next pass. */
wrasgc = AS_GC(wr);
@ -260,7 +276,7 @@ diff -up Modules/gcmodule.c.orig2 Modules/gcmodule.c
next isn't, so they can't
be the same */
gc_list_move(wrasgc, &wrcb_to_call);
@@ -701,11 +707,11 @@ handle_weakrefs(PyGC_Head *unreachable,
@@ -701,11 +707,11 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
gc = wrcb_to_call.gc.gc_next;
op = FROM_GC(gc);
@ -292,35 +308,3 @@ diff -up Modules/gcmodule.c.orig2 Modules/gcmodule.c
if (_PyGCHead_REFS(gc) != 0)
return -1;
}
diff -up Lib/test/test_gc.py.old Lib/test/test_gc.py
--- Lib/test/test_gc.py.old 2014-12-10 11:19:33.503982288 +0100
+++ Lib/test/test_gc.py 2014-12-10 11:21:13.220021364 +0100
@@ -49,6 +49,8 @@ class GC_Detector(object):
# gc collects it.
self.wr = weakref.ref(C1055820(666), it_happened)
+BUILD_WITH_NDEBUG = ('-DNDEBUG' in sysconfig.get_config_vars()['PY_CFLAGS'])
+
@with_tp_del
class Uncollectable(object):
"""Create a reference cycle with multiple __del__ methods.
@@ -854,6 +856,8 @@ class GCCallbackTests(unittest.TestCase)
self.assertEqual(len(gc.garbage), 0)
+ @unittest.skipIf(BUILD_WITH_NDEBUG,
+ 'built with -NDEBUG')
def test_refcount_errors(self):
self.preclean()
# Verify the "handling" of objects with broken refcounts
diff -up Lib/test/test_gc.py.old Lib/test/test_gc.py
--- Lib/test/test_gc.py.old 2014-12-10 12:50:58.252121318 +0100
+++ Lib/test/test_gc.py 2014-12-10 12:51:08.594266653 +0100
@@ -4,6 +4,7 @@ from test.support import (verbose, refco
from test.support.script_helper import assert_python_ok, make_script
import sys
+import sysconfig
import time
import gc
import weakref

View File

@ -1,12 +1,13 @@
diff -r de35eae9048a config.sub
--- a/config.sub Wed Apr 24 23:33:20 2013 +0200
+++ b/config.sub Thu Apr 25 08:51:00 2013 +0200
@@ -1008,7 +1008,7 @@
diff --git a/config.sub b/config.sub
index 3478c1f..e422173 100755
--- a/config.sub
+++ b/config.sub
@@ -1040,7 +1040,7 @@ case $basic_machine in
;;
ppc64) basic_machine=powerpc64-unknown
;;
- ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ppc64-* | ppc64p7-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
ppc64le | powerpc64little)
basic_machine=powerpc64le-unknown

View File

@ -1,8 +1,8 @@
diff --git a/Python/random.c b/Python/random.c
index 07dacfe..a4f7f40 100644
index d203939..4c27585 100644
--- a/Python/random.c
+++ b/Python/random.c
@@ -75,46 +75,7 @@ win32_urandom(unsigned char *buffer, Py_ssize_t size, int raise)
@@ -76,46 +76,7 @@ win32_urandom(unsigned char *buffer, Py_ssize_t size, int raise)
return 0;
}
@ -50,7 +50,7 @@ index 07dacfe..a4f7f40 100644
#if defined(HAVE_GETRANDOM) || defined(HAVE_GETRANDOM_SYSCALL)
#define PY_GETRANDOM 1
@@ -209,6 +170,59 @@ py_getrandom(void *buffer, Py_ssize_t size, int raise)
@@ -227,6 +188,59 @@ py_getrandom(void *buffer, Py_ssize_t size, int raise)
}
return 1;
}
@ -110,7 +110,7 @@ index 07dacfe..a4f7f40 100644
#endif
static struct {
@@ -264,7 +278,7 @@ dev_urandom_python(char *buffer, Py_ssize_t size)
@@ -288,7 +302,7 @@ dev_urandom_python(char *buffer, Py_ssize_t size)
int fd;
Py_ssize_t n;
struct _Py_stat_struct st;
@ -119,7 +119,7 @@ index 07dacfe..a4f7f40 100644
int res;
#endif
@@ -273,12 +287,16 @@ dev_urandom_python(char *buffer, Py_ssize_t size)
@@ -297,6 +311,10 @@ dev_urandom_python(char *buffer, Py_ssize_t size)
#ifdef PY_GETRANDOM
res = py_getrandom(buffer, size, 1);
@ -127,18 +127,10 @@ index 07dacfe..a4f7f40 100644
+ res = py_getentropy(buffer, size, 1);
+#endif
+#if defined(PY_GETRANDOM) || defined(PY_GETENTROPY)
if (res < 0)
if (res < 0) {
return -1;
if (res == 1)
return 0;
- /* getrandom() is not supported by the running kernel, fall back
- * on reading /dev/urandom */
+ /* function failed with ENOSYS or EPERM, fall back on reading
+ from /dev/urandom */
#endif
if (urandom_cache.fd >= 0) {
@@ -349,8 +367,8 @@ dev_urandom_close(void)
}
@@ -376,8 +394,8 @@ dev_urandom_close(void)
urandom_cache.fd = -1;
}
}
@ -148,7 +140,7 @@ index 07dacfe..a4f7f40 100644
/* Fill buffer with pseudo-random bytes generated by a linear congruent
generator (LCG):
@@ -391,8 +409,6 @@ _PyOS_URandom(void *buffer, Py_ssize_t size)
@@ -418,8 +436,6 @@ _PyOS_URandom(void *buffer, Py_ssize_t size)
#ifdef MS_WINDOWS
return win32_urandom((unsigned char *)buffer, size, 1);
@ -157,7 +149,7 @@ index 07dacfe..a4f7f40 100644
#else
return dev_urandom_python((char*)buffer, size);
#endif
@@ -454,8 +470,6 @@ _PyRandom_Fini(void)
@@ -481,8 +497,6 @@ _PyRandom_Fini(void)
CryptReleaseContext(hCryptProv, 0);
hCryptProv = 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,78 @@
diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py
index 3999d1f..c1e6566 100644
--- a/Lib/test/test_venv.py
+++ b/Lib/test/test_venv.py
@@ -328,13 +328,7 @@ def test_devnull_exists_and_is_empty(self):
with open(os.devnull, "rb") as f:
self.assertEqual(f.read(), b"")
- # Requesting pip fails without SSL (http://bugs.python.org/issue19744)
- @unittest.skipIf(ssl is None, ensurepip._MISSING_SSL_MESSAGE)
- @unittest.skipUnless(threading, 'some dependencies of pip import threading'
- ' module unconditionally')
- # Issue #26610: pip/pep425tags.py requires ctypes
- @unittest.skipUnless(ctypes, 'pip requires ctypes')
- def test_with_pip(self):
+ def do_test_with_pip(self, system_site_packages):
rmtree(self.env_dir)
with EnvironmentVarGuard() as envvars:
# pip's cross-version compatibility may trigger deprecation
@@ -368,6 +362,7 @@ def test_with_pip(self):
# config in place to ensure we ignore it
try:
self.run_with_capture(venv.create, self.env_dir,
+ system_site_packages=system_site_packages,
with_pip=True)
except subprocess.CalledProcessError as exc:
# The output this produces can be a little hard to read,
@@ -417,9 +412,21 @@ def test_with_pip(self):
out = out.decode("latin-1") # Force to text, prevent decoding errors
self.assertIn("Successfully uninstalled pip", out)
self.assertIn("Successfully uninstalled setuptools", out)
- # Check pip is now gone from the virtual environment
- self.assert_pip_not_installed()
+ # Check pip is now gone from the virtual environment. This only
+ # applies in the system_site_packages=False case, because in the
+ # other case, pip may still be available in the system site-packages
+ if not system_site_packages:
+ self.assert_pip_not_installed()
+ # Requesting pip fails without SSL (http://bugs.python.org/issue19744)
+ @unittest.skipIf(ssl is None, ensurepip._MISSING_SSL_MESSAGE)
+ @unittest.skipUnless(threading, 'some dependencies of pip import threading'
+ ' module unconditionally')
+ # Issue #26610: pip/pep425tags.py requires ctypes
+ @unittest.skipUnless(ctypes, 'pip requires ctypes')
+ def test_with_pip(self):
+ self.do_test_with_pip(False)
+ self.do_test_with_pip(True)
if __name__ == "__main__":
unittest.main()
diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py
index 74245ab..fa03262 100644
--- a/Lib/venv/__init__.py
+++ b/Lib/venv/__init__.py
@@ -77,6 +77,10 @@ def create(self, env_dir):
"""
env_dir = os.path.abspath(env_dir)
context = self.ensure_directories(env_dir)
+ # See issue 24875. We need system_site_packages to be False
+ # until after pip is installed.
+ true_system_site_packages = self.system_site_packages
+ self.system_site_packages = False
self.create_configuration(context)
self.setup_python(context)
if self.with_pip:
@@ -84,6 +88,11 @@ def create(self, env_dir):
if not self.upgrade:
self.setup_scripts(context)
self.post_setup(context)
+ if true_system_site_packages:
+ # We had set it to False before, now
+ # restore it and rewrite the configuration
+ self.system_site_packages = True
+ self.create_configuration(context)
def clear_directory(self, path):
for fn in os.listdir(path):

View File

@ -0,0 +1,67 @@
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 0e1d0af..42ab191 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -989,7 +989,7 @@ TESTTIMEOUT= 1200
# Run a basic set of regression tests.
# This excludes some tests that are particularly resource-intensive.
-test: all platform
+test: @DEF_MAKE_RULE@ platform
$(TESTRUNNER) $(TESTOPTS)
# Run the full test suite twice - once without .pyc files, and once with.
@@ -999,7 +999,7 @@ test: all platform
# the bytecode read from a .pyc file had the bug, sometimes the directly
# generated bytecode. This is sometimes a very shy bug needing a lot of
# sample data.
-testall: all platform
+testall: @DEF_MAKE_RULE@ platform
-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
$(TESTPYTHON) -E $(srcdir)/Lib/compileall.py
-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
@@ -1008,7 +1008,7 @@ testall: all platform
# Run the test suite for both architectures in a Universal build on OSX.
# Must be run on an Intel box.
-testuniversal: all platform
+testuniversal: @DEF_MAKE_RULE@ platform
if [ `arch` != 'i386' ];then \
echo "This can only be used on OSX/i386" ;\
exit 1 ;\
@@ -1031,7 +1031,7 @@ QUICKTESTOPTS= $(TESTOPTS) -x test_subprocess test_io test_lib2to3 \
test_multiprocessing_forkserver \
test_mailbox test_socket test_poll \
test_select test_zipfile test_concurrent_futures
-quicktest: all platform
+quicktest: @DEF_MAKE_RULE@ platform
$(TESTRUNNER) $(QUICKTESTOPTS)
@@ -1368,7 +1368,7 @@ LIBPL= $(LIBDEST)/config-$(LDVERSION)-$(MULTIARCH)
# pkgconfig directory
LIBPC= $(LIBDIR)/pkgconfig
-libainstall: all python-config
+libainstall: @DEF_MAKE_RULE@ python-config
@for i in $(LIBDIR) $(LIBPL) $(LIBPC); \
do \
if test ! -d $(DESTDIR)$$i; then \
@@ -1616,7 +1616,7 @@ distclean: clobber
-exec rm -f {} ';'
# Check for smelly exported symbols (not starting with Py/_Py)
-smelly: all
+smelly: @DEF_MAKE_RULE@
nm -p $(LIBRARY) | \
sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
@@ -1653,7 +1653,7 @@ funny:
-o -print
# Perform some verification checks on any modified files.
-patchcheck: all
+patchcheck: @DEF_MAKE_RULE@
$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
# Dependencies

View File

@ -6,5 +6,5 @@
%py_byte_compile()\
python_binary="%1"\
bytecode_compilation_path="%2"\
find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $python_binary -O -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("$RPM_BUILD_ROOT")[2]], optimize=opt) for opt in range(2) for f in sys.argv[1:]]' || :\
find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $python_binary -O -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("$RPM_BUILD_ROOT")[2], optimize=opt) for opt in range(2) for f in sys.argv[1:]]' || :\
%{nil}

View File

@ -97,8 +97,8 @@
# ==================
Summary: Version 3.5 of the Python programming language
Name: python%{pyshortver}
Version: %{pybasever}.2
Release: 9%{?dist}
Version: %{pybasever}.3
Release: 1%{?dist}
License: Python
Group: Development/Languages
@ -326,14 +326,6 @@ Patch178: 00178-dont-duplicate-flags-in-sysconfig.patch
# Not appropriate for upstream, Fedora-specific naming
Patch180: 00180-python-add-support-for-ppc64p7.patch
# 00184 #
# Fix for https://bugzilla.redhat.com/show_bug.cgi?id=979696
# Fixes build of ctypes against libffi with multilib wrapper
# Python recognizes ffi.h only if it contains "#define LIBFFI_H",
# but the wrapper doesn't contain that, which makes the build fail
# We patch this by also accepting "#define ffi_wrapper_h"
Patch184: 00184-ctypes-should-build-with-libffi-multilib-wrapper.patch
# 00186 #
# Fix for https://bugzilla.redhat.com/show_bug.cgi?id=1023607
# Previously, this fixed a problem where some *.py files were not being
@ -368,20 +360,6 @@ Patch205: 00205-make-libpl-respect-lib64.patch
# by debian but fedora infra uses only eabi without hf
Patch206: 00206-remove-hf-from-arm-triplet.patch
# 00209 #
# Fix test breakage with version 2.2.0 of Expat
# rhbz#1353918: https://bugzilla.redhat.com/show_bug.cgi?id=1353918
# FIXED UPSTREAM: http://bugs.python.org/issue27369
Patch209: 00209-fix-test-pyexpat-failure.patch
# 00242 #
# HTTPoxy attack (CVE-2016-1000110)
# https://httpoxy.org/
# FIXED UPSTREAM: http://bugs.python.org/issue27568
# Based on a patch by Rémi Rampin
# Resolves: rhbz#1359177
Patch242: 00242-CVE-2016-1000110-httpoxy.patch
# 00243 #
# Fix the triplet used on 64-bit MIPS
# rhbz#1322526: https://bugzilla.redhat.com/show_bug.cgi?id=1322526
@ -389,19 +367,33 @@ Patch242: 00242-CVE-2016-1000110-httpoxy.patch
# Fedora needs the default mips64-linux-gnu
Patch243: 00243-fix-mips64-triplet.patch
# 00247 #
# Port ssl and hashlib modules to OpenSSL 1.1.0.
# As of F26, OpenSSL is rebased to 1.1.0, so in order for python
# to not FTBFS we need to backport this patch from 3.5.3
# FIXED UPSTREAM: https://bugs.python.org/issue26470
Patch247: 00247-port-ssl-and-hashlib-to-OpenSSL-1.1.0.patch
# 00250 #
# After glibc-2.24.90, Python 3 failed to start on EL7 kernel
# rhbz#1410175: https://bugzilla.redhat.com/show_bug.cgi?id=1410175
# http://bugs.python.org/issue29157
Patch250: 00250-getentropy.patch
# 00259 #
# Tolerate legacy invalid bytecode
# This patch restores the ability to import legacy bytecode generated
# by 3.5.0, 3.5.1 or 3.5.2, and modifies the eval loop to
# avoid any harmful consequences from the potentially malformed legacy
# bytecode.
# Original import patch by Petr Viktorin, eval loop patch by Serhiy Storchaka,
# and tests and integration by Nick Coghlan.
Patch259: 00259-tolerate-legacy-invalid-bytecode.patch
# 00267 #
# Make pip installable inside a new venv when using the --system-site-packages flag
# FIXED UPSTREAM: https://bugs.python.org/issue24875
Patch267: 00267-install-pip-in-a-venv-with-system-site-packages.patch
# 00269 #
# Fix python's recompilation with common build commands when using
# profile guided optimizations.
# Fixed upstream: http://bugs.python.org/issue29243
Patch269: 00269-fix-multiple-compilations-issue-with-pgo-builds.patch
# (New patches go here ^^^)
#
# When adding new patches to "python" and "python3" in Fedora, EL, etc.,
@ -508,16 +500,15 @@ rm -r Modules/zlib || exit 1
%patch170 -p0
%patch178 -p1
%patch180 -p1
%patch184 -p1
%patch186 -p1
%patch188 -p1
%patch205 -p1
%patch206 -p1
%patch209 -p1
%patch242 -p1
%patch243 -p1
%patch247 -p1
%patch250 -p1
%patch259 -p1
%patch267 -p1
%patch269 -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.
@ -616,7 +607,11 @@ BuildPython debug \
BuildPython optimized \
python \
python%{pybasever} \
"--without-ensurepip" \
%ifarch %{ix86} x86_64
"--without-ensurepip --enable-optimizations" \
%else
"--without-ensurepip" \
%endif
true
# ======================================================
@ -1044,6 +1039,13 @@ CheckPython optimized
# ======================================================
%changelog
* Thu May 11 2017 Charalampos Stratakis <cstratak@redhat.com> - 3.5.3-1
- Rebased to version 3.5.3 from F25
- Enable profile guided optimizations for x86_64 and i686 architectures
- Make pip installable in a new venv when using the --system-site-packages flag
- Fix syntax error in %%py_byte_compile macro
- Add patch 259 to work around magic number bump in Python 3.5.3
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.2-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

View File

@ -1 +1 @@
8906efbacfcdc7c3c9198aeefafd159e Python-3.5.2.tar.xz
SHA512 (Python-3.5.3.tar.xz) = bbcc20e315c63dbc8901d7e7bfa29d4dbdad9335720757d8d679730319fd1d9fcfdb55cf62d620c9b052134170f162c28d653a8af60923185b8932524d827864