Author: Richard Plangger <planri...@gmail.com>
Branch: memop-simplify3
Changeset: r82622:6593ec12ff85
Date: 2016-03-01 08:16 +0100
http://bitbucket.org/pypy/pypy/changeset/6593ec12ff85/

Log:    merged default

diff too long, truncating to 2000 out of 25290 lines

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -22,6 +22,7 @@
 ^pypy/module/cpyext/test/.+\.obj$
 ^pypy/module/cpyext/test/.+\.manifest$
 ^pypy/module/test_lib_pypy/ctypes_tests/.+\.o$
+^pypy/module/test_lib_pypy/ctypes_tests/_ctypes_test\.o$
 ^pypy/module/cppyy/src/.+\.o$
 ^pypy/module/cppyy/bench/.+\.so$
 ^pypy/module/cppyy/bench/.+\.root$
@@ -35,7 +36,6 @@
 ^pypy/module/test_lib_pypy/cffi_tests/__pycache__.+$
 ^pypy/doc/.+\.html$
 ^pypy/doc/config/.+\.rst$
-^pypy/doc/basicblock\.asc$
 ^pypy/doc/.+\.svninfo$
 ^rpython/translator/c/src/libffi_msvc/.+\.obj$
 ^rpython/translator/c/src/libffi_msvc/.+\.dll$
@@ -45,52 +45,33 @@
 ^rpython/translator/c/src/cjkcodecs/.+\.obj$
 ^rpython/translator/c/src/stacklet/.+\.o$
 ^rpython/translator/c/src/.+\.o$
-^rpython/translator/jvm/\.project$
-^rpython/translator/jvm/\.classpath$
-^rpython/translator/jvm/eclipse-bin$
-^rpython/translator/jvm/src/pypy/.+\.class$
-^rpython/translator/benchmark/docutils$
-^rpython/translator/benchmark/templess$
-^rpython/translator/benchmark/gadfly$
-^rpython/translator/benchmark/mako$
-^rpython/translator/benchmark/bench-custom\.benchmark_result$
-^rpython/translator/benchmark/shootout_benchmarks$
+^rpython/translator/llvm/.+\.so$
 ^rpython/translator/goal/target.+-c$
 ^rpython/translator/goal/.+\.exe$
 ^rpython/translator/goal/.+\.dll$
 ^pypy/goal/pypy-translation-snapshot$
 ^pypy/goal/pypy-c
-^pypy/goal/pypy-jvm
-^pypy/goal/pypy-jvm.jar
 ^pypy/goal/.+\.exe$
 ^pypy/goal/.+\.dll$
 ^pypy/goal/.+\.lib$
 ^pypy/_cache$
-^pypy/doc/statistic/.+\.html$
-^pypy/doc/statistic/.+\.eps$
-^pypy/doc/statistic/.+\.pdf$
-^rpython/translator/cli/src/pypylib\.dll$
-^rpython/translator/cli/src/query\.exe$
-^rpython/translator/cli/src/main\.exe$
+^lib-python/2.7/lib2to3/.+\.pickle$
 ^lib_pypy/__pycache__$
 ^lib_pypy/ctypes_config_cache/_.+_cache\.py$
 ^lib_pypy/ctypes_config_cache/_.+_.+_\.py$
-^rpython/translator/cli/query-descriptions$
+^lib_pypy/_libmpdec/.+.o$
 ^pypy/doc/discussion/.+\.html$
 ^include/.+\.h$
 ^include/.+\.inl$
 ^pypy/doc/_build/.*$
 ^pypy/doc/config/.+\.html$
 ^pypy/doc/config/style\.css$
-^pypy/doc/jit/.+\.html$
-^pypy/doc/jit/style\.css$
 ^pypy/doc/image/lattice1\.png$
 ^pypy/doc/image/lattice2\.png$
 ^pypy/doc/image/lattice3\.png$
 ^pypy/doc/image/stackless_informal\.png$
 ^pypy/doc/image/parsing_example.+\.png$
 ^rpython/doc/_build/.*$
-^pypy/module/test_lib_pypy/ctypes_tests/_ctypes_test\.o$
 ^compiled
 ^.git/
 ^release/
diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -41,29 +41,29 @@
   Amaury Forgeot d'Arc
   Antonio Cuni
   Samuele Pedroni
+  Matti Picus
   Alex Gaynor
   Brian Kearns
-  Matti Picus
   Philip Jenvey
   Michael Hudson
+  Ronan Lamy
   David Schneider
+  Manuel Jacob
   Holger Krekel
   Christian Tismer
   Hakan Ardo
-  Manuel Jacob
-  Ronan Lamy
   Benjamin Peterson
+  Richard Plangger
   Anders Chrigstrom
   Eric van Riet Paap
   Wim Lavrijsen
-  Richard Plangger
   Richard Emslie
   Alexander Schremmer
   Dan Villiom Podlaski Christiansen
+  Remi Meier
   Lukas Diekmann
   Sven Hager
   Anders Lehmann
-  Remi Meier
   Aurelien Campeas
   Niklaus Haldimann
   Camillo Bruni
@@ -72,8 +72,8 @@
   Romain Guillebert
   Leonardo Santagada
   Seo Sanghyeon
+  Ronny Pfannschmidt
   Justin Peel
-  Ronny Pfannschmidt
   David Edelsohn
   Anders Hammarquist
   Jakub Gustak
@@ -95,6 +95,7 @@
   Tyler Wade
   Michael Foord
   Stephan Diehl
+  Vincent Legoll
   Stefan Schwarzer
   Valentino Volonghi
   Tomek Meka
@@ -105,9 +106,9 @@
   Jean-Paul Calderone
   Timo Paulssen
   Squeaky
+  Marius Gedminas
   Alexandre Fayolle
   Simon Burton
-  Marius Gedminas
   Martin Matusiak
   Konstantin Lopuhin
   Wenzhu Man
@@ -116,16 +117,20 @@
   Ivan Sichmann Freitas
   Greg Price
   Dario Bertini
+  Stefano Rivera
   Mark Pearse
   Simon Cross
   Andreas St&#252;hrk
-  Stefano Rivera
+  Edd Barrett
   Jean-Philippe St. Pierre
   Guido van Rossum
   Pavel Vinogradov
+  Jeremy Thurgood
   Pawe&#322; Piotr Przeradowski
+  Spenser Bauman
   Paul deGrandis
   Ilya Osadchiy
+  marky1991
   Tobias Oberstein
   Adrian Kuhn
   Boris Feigin
@@ -134,14 +139,12 @@
   Georg Brandl
   Bert Freudenberg
   Stian Andreassen
-  Edd Barrett
+  Tobias Pape
   Wanja Saatkamp
   Gerald Klix
   Mike Blume
-  Tobias Pape
   Oscar Nierstrasz
   Stefan H. Muller
-  Jeremy Thurgood
   Rami Chowdhury
   Eugene Oden
   Henry Mason
@@ -153,6 +156,8 @@
   Lukas Renggli
   Guenter Jantzen
   Ned Batchelder
+  Tim Felgentreff
+  Anton Gulenko
   Amit Regmi
   Ben Young
   Nicolas Chauvat
@@ -162,12 +167,12 @@
   Nicholas Riley
   Jason Chu
   Igor Trindade Oliveira
-  Tim Felgentreff
+  Yichao Yu
   Rocco Moretti
   Gintautas Miliauskas
   Michael Twomey
   Lucian Branescu Mihaila
-  Yichao Yu
+  Devin Jeanpierre
   Gabriel Lavoie
   Olivier Dormond
   Jared Grubb
@@ -191,33 +196,33 @@
   Stanislaw Halik
   Mikael Sch&#246;nenberg
   Berkin Ilbeyi
-  Elmo M?ntynen
+  Elmo M&#228;ntynen
+  Faye Zhao
   Jonathan David Riehl
   Anders Qvist
   Corbin Simpson
   Chirag Jadwani
   Beatrice During
   Alex Perry
-  Vincent Legoll
+  Vaibhav Sood
   Alan McIntyre
-  Spenser Bauman
+  William Leslie
   Alexander Sedov
   Attila Gobi
+  Jasper.Schulz
   Christopher Pope
-  Devin Jeanpierre
-  Vaibhav Sood
   Christian Tismer 
   Marc Abramowitz
   Dan Stromberg
   Arjun Naik
   Valentina Mukhamedzhanova
   Stefano Parmesan
+  Mark Young
   Alexis Daboville
   Jens-Uwe Mager
   Carl Meyer
   Karl Ramm
   Pieter Zieschang
-  Anton Gulenko
   Gabriel
   Lukas Vacek
   Andrew Dalke
@@ -225,6 +230,7 @@
   Jakub Stasiak
   Nathan Taylor
   Vladimir Kryachko
+  Omer Katz
   Jacek Generowicz
   Alejandro J. Cura
   Jacob Oscarson
@@ -239,6 +245,7 @@
   Lars Wassermann
   Philipp Rustemeuer
   Henrik Vendelbo
+  Richard Lancaster
   Dan Buch
   Miguel de Val Borro
   Artur Lisiecki
@@ -250,18 +257,18 @@
   Tomo Cocoa
   Kim Jin Su
   Toni Mattis
+  Amber Brown
   Lucas Stadler
   Julian Berman
   Markus Holtermann
   roberto@goyle
   Yury V. Zaytsev
   Anna Katrina Dominguez
-  William Leslie
   Bobby Impollonia
-  Faye Zhao
   t...@eistee.fritz.box
   Andrew Thompson
   Yusei Tahara
+  Aaron Tubbs
   Ben Darnell
   Roberto De Ioris
   Juan Francisco Cantero Hurtado
@@ -273,6 +280,7 @@
   Christopher Armstrong
   Michael Hudson-Doyle
   Anders Sigfridsson
+  Nikolay Zinov
   Yasir Suhail
   Jason Michalski
   rafalgalczyn...@gmail.com
@@ -282,6 +290,7 @@
   Gustavo Niemeyer
   Stephan Busemann
   Rafa&#322; Ga&#322;czy&#324;ski
+  Matt Bogosian
   Christian Muirhead
   Berker Peksag
   James Lan
@@ -316,9 +325,9 @@
   Stefan Marr
   jiaaro
   Mads Kiilerich
-  Richard Lancaster
   opassembler.py
   Antony Lee
+  Jason Madden
   Yaroslav Fedevych
   Jim Hunziker
   Markus Unterwaditzer
@@ -327,6 +336,7 @@
   squeaky
   Zearin
   soareschen
+  Jonas Pfannschmidt
   Kurt Griffiths
   Mike Bayer
   Matthew Miller
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -39,5 +39,5 @@
 # runs.  We cannot get their original value either:
 # http://lists.gnu.org/archive/html/help-make/2010-08/msg00106.html
 
-cffi_imports:
+cffi_imports: pypy-c
        PYTHONPATH=. ./pypy-c pypy/tool/build_cffi_imports.py
diff --git a/dotviewer/drawgraph.py b/dotviewer/drawgraph.py
--- a/dotviewer/drawgraph.py
+++ b/dotviewer/drawgraph.py
@@ -14,12 +14,661 @@
 FONT = os.path.join(this_dir, 'font', 'DroidSans.ttf')
 FIXEDFONT = os.path.join(this_dir, 'font', 'DroidSansMono.ttf')
 COLOR = {
-    'black': (0,0,0),
-    'white': (255,255,255),
-    'red': (255,0,0),
-    'green': (0,255,0),
-    'blue': (0,0,255),
-    'yellow': (255,255,0),
+    'aliceblue': (240, 248, 255),
+    'antiquewhite': (250, 235, 215),
+    'antiquewhite1': (255, 239, 219),
+    'antiquewhite2': (238, 223, 204),
+    'antiquewhite3': (205, 192, 176),
+    'antiquewhite4': (139, 131, 120),
+    'aquamarine': (127, 255, 212),
+    'aquamarine1': (127, 255, 212),
+    'aquamarine2': (118, 238, 198),
+    'aquamarine3': (102, 205, 170),
+    'aquamarine4': (69, 139, 116),
+    'azure': (240, 255, 255),
+    'azure1': (240, 255, 255),
+    'azure2': (224, 238, 238),
+    'azure3': (193, 205, 205),
+    'azure4': (131, 139, 139),
+    'beige': (245, 245, 220),
+    'bisque': (255, 228, 196),
+    'bisque1': (255, 228, 196),
+    'bisque2': (238, 213, 183),
+    'bisque3': (205, 183, 158),
+    'bisque4': (139, 125, 107),
+    'black': (0, 0, 0),
+    'blanchedalmond': (255, 235, 205),
+    'blue': (0, 0, 255),
+    'blue1': (0, 0, 255),
+    'blue2': (0, 0, 238),
+    'blue3': (0, 0, 205),
+    'blue4': (0, 0, 139),
+    'blueviolet': (138, 43, 226),
+    'brown': (165, 42, 42),
+    'brown1': (255, 64, 64),
+    'brown2': (238, 59, 59),
+    'brown3': (205, 51, 51),
+    'brown4': (139, 35, 35),
+    'burlywood': (222, 184, 135),
+    'burlywood1': (255, 211, 155),
+    'burlywood2': (238, 197, 145),
+    'burlywood3': (205, 170, 125),
+    'burlywood4': (139, 115, 85),
+    'cadetblue': (95, 158, 160),
+    'cadetblue1': (152, 245, 255),
+    'cadetblue2': (142, 229, 238),
+    'cadetblue3': (122, 197, 205),
+    'cadetblue4': (83, 134, 139),
+    'chartreuse': (127, 255, 0),
+    'chartreuse1': (127, 255, 0),
+    'chartreuse2': (118, 238, 0),
+    'chartreuse3': (102, 205, 0),
+    'chartreuse4': (69, 139, 0),
+    'chocolate': (210, 105, 30),
+    'chocolate1': (255, 127, 36),
+    'chocolate2': (238, 118, 33),
+    'chocolate3': (205, 102, 29),
+    'chocolate4': (139, 69, 19),
+    'coral': (255, 127, 80),
+    'coral1': (255, 114, 86),
+    'coral2': (238, 106, 80),
+    'coral3': (205, 91, 69),
+    'coral4': (139, 62, 47),
+    'cornflowerblue': (100, 149, 237),
+    'cornsilk': (255, 248, 220),
+    'cornsilk1': (255, 248, 220),
+    'cornsilk2': (238, 232, 205),
+    'cornsilk3': (205, 200, 177),
+    'cornsilk4': (139, 136, 120),
+    'crimson': (220, 20, 60),
+    'cyan': (0, 255, 255),
+    'cyan1': (0, 255, 255),
+    'cyan2': (0, 238, 238),
+    'cyan3': (0, 205, 205),
+    'cyan4': (0, 139, 139),
+    'darkgoldenrod': (184, 134, 11),
+    'darkgoldenrod1': (255, 185, 15),
+    'darkgoldenrod2': (238, 173, 14),
+    'darkgoldenrod3': (205, 149, 12),
+    'darkgoldenrod4': (139, 101, 8),
+    'darkgreen': (0, 100, 0),
+    'darkkhaki': (189, 183, 107),
+    'darkolivegreen': (85, 107, 47),
+    'darkolivegreen1': (202, 255, 112),
+    'darkolivegreen2': (188, 238, 104),
+    'darkolivegreen3': (162, 205, 90),
+    'darkolivegreen4': (110, 139, 61),
+    'darkorange': (255, 140, 0),
+    'darkorange1': (255, 127, 0),
+    'darkorange2': (238, 118, 0),
+    'darkorange3': (205, 102, 0),
+    'darkorange4': (139, 69, 0),
+    'darkorchid': (153, 50, 204),
+    'darkorchid1': (191, 62, 255),
+    'darkorchid2': (178, 58, 238),
+    'darkorchid3': (154, 50, 205),
+    'darkorchid4': (104, 34, 139),
+    'darksalmon': (233, 150, 122),
+    'darkseagreen': (143, 188, 143),
+    'darkseagreen1': (193, 255, 193),
+    'darkseagreen2': (180, 238, 180),
+    'darkseagreen3': (155, 205, 155),
+    'darkseagreen4': (105, 139, 105),
+    'darkslateblue': (72, 61, 139),
+    'darkslategray': (47, 79, 79),
+    'darkslategray1': (151, 255, 255),
+    'darkslategray2': (141, 238, 238),
+    'darkslategray3': (121, 205, 205),
+    'darkslategray4': (82, 139, 139),
+    'darkslategrey': (47, 79, 79),
+    'darkturquoise': (0, 206, 209),
+    'darkviolet': (148, 0, 211),
+    'deeppink': (255, 20, 147),
+    'deeppink1': (255, 20, 147),
+    'deeppink2': (238, 18, 137),
+    'deeppink3': (205, 16, 118),
+    'deeppink4': (139, 10, 80),
+    'deepskyblue': (0, 191, 255),
+    'deepskyblue1': (0, 191, 255),
+    'deepskyblue2': (0, 178, 238),
+    'deepskyblue3': (0, 154, 205),
+    'deepskyblue4': (0, 104, 139),
+    'dimgray': (105, 105, 105),
+    'dimgrey': (105, 105, 105),
+    'dodgerblue': (30, 144, 255),
+    'dodgerblue1': (30, 144, 255),
+    'dodgerblue2': (28, 134, 238),
+    'dodgerblue3': (24, 116, 205),
+    'dodgerblue4': (16, 78, 139),
+    'firebrick': (178, 34, 34),
+    'firebrick1': (255, 48, 48),
+    'firebrick2': (238, 44, 44),
+    'firebrick3': (205, 38, 38),
+    'firebrick4': (139, 26, 26),
+    'floralwhite': (255, 250, 240),
+    'forestgreen': (34, 139, 34),
+    'gainsboro': (220, 220, 220),
+    'ghostwhite': (248, 248, 255),
+    'gold': (255, 215, 0),
+    'gold1': (255, 215, 0),
+    'gold2': (238, 201, 0),
+    'gold3': (205, 173, 0),
+    'gold4': (139, 117, 0),
+    'goldenrod': (218, 165, 32),
+    'goldenrod1': (255, 193, 37),
+    'goldenrod2': (238, 180, 34),
+    'goldenrod3': (205, 155, 29),
+    'goldenrod4': (139, 105, 20),
+    'gray': (192, 192, 192),
+    'gray0': (0, 0, 0),
+    'gray1': (3, 3, 3),
+    'gray10': (26, 26, 26),
+    'gray100': (255, 255, 255),
+    'gray11': (28, 28, 28),
+    'gray12': (31, 31, 31),
+    'gray13': (33, 33, 33),
+    'gray14': (36, 36, 36),
+    'gray15': (38, 38, 38),
+    'gray16': (41, 41, 41),
+    'gray17': (43, 43, 43),
+    'gray18': (46, 46, 46),
+    'gray19': (48, 48, 48),
+    'gray2': (5, 5, 5),
+    'gray20': (51, 51, 51),
+    'gray21': (54, 54, 54),
+    'gray22': (56, 56, 56),
+    'gray23': (59, 59, 59),
+    'gray24': (61, 61, 61),
+    'gray25': (64, 64, 64),
+    'gray26': (66, 66, 66),
+    'gray27': (69, 69, 69),
+    'gray28': (71, 71, 71),
+    'gray29': (74, 74, 74),
+    'gray3': (8, 8, 8),
+    'gray30': (77, 77, 77),
+    'gray31': (79, 79, 79),
+    'gray32': (82, 82, 82),
+    'gray33': (84, 84, 84),
+    'gray34': (87, 87, 87),
+    'gray35': (89, 89, 89),
+    'gray36': (92, 92, 92),
+    'gray37': (94, 94, 94),
+    'gray38': (97, 97, 97),
+    'gray39': (99, 99, 99),
+    'gray4': (10, 10, 10),
+    'gray40': (102, 102, 102),
+    'gray41': (105, 105, 105),
+    'gray42': (107, 107, 107),
+    'gray43': (110, 110, 110),
+    'gray44': (112, 112, 112),
+    'gray45': (115, 115, 115),
+    'gray46': (117, 117, 117),
+    'gray47': (120, 120, 120),
+    'gray48': (122, 122, 122),
+    'gray49': (125, 125, 125),
+    'gray5': (13, 13, 13),
+    'gray50': (127, 127, 127),
+    'gray51': (130, 130, 130),
+    'gray52': (133, 133, 133),
+    'gray53': (135, 135, 135),
+    'gray54': (138, 138, 138),
+    'gray55': (140, 140, 140),
+    'gray56': (143, 143, 143),
+    'gray57': (145, 145, 145),
+    'gray58': (148, 148, 148),
+    'gray59': (150, 150, 150),
+    'gray6': (15, 15, 15),
+    'gray60': (153, 153, 153),
+    'gray61': (156, 156, 156),
+    'gray62': (158, 158, 158),
+    'gray63': (161, 161, 161),
+    'gray64': (163, 163, 163),
+    'gray65': (166, 166, 166),
+    'gray66': (168, 168, 168),
+    'gray67': (171, 171, 171),
+    'gray68': (173, 173, 173),
+    'gray69': (176, 176, 176),
+    'gray7': (18, 18, 18),
+    'gray70': (179, 179, 179),
+    'gray71': (181, 181, 181),
+    'gray72': (184, 184, 184),
+    'gray73': (186, 186, 186),
+    'gray74': (189, 189, 189),
+    'gray75': (191, 191, 191),
+    'gray76': (194, 194, 194),
+    'gray77': (196, 196, 196),
+    'gray78': (199, 199, 199),
+    'gray79': (201, 201, 201),
+    'gray8': (20, 20, 20),
+    'gray80': (204, 204, 204),
+    'gray81': (207, 207, 207),
+    'gray82': (209, 209, 209),
+    'gray83': (212, 212, 212),
+    'gray84': (214, 214, 214),
+    'gray85': (217, 217, 217),
+    'gray86': (219, 219, 219),
+    'gray87': (222, 222, 222),
+    'gray88': (224, 224, 224),
+    'gray89': (227, 227, 227),
+    'gray9': (23, 23, 23),
+    'gray90': (229, 229, 229),
+    'gray91': (232, 232, 232),
+    'gray92': (235, 235, 235),
+    'gray93': (237, 237, 237),
+    'gray94': (240, 240, 240),
+    'gray95': (242, 242, 242),
+    'gray96': (245, 245, 245),
+    'gray97': (247, 247, 247),
+    'gray98': (250, 250, 250),
+    'gray99': (252, 252, 252),
+    'green': (0, 255, 0),
+    'green1': (0, 255, 0),
+    'green2': (0, 238, 0),
+    'green3': (0, 205, 0),
+    'green4': (0, 139, 0),
+    'greenyellow': (173, 255, 47),
+    'grey': (192, 192, 192),
+    'grey0': (0, 0, 0),
+    'grey1': (3, 3, 3),
+    'grey10': (26, 26, 26),
+    'grey100': (255, 255, 255),
+    'grey11': (28, 28, 28),
+    'grey12': (31, 31, 31),
+    'grey13': (33, 33, 33),
+    'grey14': (36, 36, 36),
+    'grey15': (38, 38, 38),
+    'grey16': (41, 41, 41),
+    'grey17': (43, 43, 43),
+    'grey18': (46, 46, 46),
+    'grey19': (48, 48, 48),
+    'grey2': (5, 5, 5),
+    'grey20': (51, 51, 51),
+    'grey21': (54, 54, 54),
+    'grey22': (56, 56, 56),
+    'grey23': (59, 59, 59),
+    'grey24': (61, 61, 61),
+    'grey25': (64, 64, 64),
+    'grey26': (66, 66, 66),
+    'grey27': (69, 69, 69),
+    'grey28': (71, 71, 71),
+    'grey29': (74, 74, 74),
+    'grey3': (8, 8, 8),
+    'grey30': (77, 77, 77),
+    'grey31': (79, 79, 79),
+    'grey32': (82, 82, 82),
+    'grey33': (84, 84, 84),
+    'grey34': (87, 87, 87),
+    'grey35': (89, 89, 89),
+    'grey36': (92, 92, 92),
+    'grey37': (94, 94, 94),
+    'grey38': (97, 97, 97),
+    'grey39': (99, 99, 99),
+    'grey4': (10, 10, 10),
+    'grey40': (102, 102, 102),
+    'grey41': (105, 105, 105),
+    'grey42': (107, 107, 107),
+    'grey43': (110, 110, 110),
+    'grey44': (112, 112, 112),
+    'grey45': (115, 115, 115),
+    'grey46': (117, 117, 117),
+    'grey47': (120, 120, 120),
+    'grey48': (122, 122, 122),
+    'grey49': (125, 125, 125),
+    'grey5': (13, 13, 13),
+    'grey50': (127, 127, 127),
+    'grey51': (130, 130, 130),
+    'grey52': (133, 133, 133),
+    'grey53': (135, 135, 135),
+    'grey54': (138, 138, 138),
+    'grey55': (140, 140, 140),
+    'grey56': (143, 143, 143),
+    'grey57': (145, 145, 145),
+    'grey58': (148, 148, 148),
+    'grey59': (150, 150, 150),
+    'grey6': (15, 15, 15),
+    'grey60': (153, 153, 153),
+    'grey61': (156, 156, 156),
+    'grey62': (158, 158, 158),
+    'grey63': (161, 161, 161),
+    'grey64': (163, 163, 163),
+    'grey65': (166, 166, 166),
+    'grey66': (168, 168, 168),
+    'grey67': (171, 171, 171),
+    'grey68': (173, 173, 173),
+    'grey69': (176, 176, 176),
+    'grey7': (18, 18, 18),
+    'grey70': (179, 179, 179),
+    'grey71': (181, 181, 181),
+    'grey72': (184, 184, 184),
+    'grey73': (186, 186, 186),
+    'grey74': (189, 189, 189),
+    'grey75': (191, 191, 191),
+    'grey76': (194, 194, 194),
+    'grey77': (196, 196, 196),
+    'grey78': (199, 199, 199),
+    'grey79': (201, 201, 201),
+    'grey8': (20, 20, 20),
+    'grey80': (204, 204, 204),
+    'grey81': (207, 207, 207),
+    'grey82': (209, 209, 209),
+    'grey83': (212, 212, 212),
+    'grey84': (214, 214, 214),
+    'grey85': (217, 217, 217),
+    'grey86': (219, 219, 219),
+    'grey87': (222, 222, 222),
+    'grey88': (224, 224, 224),
+    'grey89': (227, 227, 227),
+    'grey9': (23, 23, 23),
+    'grey90': (229, 229, 229),
+    'grey91': (232, 232, 232),
+    'grey92': (235, 235, 235),
+    'grey93': (237, 237, 237),
+    'grey94': (240, 240, 240),
+    'grey95': (242, 242, 242),
+    'grey96': (245, 245, 245),
+    'grey97': (247, 247, 247),
+    'grey98': (250, 250, 250),
+    'grey99': (252, 252, 252),
+    'honeydew': (240, 255, 240),
+    'honeydew1': (240, 255, 240),
+    'honeydew2': (224, 238, 224),
+    'honeydew3': (193, 205, 193),
+    'honeydew4': (131, 139, 131),
+    'hotpink': (255, 105, 180),
+    'hotpink1': (255, 110, 180),
+    'hotpink2': (238, 106, 167),
+    'hotpink3': (205, 96, 144),
+    'hotpink4': (139, 58, 98),
+    'indianred': (205, 92, 92),
+    'indianred1': (255, 106, 106),
+    'indianred2': (238, 99, 99),
+    'indianred3': (205, 85, 85),
+    'indianred4': (139, 58, 58),
+    'indigo': (75, 0, 130),
+    'invis': (255, 255, 254),
+    'ivory': (255, 255, 240),
+    'ivory1': (255, 255, 240),
+    'ivory2': (238, 238, 224),
+    'ivory3': (205, 205, 193),
+    'ivory4': (139, 139, 131),
+    'khaki': (240, 230, 140),
+    'khaki1': (255, 246, 143),
+    'khaki2': (238, 230, 133),
+    'khaki3': (205, 198, 115),
+    'khaki4': (139, 134, 78),
+    'lavender': (230, 230, 250),
+    'lavenderblush': (255, 240, 245),
+    'lavenderblush1': (255, 240, 245),
+    'lavenderblush2': (238, 224, 229),
+    'lavenderblush3': (205, 193, 197),
+    'lavenderblush4': (139, 131, 134),
+    'lawngreen': (124, 252, 0),
+    'lemonchiffon': (255, 250, 205),
+    'lemonchiffon1': (255, 250, 205),
+    'lemonchiffon2': (238, 233, 191),
+    'lemonchiffon3': (205, 201, 165),
+    'lemonchiffon4': (139, 137, 112),
+    'lightblue': (173, 216, 230),
+    'lightblue1': (191, 239, 255),
+    'lightblue2': (178, 223, 238),
+    'lightblue3': (154, 192, 205),
+    'lightblue4': (104, 131, 139),
+    'lightcoral': (240, 128, 128),
+    'lightcyan': (224, 255, 255),
+    'lightcyan1': (224, 255, 255),
+    'lightcyan2': (209, 238, 238),
+    'lightcyan3': (180, 205, 205),
+    'lightcyan4': (122, 139, 139),
+    'lightgoldenrod': (238, 221, 130),
+    'lightgoldenrod1': (255, 236, 139),
+    'lightgoldenrod2': (238, 220, 130),
+    'lightgoldenrod3': (205, 190, 112),
+    'lightgoldenrod4': (139, 129, 76),
+    'lightgoldenrodyellow': (250, 250, 210),
+    'lightgray': (211, 211, 211),
+    'lightgrey': (211, 211, 211),
+    'lightpink': (255, 182, 193),
+    'lightpink1': (255, 174, 185),
+    'lightpink2': (238, 162, 173),
+    'lightpink3': (205, 140, 149),
+    'lightpink4': (139, 95, 101),
+    'lightsalmon': (255, 160, 122),
+    'lightsalmon1': (255, 160, 122),
+    'lightsalmon2': (238, 149, 114),
+    'lightsalmon3': (205, 129, 98),
+    'lightsalmon4': (139, 87, 66),
+    'lightseagreen': (32, 178, 170),
+    'lightskyblue': (135, 206, 250),
+    'lightskyblue1': (176, 226, 255),
+    'lightskyblue2': (164, 211, 238),
+    'lightskyblue3': (141, 182, 205),
+    'lightskyblue4': (96, 123, 139),
+    'lightslateblue': (132, 112, 255),
+    'lightslategray': (119, 136, 153),
+    'lightslategrey': (119, 136, 153),
+    'lightsteelblue': (176, 196, 222),
+    'lightsteelblue1': (202, 225, 255),
+    'lightsteelblue2': (188, 210, 238),
+    'lightsteelblue3': (162, 181, 205),
+    'lightsteelblue4': (110, 123, 139),
+    'lightyellow': (255, 255, 224),
+    'lightyellow1': (255, 255, 224),
+    'lightyellow2': (238, 238, 209),
+    'lightyellow3': (205, 205, 180),
+    'lightyellow4': (139, 139, 122),
+    'limegreen': (50, 205, 50),
+    'linen': (250, 240, 230),
+    'magenta': (255, 0, 255),
+    'magenta1': (255, 0, 255),
+    'magenta2': (238, 0, 238),
+    'magenta3': (205, 0, 205),
+    'magenta4': (139, 0, 139),
+    'maroon': (176, 48, 96),
+    'maroon1': (255, 52, 179),
+    'maroon2': (238, 48, 167),
+    'maroon3': (205, 41, 144),
+    'maroon4': (139, 28, 98),
+    'mediumaquamarine': (102, 205, 170),
+    'mediumblue': (0, 0, 205),
+    'mediumorchid': (186, 85, 211),
+    'mediumorchid1': (224, 102, 255),
+    'mediumorchid2': (209, 95, 238),
+    'mediumorchid3': (180, 82, 205),
+    'mediumorchid4': (122, 55, 139),
+    'mediumpurple': (147, 112, 219),
+    'mediumpurple1': (171, 130, 255),
+    'mediumpurple2': (159, 121, 238),
+    'mediumpurple3': (137, 104, 205),
+    'mediumpurple4': (93, 71, 139),
+    'mediumseagreen': (60, 179, 113),
+    'mediumslateblue': (123, 104, 238),
+    'mediumspringgreen': (0, 250, 154),
+    'mediumturquoise': (72, 209, 204),
+    'mediumvioletred': (199, 21, 133),
+    'midnightblue': (25, 25, 112),
+    'mintcream': (245, 255, 250),
+    'mistyrose': (255, 228, 225),
+    'mistyrose1': (255, 228, 225),
+    'mistyrose2': (238, 213, 210),
+    'mistyrose3': (205, 183, 181),
+    'mistyrose4': (139, 125, 123),
+    'moccasin': (255, 228, 181),
+    'navajowhite': (255, 222, 173),
+    'navajowhite1': (255, 222, 173),
+    'navajowhite2': (238, 207, 161),
+    'navajowhite3': (205, 179, 139),
+    'navajowhite4': (139, 121, 94),
+    'navy': (0, 0, 128),
+    'navyblue': (0, 0, 128),
+    'none': (255, 255, 254),
+    'oldlace': (253, 245, 230),
+    'olivedrab': (107, 142, 35),
+    'olivedrab1': (192, 255, 62),
+    'olivedrab2': (179, 238, 58),
+    'olivedrab3': (154, 205, 50),
+    'olivedrab4': (105, 139, 34),
+    'orange': (255, 165, 0),
+    'orange1': (255, 165, 0),
+    'orange2': (238, 154, 0),
+    'orange3': (205, 133, 0),
+    'orange4': (139, 90, 0),
+    'orangered': (255, 69, 0),
+    'orangered1': (255, 69, 0),
+    'orangered2': (238, 64, 0),
+    'orangered3': (205, 55, 0),
+    'orangered4': (139, 37, 0),
+    'orchid': (218, 112, 214),
+    'orchid1': (255, 131, 250),
+    'orchid2': (238, 122, 233),
+    'orchid3': (205, 105, 201),
+    'orchid4': (139, 71, 137),
+    'palegoldenrod': (238, 232, 170),
+    'palegreen': (152, 251, 152),
+    'palegreen1': (154, 255, 154),
+    'palegreen2': (144, 238, 144),
+    'palegreen3': (124, 205, 124),
+    'palegreen4': (84, 139, 84),
+    'paleturquoise': (175, 238, 238),
+    'paleturquoise1': (187, 255, 255),
+    'paleturquoise2': (174, 238, 238),
+    'paleturquoise3': (150, 205, 205),
+    'paleturquoise4': (102, 139, 139),
+    'palevioletred': (219, 112, 147),
+    'palevioletred1': (255, 130, 171),
+    'palevioletred2': (238, 121, 159),
+    'palevioletred3': (205, 104, 137),
+    'palevioletred4': (139, 71, 93),
+    'papayawhip': (255, 239, 213),
+    'peachpuff': (255, 218, 185),
+    'peachpuff1': (255, 218, 185),
+    'peachpuff2': (238, 203, 173),
+    'peachpuff3': (205, 175, 149),
+    'peachpuff4': (139, 119, 101),
+    'peru': (205, 133, 63),
+    'pink': (255, 192, 203),
+    'pink1': (255, 181, 197),
+    'pink2': (238, 169, 184),
+    'pink3': (205, 145, 158),
+    'pink4': (139, 99, 108),
+    'plum': (221, 160, 221),
+    'plum1': (255, 187, 255),
+    'plum2': (238, 174, 238),
+    'plum3': (205, 150, 205),
+    'plum4': (139, 102, 139),
+    'powderblue': (176, 224, 230),
+    'purple': (160, 32, 240),
+    'purple1': (155, 48, 255),
+    'purple2': (145, 44, 238),
+    'purple3': (125, 38, 205),
+    'purple4': (85, 26, 139),
+    'red': (255, 0, 0),
+    'red1': (255, 0, 0),
+    'red2': (238, 0, 0),
+    'red3': (205, 0, 0),
+    'red4': (139, 0, 0),
+    'rosybrown': (188, 143, 143),
+    'rosybrown1': (255, 193, 193),
+    'rosybrown2': (238, 180, 180),
+    'rosybrown3': (205, 155, 155),
+    'rosybrown4': (139, 105, 105),
+    'royalblue': (65, 105, 225),
+    'royalblue1': (72, 118, 255),
+    'royalblue2': (67, 110, 238),
+    'royalblue3': (58, 95, 205),
+    'royalblue4': (39, 64, 139),
+    'saddlebrown': (139, 69, 19),
+    'salmon': (250, 128, 114),
+    'salmon1': (255, 140, 105),
+    'salmon2': (238, 130, 98),
+    'salmon3': (205, 112, 84),
+    'salmon4': (139, 76, 57),
+    'sandybrown': (244, 164, 96),
+    'seagreen': (46, 139, 87),
+    'seagreen1': (84, 255, 159),
+    'seagreen2': (78, 238, 148),
+    'seagreen3': (67, 205, 128),
+    'seagreen4': (46, 139, 87),
+    'seashell': (255, 245, 238),
+    'seashell1': (255, 245, 238),
+    'seashell2': (238, 229, 222),
+    'seashell3': (205, 197, 191),
+    'seashell4': (139, 134, 130),
+    'sienna': (160, 82, 45),
+    'sienna1': (255, 130, 71),
+    'sienna2': (238, 121, 66),
+    'sienna3': (205, 104, 57),
+    'sienna4': (139, 71, 38),
+    'skyblue': (135, 206, 235),
+    'skyblue1': (135, 206, 255),
+    'skyblue2': (126, 192, 238),
+    'skyblue3': (108, 166, 205),
+    'skyblue4': (74, 112, 139),
+    'slateblue': (106, 90, 205),
+    'slateblue1': (131, 111, 255),
+    'slateblue2': (122, 103, 238),
+    'slateblue3': (105, 89, 205),
+    'slateblue4': (71, 60, 139),
+    'slategray': (112, 128, 144),
+    'slategray1': (198, 226, 255),
+    'slategray2': (185, 211, 238),
+    'slategray3': (159, 182, 205),
+    'slategray4': (108, 123, 139),
+    'slategrey': (112, 128, 144),
+    'snow': (255, 250, 250),
+    'snow1': (255, 250, 250),
+    'snow2': (238, 233, 233),
+    'snow3': (205, 201, 201),
+    'snow4': (139, 137, 137),
+    'springgreen': (0, 255, 127),
+    'springgreen1': (0, 255, 127),
+    'springgreen2': (0, 238, 118),
+    'springgreen3': (0, 205, 102),
+    'springgreen4': (0, 139, 69),
+    'steelblue': (70, 130, 180),
+    'steelblue1': (99, 184, 255),
+    'steelblue2': (92, 172, 238),
+    'steelblue3': (79, 148, 205),
+    'steelblue4': (54, 100, 139),
+    'tan': (210, 180, 140),
+    'tan1': (255, 165, 79),
+    'tan2': (238, 154, 73),
+    'tan3': (205, 133, 63),
+    'tan4': (139, 90, 43),
+    'thistle': (216, 191, 216),
+    'thistle1': (255, 225, 255),
+    'thistle2': (238, 210, 238),
+    'thistle3': (205, 181, 205),
+    'thistle4': (139, 123, 139),
+    'tomato': (255, 99, 71),
+    'tomato1': (255, 99, 71),
+    'tomato2': (238, 92, 66),
+    'tomato3': (205, 79, 57),
+    'tomato4': (139, 54, 38),
+    'transparent': (255, 255, 254),
+    'turquoise': (64, 224, 208),
+    'turquoise1': (0, 245, 255),
+    'turquoise2': (0, 229, 238),
+    'turquoise3': (0, 197, 205),
+    'turquoise4': (0, 134, 139),
+    'violet': (238, 130, 238),
+    'violetred': (208, 32, 144),
+    'violetred1': (255, 62, 150),
+    'violetred2': (238, 58, 140),
+    'violetred3': (205, 50, 120),
+    'violetred4': (139, 34, 82),
+    'wheat': (245, 222, 179),
+    'wheat1': (255, 231, 186),
+    'wheat2': (238, 216, 174),
+    'wheat3': (205, 186, 150),
+    'wheat4': (139, 126, 102),
+    'white': (255, 255, 255),
+    'whitesmoke': (245, 245, 245),
+    'yellow': (255, 255, 0),
+    'yellow1': (255, 255, 0),
+    'yellow2': (238, 238, 0),
+    'yellow3': (205, 205, 0),
+    'yellow4': (139, 139, 0),
+    'yellowgreen': (154, 205, 50),
     }
 re_nonword=re.compile(r'([^0-9a-zA-Z_.]+)')
 re_linewidth=re.compile(r'setlinewidth\((\d+(\.\d*)?|\.\d+)\)')
diff --git a/lib-python/2.7/distutils/command/build_ext.py 
b/lib-python/2.7/distutils/command/build_ext.py
--- a/lib-python/2.7/distutils/command/build_ext.py
+++ b/lib-python/2.7/distutils/command/build_ext.py
@@ -188,7 +188,7 @@
             # the 'libs' directory is for binary installs - we assume that
             # must be the *native* platform.  But we don't really support
             # cross-compiling via a binary install anyway, so we let it go.
-            self.library_dirs.append(os.path.join(sys.exec_prefix, 'include'))
+            self.library_dirs.append(os.path.join(sys.exec_prefix, 'libs'))
             if self.debug:
                 self.build_temp = os.path.join(self.build_temp, "Debug")
             else:
@@ -685,13 +685,17 @@
         # the previous version of this code did.  This should work for
         # CPython too.  The point is that on PyPy with cpyext, the
         # config var 'SO' is just ".so" but we want to return
-        # ".pypy-VERSION.so" instead.
-        so_ext = _get_c_extension_suffix()
+        # ".pypy-VERSION.so" instead.  Note a further tweak for cffi's
+        # embedding mode: if EXT_SUFFIX is also defined, use that
+        # directly.
+        so_ext = get_config_var('EXT_SUFFIX')
         if so_ext is None:
-            so_ext = get_config_var('SO')     # fall-back
-        # extensions in debug_mode are named 'module_d.pyd' under windows
-        if os.name == 'nt' and self.debug:
-            so_ext = '_d.pyd'
+            so_ext = _get_c_extension_suffix()
+            if so_ext is None:
+                so_ext = get_config_var('SO')     # fall-back
+            # extensions in debug_mode are named 'module_d.pyd' under windows
+            if os.name == 'nt' and self.debug:
+                so_ext = '_d.pyd'
         return os.path.join(*ext_path) + so_ext
 
     def get_export_symbols (self, ext):
diff --git a/lib-python/2.7/test/capath/0e4015b9.0 
b/lib-python/2.7/test/capath/0e4015b9.0
new file mode 100644
--- /dev/null
+++ b/lib-python/2.7/test/capath/0e4015b9.0
@@ -0,0 +1,16 @@
+-----BEGIN CERTIFICATE-----
+MIIClTCCAf6gAwIBAgIJAKGU95wKR8pTMA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV
+BAYTAlhZMRcwFQYDVQQHDA5DYXN0bGUgQW50aHJheDEjMCEGA1UECgwaUHl0aG9u
+IFNvZnR3YXJlIEZvdW5kYXRpb24xIzAhBgNVBAMMGnNlbGYtc2lnbmVkLnB5dGhv
+bnRlc3QubmV0MB4XDTE0MTEwMjE4MDkyOVoXDTI0MTAzMDE4MDkyOVowcDELMAkG
+A1UEBhMCWFkxFzAVBgNVBAcMDkNhc3RsZSBBbnRocmF4MSMwIQYDVQQKDBpQeXRo
+b24gU29mdHdhcmUgRm91bmRhdGlvbjEjMCEGA1UEAwwac2VsZi1zaWduZWQucHl0
+aG9udGVzdC5uZXQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANDXQXW9tjyZ
+Xt0Iv2tLL1+jinr4wGg36ioLDLFkMf+2Y1GL0v0BnKYG4N1OKlAU15LXGeGer8vm
+Sv/yIvmdrELvhAbbo3w4a9TMYQA4XkIVLdvu3mvNOAet+8PMJxn26dbDhG809ALv
+EHY57lQsBS3G59RZyBPVqAqmImWNJnVzAgMBAAGjNzA1MCUGA1UdEQQeMByCGnNl
+bGYtc2lnbmVkLnB5dGhvbnRlc3QubmV0MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcN
+AQEFBQADgYEAIuzAhgMouJpNdf3URCHIineyoSt6WK/9+eyUcjlKOrDoXNZaD72h
+TXMeKYoWvJyVcSLKL8ckPtDobgP2OTt0UkyAaj0n+ZHaqq1lH2yVfGUA1ILJv515
+C8BqbvVZuqm3i7ygmw3bqE/lYMgOrYtXXnqOrz6nvsE6Yc9V9rFflOM=
+-----END CERTIFICATE-----
diff --git a/lib-python/2.7/test/capath/ce7b8643.0 
b/lib-python/2.7/test/capath/ce7b8643.0
new file mode 100644
--- /dev/null
+++ b/lib-python/2.7/test/capath/ce7b8643.0
@@ -0,0 +1,16 @@
+-----BEGIN CERTIFICATE-----
+MIIClTCCAf6gAwIBAgIJAKGU95wKR8pTMA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV
+BAYTAlhZMRcwFQYDVQQHDA5DYXN0bGUgQW50aHJheDEjMCEGA1UECgwaUHl0aG9u
+IFNvZnR3YXJlIEZvdW5kYXRpb24xIzAhBgNVBAMMGnNlbGYtc2lnbmVkLnB5dGhv
+bnRlc3QubmV0MB4XDTE0MTEwMjE4MDkyOVoXDTI0MTAzMDE4MDkyOVowcDELMAkG
+A1UEBhMCWFkxFzAVBgNVBAcMDkNhc3RsZSBBbnRocmF4MSMwIQYDVQQKDBpQeXRo
+b24gU29mdHdhcmUgRm91bmRhdGlvbjEjMCEGA1UEAwwac2VsZi1zaWduZWQucHl0
+aG9udGVzdC5uZXQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANDXQXW9tjyZ
+Xt0Iv2tLL1+jinr4wGg36ioLDLFkMf+2Y1GL0v0BnKYG4N1OKlAU15LXGeGer8vm
+Sv/yIvmdrELvhAbbo3w4a9TMYQA4XkIVLdvu3mvNOAet+8PMJxn26dbDhG809ALv
+EHY57lQsBS3G59RZyBPVqAqmImWNJnVzAgMBAAGjNzA1MCUGA1UdEQQeMByCGnNl
+bGYtc2lnbmVkLnB5dGhvbnRlc3QubmV0MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcN
+AQEFBQADgYEAIuzAhgMouJpNdf3URCHIineyoSt6WK/9+eyUcjlKOrDoXNZaD72h
+TXMeKYoWvJyVcSLKL8ckPtDobgP2OTt0UkyAaj0n+ZHaqq1lH2yVfGUA1ILJv515
+C8BqbvVZuqm3i7ygmw3bqE/lYMgOrYtXXnqOrz6nvsE6Yc9V9rFflOM=
+-----END CERTIFICATE-----
diff --git a/lib-python/2.7/test/https_svn_python_org_root.pem 
b/lib-python/2.7/test/https_svn_python_org_root.pem
deleted file mode 100644
--- a/lib-python/2.7/test/https_svn_python_org_root.pem
+++ /dev/null
@@ -1,41 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIHPTCCBSWgAwIBAgIBADANBgkqhkiG9w0BAQQFADB5MRAwDgYDVQQKEwdSb290
-IENBMR4wHAYDVQQLExVodHRwOi8vd3d3LmNhY2VydC5vcmcxIjAgBgNVBAMTGUNB
-IENlcnQgU2lnbmluZyBBdXRob3JpdHkxITAfBgkqhkiG9w0BCQEWEnN1cHBvcnRA
-Y2FjZXJ0Lm9yZzAeFw0wMzAzMzAxMjI5NDlaFw0zMzAzMjkxMjI5NDlaMHkxEDAO
-BgNVBAoTB1Jvb3QgQ0ExHjAcBgNVBAsTFWh0dHA6Ly93d3cuY2FjZXJ0Lm9yZzEi
-MCAGA1UEAxMZQ0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJ
-ARYSc3VwcG9ydEBjYWNlcnQub3JnMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC
-CgKCAgEAziLA4kZ97DYoB1CW8qAzQIxL8TtmPzHlawI229Z89vGIj053NgVBlfkJ
-8BLPRoZzYLdufujAWGSuzbCtRRcMY/pnCujW0r8+55jE8Ez64AO7NV1sId6eINm6
-zWYyN3L69wj1x81YyY7nDl7qPv4coRQKFWyGhFtkZip6qUtTefWIonvuLwphK42y
-fk1WpRPs6tqSnqxEQR5YYGUFZvjARL3LlPdCfgv3ZWiYUQXw8wWRBB0bF4LsyFe7
-w2t6iPGwcswlWyCR7BYCEo8y6RcYSNDHBS4CMEK4JZwFaz+qOqfrU0j36NK2B5jc
-G8Y0f3/JHIJ6BVgrCFvzOKKrF11myZjXnhCLotLddJr3cQxyYN/Nb5gznZY0dj4k
-epKwDpUeb+agRThHqtdB7Uq3EvbXG4OKDy7YCbZZ16oE/9KTfWgu3YtLq1i6L43q
-laegw1SJpfvbi1EinbLDvhG+LJGGi5Z4rSDTii8aP8bQUWWHIbEZAWV/RRyH9XzQ
-QUxPKZgh/TMfdQwEUfoZd9vUFBzugcMd9Zi3aQaRIt0AUMyBMawSB3s42mhb5ivU
-fslfrejrckzzAeVLIL+aplfKkQABi6F1ITe1Yw1nPkZPcCBnzsXWWdsC4PDSy826
-YreQQejdIOQpvGQpQsgi3Hia/0PsmBsJUUtaWsJx8cTLc6nloQsCAwEAAaOCAc4w
-ggHKMB0GA1UdDgQWBBQWtTIb1Mfz4OaO873SsDrusjkY0TCBowYDVR0jBIGbMIGY
-gBQWtTIb1Mfz4OaO873SsDrusjkY0aF9pHsweTEQMA4GA1UEChMHUm9vdCBDQTEe
-MBwGA1UECxMVaHR0cDovL3d3dy5jYWNlcnQub3JnMSIwIAYDVQQDExlDQSBDZXJ0
-IFNpZ25pbmcgQXV0aG9yaXR5MSEwHwYJKoZIhvcNAQkBFhJzdXBwb3J0QGNhY2Vy
-dC5vcmeCAQAwDwYDVR0TAQH/BAUwAwEB/zAyBgNVHR8EKzApMCegJaAjhiFodHRw
-czovL3d3dy5jYWNlcnQub3JnL3Jldm9rZS5jcmwwMAYJYIZIAYb4QgEEBCMWIWh0
-dHBzOi8vd3d3LmNhY2VydC5vcmcvcmV2b2tlLmNybDA0BglghkgBhvhCAQgEJxYl
-aHR0cDovL3d3dy5jYWNlcnQub3JnL2luZGV4LnBocD9pZD0xMDBWBglghkgBhvhC
-AQ0ESRZHVG8gZ2V0IHlvdXIgb3duIGNlcnRpZmljYXRlIGZvciBGUkVFIGhlYWQg
-b3ZlciB0byBodHRwOi8vd3d3LmNhY2VydC5vcmcwDQYJKoZIhvcNAQEEBQADggIB
-ACjH7pyCArpcgBLKNQodgW+JapnM8mgPf6fhjViVPr3yBsOQWqy1YPaZQwGjiHCc
-nWKdpIevZ1gNMDY75q1I08t0AoZxPuIrA2jxNGJARjtT6ij0rPtmlVOKTV39O9lg
-18p5aTuxZZKmxoGCXJzN600BiqXfEVWqFcofN8CCmHBh22p8lqOOLlQ+TyGpkO/c
-gr/c6EWtTZBzCDyUZbAEmXZ/4rzCahWqlwQ3JNgelE5tDlG+1sSPypZt90Pf6DBl
-Jzt7u0NDY8RD97LsaMzhGY4i+5jhe1o+ATc7iwiwovOVThrLm82asduycPAtStvY
-sONvRUgzEv/+PDIqVPfE94rwiCPCR/5kenHA0R6mY7AHfqQv0wGP3J8rtsYIqQ+T
-SCX8Ev2fQtzzxD72V7DX3WnRBnc0CkvSyqD/HMaMyRa+xMwyN2hzXwj7UfdJUzYF
-CpUCTPJ5GhD22Dp1nPMd8aINcGeGG7MW9S/lpOt5hvk9C8JzC6WZrG/8Z7jlLwum
-GCSNe9FINSkYQKyTYOGWhlC0elnYjyELn8+CkcY7v2vcB5G5l1YjqrZslMZIBjzk
-zk6q5PYvCdxTby78dOs6Y5nCpqyJvKeyRKANihDjbPIky/qbn3BHLt4Ui9SyIAmW
-omTxJBzcoTWcFbLUvFUufQb1nA5V9FrWk9p2rSVzTMVD
------END CERTIFICATE-----
diff --git a/lib-python/2.7/test/selfsigned_pythontestdotnet.pem 
b/lib-python/2.7/test/selfsigned_pythontestdotnet.pem
--- a/lib-python/2.7/test/selfsigned_pythontestdotnet.pem
+++ b/lib-python/2.7/test/selfsigned_pythontestdotnet.pem
@@ -1,5 +1,5 @@
 -----BEGIN CERTIFICATE-----
-MIIChzCCAfCgAwIBAgIJAKGU95wKR8pSMA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV
+MIIClTCCAf6gAwIBAgIJAKGU95wKR8pTMA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV
 BAYTAlhZMRcwFQYDVQQHDA5DYXN0bGUgQW50aHJheDEjMCEGA1UECgwaUHl0aG9u
 IFNvZnR3YXJlIEZvdW5kYXRpb24xIzAhBgNVBAMMGnNlbGYtc2lnbmVkLnB5dGhv
 bnRlc3QubmV0MB4XDTE0MTEwMjE4MDkyOVoXDTI0MTAzMDE4MDkyOVowcDELMAkG
@@ -8,9 +8,9 @@
 aG9udGVzdC5uZXQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANDXQXW9tjyZ
 Xt0Iv2tLL1+jinr4wGg36ioLDLFkMf+2Y1GL0v0BnKYG4N1OKlAU15LXGeGer8vm
 Sv/yIvmdrELvhAbbo3w4a9TMYQA4XkIVLdvu3mvNOAet+8PMJxn26dbDhG809ALv
-EHY57lQsBS3G59RZyBPVqAqmImWNJnVzAgMBAAGjKTAnMCUGA1UdEQQeMByCGnNl
-bGYtc2lnbmVkLnB5dGhvbnRlc3QubmV0MA0GCSqGSIb3DQEBBQUAA4GBAIOXmdtM
-eG9qzP9TiXW/Gc/zI4cBfdCpC+Y4gOfC9bQUC7hefix4iO3+iZjgy3X/FaRxUUoV
-HKiXcXIaWqTSUWp45cSh0MbwZXudp6JIAptzdAhvvCrPKeC9i9GvxsPD4LtDAL97
-vSaxQBezA7hdxZd90/EeyMgVZgAnTCnvAWX9
+EHY57lQsBS3G59RZyBPVqAqmImWNJnVzAgMBAAGjNzA1MCUGA1UdEQQeMByCGnNl
+bGYtc2lnbmVkLnB5dGhvbnRlc3QubmV0MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcN
+AQEFBQADgYEAIuzAhgMouJpNdf3URCHIineyoSt6WK/9+eyUcjlKOrDoXNZaD72h
+TXMeKYoWvJyVcSLKL8ckPtDobgP2OTt0UkyAaj0n+ZHaqq1lH2yVfGUA1ILJv515
+C8BqbvVZuqm3i7ygmw3bqE/lYMgOrYtXXnqOrz6nvsE6Yc9V9rFflOM=
 -----END CERTIFICATE-----
diff --git a/lib-python/2.7/test/test_ssl.py b/lib-python/2.7/test/test_ssl.py
--- a/lib-python/2.7/test/test_ssl.py
+++ b/lib-python/2.7/test/test_ssl.py
@@ -57,7 +57,8 @@
 SIGNED_CERTFILE2 = data_file("keycert4.pem")
 SIGNING_CA = data_file("pycacert.pem")
 
-SVN_PYTHON_ORG_ROOT_CERT = data_file("https_svn_python_org_root.pem")
+REMOTE_HOST = "self-signed.pythontest.net"
+REMOTE_ROOT_CERT = data_file("selfsigned_pythontestdotnet.pem")
 
 EMPTYCERT = data_file("nullcert.pem")
 BADCERT = data_file("badcert.pem")
@@ -244,7 +245,7 @@
         self.assertEqual(p['subjectAltName'], san)
 
     def test_DER_to_PEM(self):
-        with open(SVN_PYTHON_ORG_ROOT_CERT, 'r') as f:
+        with open(CAFILE_CACERT, 'r') as f:
             pem = f.read()
         d1 = ssl.PEM_cert_to_DER_cert(pem)
         p2 = ssl.DER_cert_to_PEM_cert(d1)
@@ -792,7 +793,7 @@
         # Mismatching key and cert
         ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
         with self.assertRaisesRegexp(ssl.SSLError, "key values mismatch"):
-            ctx.load_cert_chain(SVN_PYTHON_ORG_ROOT_CERT, ONLYKEY)
+            ctx.load_cert_chain(CAFILE_CACERT, ONLYKEY)
         # Password protected key and cert
         ctx.load_cert_chain(CERTFILE_PROTECTED, password=KEY_PASSWORD)
         ctx.load_cert_chain(CERTFILE_PROTECTED, password=KEY_PASSWORD.encode())
@@ -1013,7 +1014,7 @@
         ctx.load_verify_locations(CERTFILE)
         self.assertEqual(ctx.cert_store_stats(),
             {'x509_ca': 0, 'crl': 0, 'x509': 1})
-        ctx.load_verify_locations(SVN_PYTHON_ORG_ROOT_CERT)
+        ctx.load_verify_locations(CAFILE_CACERT)
         self.assertEqual(ctx.cert_store_stats(),
             {'x509_ca': 1, 'crl': 0, 'x509': 2})
 
@@ -1023,8 +1024,8 @@
         # CERTFILE is not flagged as X509v3 Basic Constraints: CA:TRUE
         ctx.load_verify_locations(CERTFILE)
         self.assertEqual(ctx.get_ca_certs(), [])
-        # but SVN_PYTHON_ORG_ROOT_CERT is a CA cert
-        ctx.load_verify_locations(SVN_PYTHON_ORG_ROOT_CERT)
+        # but CAFILE_CACERT is a CA cert
+        ctx.load_verify_locations(CAFILE_CACERT)
         self.assertEqual(ctx.get_ca_certs(),
             [{'issuer': ((('organizationName', 'Root CA'),),
                          (('organizationalUnitName', 
'http://www.cacert.org'),),
@@ -1040,7 +1041,7 @@
                           (('emailAddress', 'supp...@cacert.org'),)),
               'version': 3}])
 
-        with open(SVN_PYTHON_ORG_ROOT_CERT) as f:
+        with open(CAFILE_CACERT) as f:
             pem = f.read()
         der = ssl.PEM_cert_to_DER_cert(pem)
         self.assertEqual(ctx.get_ca_certs(True), [der])
@@ -1215,11 +1216,11 @@
 class NetworkedTests(unittest.TestCase):
 
     def test_connect(self):
-        with support.transient_internet("svn.python.org"):
+        with support.transient_internet(REMOTE_HOST):
             s = ssl.wrap_socket(socket.socket(socket.AF_INET),
                                 cert_reqs=ssl.CERT_NONE)
             try:
-                s.connect(("svn.python.org", 443))
+                s.connect((REMOTE_HOST, 443))
                 self.assertEqual({}, s.getpeercert())
             finally:
                 s.close()
@@ -1228,27 +1229,27 @@
             s = ssl.wrap_socket(socket.socket(socket.AF_INET),
                                 cert_reqs=ssl.CERT_REQUIRED)
             self.assertRaisesRegexp(ssl.SSLError, "certificate verify failed",
-                                   s.connect, ("svn.python.org", 443))
+                                   s.connect, (REMOTE_HOST, 443))
             s.close()
 
             # this should succeed because we specify the root cert
             s = ssl.wrap_socket(socket.socket(socket.AF_INET),
                                 cert_reqs=ssl.CERT_REQUIRED,
-                                ca_certs=SVN_PYTHON_ORG_ROOT_CERT)
+                                ca_certs=REMOTE_ROOT_CERT)
             try:
-                s.connect(("svn.python.org", 443))
+                s.connect((REMOTE_HOST, 443))
                 self.assertTrue(s.getpeercert())
             finally:
                 s.close()
 
     def test_connect_ex(self):
         # Issue #11326: check connect_ex() implementation
-        with support.transient_internet("svn.python.org"):
+        with support.transient_internet(REMOTE_HOST):
             s = ssl.wrap_socket(socket.socket(socket.AF_INET),
                                 cert_reqs=ssl.CERT_REQUIRED,
-                                ca_certs=SVN_PYTHON_ORG_ROOT_CERT)
+                                ca_certs=REMOTE_ROOT_CERT)
             try:
-                self.assertEqual(0, s.connect_ex(("svn.python.org", 443)))
+                self.assertEqual(0, s.connect_ex((REMOTE_HOST, 443)))
                 self.assertTrue(s.getpeercert())
             finally:
                 s.close()
@@ -1256,14 +1257,14 @@
     def test_non_blocking_connect_ex(self):
         # Issue #11326: non-blocking connect_ex() should allow handshake
         # to proceed after the socket gets ready.
-        with support.transient_internet("svn.python.org"):
+        with support.transient_internet(REMOTE_HOST):
             s = ssl.wrap_socket(socket.socket(socket.AF_INET),
                                 cert_reqs=ssl.CERT_REQUIRED,
-                                ca_certs=SVN_PYTHON_ORG_ROOT_CERT,
+                                ca_certs=REMOTE_ROOT_CERT,
                                 do_handshake_on_connect=False)
             try:
                 s.setblocking(False)
-                rc = s.connect_ex(('svn.python.org', 443))
+                rc = s.connect_ex((REMOTE_HOST, 443))
                 # EWOULDBLOCK under Windows, EINPROGRESS elsewhere
                 self.assertIn(rc, (0, errno.EINPROGRESS, errno.EWOULDBLOCK))
                 # Wait for connect to finish
@@ -1285,58 +1286,62 @@
     def test_timeout_connect_ex(self):
         # Issue #12065: on a timeout, connect_ex() should return the original
         # errno (mimicking the behaviour of non-SSL sockets).
-        with support.transient_internet("svn.python.org"):
+        with support.transient_internet(REMOTE_HOST):
             s = ssl.wrap_socket(socket.socket(socket.AF_INET),
                                 cert_reqs=ssl.CERT_REQUIRED,
-                                ca_certs=SVN_PYTHON_ORG_ROOT_CERT,
+                                ca_certs=REMOTE_ROOT_CERT,
                                 do_handshake_on_connect=False)
             try:
                 s.settimeout(0.0000001)
-                rc = s.connect_ex(('svn.python.org', 443))
+                rc = s.connect_ex((REMOTE_HOST, 443))
                 if rc == 0:
-                    self.skipTest("svn.python.org responded too quickly")
+                    self.skipTest("REMOTE_HOST responded too quickly")
                 self.assertIn(rc, (errno.EAGAIN, errno.EWOULDBLOCK))
             finally:
                 s.close()
 
     def test_connect_ex_error(self):
-        with support.transient_internet("svn.python.org"):
+        with support.transient_internet(REMOTE_HOST):
             s = ssl.wrap_socket(socket.socket(socket.AF_INET),
                                 cert_reqs=ssl.CERT_REQUIRED,
-                                ca_certs=SVN_PYTHON_ORG_ROOT_CERT)
+                                ca_certs=REMOTE_ROOT_CERT)
             try:
-                rc = s.connect_ex(("svn.python.org", 444))
+                rc = s.connect_ex((REMOTE_HOST, 444))
                 # Issue #19919: Windows machines or VMs hosted on Windows
                 # machines sometimes return EWOULDBLOCK.
-                self.assertIn(rc, (errno.ECONNREFUSED, errno.EWOULDBLOCK))
+                errors = (
+                    errno.ECONNREFUSED, errno.EHOSTUNREACH, errno.ETIMEDOUT,
+                    errno.EWOULDBLOCK,
+                )
+                self.assertIn(rc, errors)
             finally:
                 s.close()
 
     def test_connect_with_context(self):
-        with support.transient_internet("svn.python.org"):
+        with support.transient_internet(REMOTE_HOST):
             # Same as test_connect, but with a separately created context
             ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
             s = ctx.wrap_socket(socket.socket(socket.AF_INET))
-            s.connect(("svn.python.org", 443))
+            s.connect((REMOTE_HOST, 443))
             try:
                 self.assertEqual({}, s.getpeercert())
             finally:
                 s.close()
             # Same with a server hostname
             s = ctx.wrap_socket(socket.socket(socket.AF_INET),
-                                server_hostname="svn.python.org")
-            s.connect(("svn.python.org", 443))
+                                server_hostname=REMOTE_HOST)
+            s.connect((REMOTE_HOST, 443))
             s.close()
             # This should fail because we have no verification certs
             ctx.verify_mode = ssl.CERT_REQUIRED
             s = ctx.wrap_socket(socket.socket(socket.AF_INET))
             self.assertRaisesRegexp(ssl.SSLError, "certificate verify failed",
-                                    s.connect, ("svn.python.org", 443))
+                                    s.connect, (REMOTE_HOST, 443))
             s.close()
             # This should succeed because we specify the root cert
-            ctx.load_verify_locations(SVN_PYTHON_ORG_ROOT_CERT)
+            ctx.load_verify_locations(REMOTE_ROOT_CERT)
             s = ctx.wrap_socket(socket.socket(socket.AF_INET))
-            s.connect(("svn.python.org", 443))
+            s.connect((REMOTE_HOST, 443))
             try:
                 cert = s.getpeercert()
                 self.assertTrue(cert)
@@ -1349,12 +1354,12 @@
         # OpenSSL 0.9.8n and 1.0.0, as a result the capath directory must
         # contain both versions of each certificate (same content, different
         # filename) for this test to be portable across OpenSSL releases.
-        with support.transient_internet("svn.python.org"):
+        with support.transient_internet(REMOTE_HOST):
             ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
             ctx.verify_mode = ssl.CERT_REQUIRED
             ctx.load_verify_locations(capath=CAPATH)
             s = ctx.wrap_socket(socket.socket(socket.AF_INET))
-            s.connect(("svn.python.org", 443))
+            s.connect((REMOTE_HOST, 443))
             try:
                 cert = s.getpeercert()
                 self.assertTrue(cert)
@@ -1365,7 +1370,7 @@
             ctx.verify_mode = ssl.CERT_REQUIRED
             ctx.load_verify_locations(capath=BYTES_CAPATH)
             s = ctx.wrap_socket(socket.socket(socket.AF_INET))
-            s.connect(("svn.python.org", 443))
+            s.connect((REMOTE_HOST, 443))
             try:
                 cert = s.getpeercert()
                 self.assertTrue(cert)
@@ -1373,15 +1378,15 @@
                 s.close()
 
     def test_connect_cadata(self):
-        with open(CAFILE_CACERT) as f:
+        with open(REMOTE_ROOT_CERT) as f:
             pem = f.read().decode('ascii')
         der = ssl.PEM_cert_to_DER_cert(pem)
-        with support.transient_internet("svn.python.org"):
+        with support.transient_internet(REMOTE_HOST):
             ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
             ctx.verify_mode = ssl.CERT_REQUIRED
             ctx.load_verify_locations(cadata=pem)
             with closing(ctx.wrap_socket(socket.socket(socket.AF_INET))) as s:
-                s.connect(("svn.python.org", 443))
+                s.connect((REMOTE_HOST, 443))
                 cert = s.getpeercert()
                 self.assertTrue(cert)
 
@@ -1390,7 +1395,7 @@
             ctx.verify_mode = ssl.CERT_REQUIRED
             ctx.load_verify_locations(cadata=der)
             with closing(ctx.wrap_socket(socket.socket(socket.AF_INET))) as s:
-                s.connect(("svn.python.org", 443))
+                s.connect((REMOTE_HOST, 443))
                 cert = s.getpeercert()
                 self.assertTrue(cert)
 
@@ -1399,9 +1404,9 @@
         # Issue #5238: creating a file-like object with makefile() shouldn't
         # delay closing the underlying "real socket" (here tested with its
         # file descriptor, hence skipping the test under Windows).
-        with support.transient_internet("svn.python.org"):
+        with support.transient_internet(REMOTE_HOST):
             ss = ssl.wrap_socket(socket.socket(socket.AF_INET))
-            ss.connect(("svn.python.org", 443))
+            ss.connect((REMOTE_HOST, 443))
             fd = ss.fileno()
             f = ss.makefile()
             f.close()
@@ -1415,9 +1420,9 @@
             self.assertEqual(e.exception.errno, errno.EBADF)
 
     def test_non_blocking_handshake(self):
-        with support.transient_internet("svn.python.org"):
+        with support.transient_internet(REMOTE_HOST):
             s = socket.socket(socket.AF_INET)
-            s.connect(("svn.python.org", 443))
+            s.connect((REMOTE_HOST, 443))
             s.setblocking(False)
             s = ssl.wrap_socket(s,
                                 cert_reqs=ssl.CERT_NONE,
@@ -1460,12 +1465,12 @@
                 if support.verbose:
                     sys.stdout.write("\nVerified certificate for %s:%s 
is\n%s\n" % (host, port ,pem))
 
-        _test_get_server_certificate('svn.python.org', 443, 
SVN_PYTHON_ORG_ROOT_CERT)
+        _test_get_server_certificate(REMOTE_HOST, 443, REMOTE_ROOT_CERT)
         if support.IPV6_ENABLED:
             _test_get_server_certificate('ipv6.google.com', 443)
 
     def test_ciphers(self):
-        remote = ("svn.python.org", 443)
+        remote = (REMOTE_HOST, 443)
         with support.transient_internet(remote[0]):
             with closing(ssl.wrap_socket(socket.socket(socket.AF_INET),
                                          cert_reqs=ssl.CERT_NONE, 
ciphers="ALL")) as s:
@@ -1510,13 +1515,13 @@
 
     def test_get_ca_certs_capath(self):
         # capath certs are loaded on request
-        with support.transient_internet("svn.python.org"):
+        with support.transient_internet(REMOTE_HOST):
             ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
             ctx.verify_mode = ssl.CERT_REQUIRED
             ctx.load_verify_locations(capath=CAPATH)
             self.assertEqual(ctx.get_ca_certs(), [])
             s = ctx.wrap_socket(socket.socket(socket.AF_INET))
-            s.connect(("svn.python.org", 443))
+            s.connect((REMOTE_HOST, 443))
             try:
                 cert = s.getpeercert()
                 self.assertTrue(cert)
@@ -1527,12 +1532,12 @@
     @needs_sni
     def test_context_setget(self):
         # Check that the context of a connected socket can be replaced.
-        with support.transient_internet("svn.python.org"):
+        with support.transient_internet(REMOTE_HOST):
             ctx1 = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
             ctx2 = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
             s = socket.socket(socket.AF_INET)
             with closing(ctx1.wrap_socket(s)) as ss:
-                ss.connect(("svn.python.org", 443))
+                ss.connect((REMOTE_HOST, 443))
                 self.assertIs(ss.context, ctx1)
                 self.assertIs(ss._sslobj.context, ctx1)
                 ss.context = ctx2
@@ -3026,7 +3031,7 @@
             pass
 
     for filename in [
-        CERTFILE, SVN_PYTHON_ORG_ROOT_CERT, BYTES_CERTFILE,
+        CERTFILE, REMOTE_ROOT_CERT, BYTES_CERTFILE,
         ONLYCERT, ONLYKEY, BYTES_ONLYCERT, BYTES_ONLYKEY,
         SIGNED_CERTFILE, SIGNED_CERTFILE2, SIGNING_CA,
         BADCERT, BADKEY, EMPTYCERT]:
diff --git a/lib_pypy/_pypy_testcapi.py b/lib_pypy/_pypy_testcapi.py
--- a/lib_pypy/_pypy_testcapi.py
+++ b/lib_pypy/_pypy_testcapi.py
@@ -7,6 +7,7 @@
         content = fid.read()
     # from cffi's Verifier()
     key = '\x00'.join([sys.version[:3], content])
+    key += 'cpyext-gc-support-2'   # this branch requires recompilation!
     if sys.version_info >= (3,):
         key = key.encode('utf-8')
     k1 = hex(binascii.crc32(key[0::2]) & 0xffffffff)
@@ -62,7 +63,7 @@
     if sys.platform == 'win32':
         # XXX pyconfig.h uses a pragma to link to the import library,
         #     which is currently python27.lib
-        library = os.path.join(thisdir, '..', 'include', 'python27')
+        library = os.path.join(thisdir, '..', 'libs', 'python27')
         if not os.path.exists(library + '.lib'):
             # For a local translation or nightly build
             library = os.path.join(thisdir, '..', 'pypy', 'goal', 'python27')
diff --git a/lib_pypy/cffi.egg-info/PKG-INFO b/lib_pypy/cffi.egg-info/PKG-INFO
--- a/lib_pypy/cffi.egg-info/PKG-INFO
+++ b/lib_pypy/cffi.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: cffi
-Version: 1.4.2
+Version: 1.5.2
 Summary: Foreign Function Interface for Python calling C code.
 Home-page: http://cffi.readthedocs.org
 Author: Armin Rigo, Maciej Fijalkowski
diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py
--- a/lib_pypy/cffi/__init__.py
+++ b/lib_pypy/cffi/__init__.py
@@ -4,8 +4,8 @@
 from .api import FFI, CDefError, FFIError
 from .ffiplatform import VerificationError, VerificationMissing
 
-__version__ = "1.4.2"
-__version_info__ = (1, 4, 2)
+__version__ = "1.5.2"
+__version_info__ = (1, 5, 2)
 
 # The verifier module file names are based on the CRC32 of a string that
 # contains the following version number.  It may be older than __version__
diff --git a/lib_pypy/cffi/_cffi_include.h b/lib_pypy/cffi/_cffi_include.h
--- a/lib_pypy/cffi/_cffi_include.h
+++ b/lib_pypy/cffi/_cffi_include.h
@@ -146,8 +146,9 @@
     ((Py_ssize_t(*)(CTypeDescrObject *, PyObject *, char **))_cffi_exports[23])
 #define _cffi_convert_array_from_object                                  \
     ((int(*)(char *, CTypeDescrObject *, PyObject *))_cffi_exports[24])
+#define _CFFI_CPIDX  25
 #define _cffi_call_python                                                \
-    ((void(*)(struct _cffi_externpy_s *, char *))_cffi_exports[25])
+    ((void(*)(struct _cffi_externpy_s *, char *))_cffi_exports[_CFFI_CPIDX])
 #define _CFFI_NUM_EXPORTS 26
 
 typedef struct _ctypedescr CTypeDescrObject;
@@ -206,7 +207,8 @@
 /**********  end CPython-specific section  **********/
 #else
 _CFFI_UNUSED_FN
-static void (*_cffi_call_python)(struct _cffi_externpy_s *, char *);
+static void (*_cffi_call_python_org)(struct _cffi_externpy_s *, char *);
+# define _cffi_call_python  _cffi_call_python_org
 #endif
 
 
@@ -229,6 +231,12 @@
     ((got_nonpos) == (expected <= 0) &&                 \
      (got) == (unsigned long long)expected)
 
+#ifdef MS_WIN32
+# define _cffi_stdcall  __stdcall
+#else
+# define _cffi_stdcall  /* nothing */
+#endif
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib_pypy/cffi/_embedding.h b/lib_pypy/cffi/_embedding.h
new file mode 100644
--- /dev/null
+++ b/lib_pypy/cffi/_embedding.h
@@ -0,0 +1,517 @@
+
+/***** Support code for embedding *****/
+
+#if defined(_MSC_VER)
+#  define CFFI_DLLEXPORT  __declspec(dllexport)
+#elif defined(__GNUC__)
+#  define CFFI_DLLEXPORT  __attribute__((visibility("default")))
+#else
+#  define CFFI_DLLEXPORT  /* nothing */
+#endif
+
+
+/* There are two global variables of type _cffi_call_python_fnptr:
+
+   * _cffi_call_python, which we declare just below, is the one called
+     by ``extern "Python"`` implementations.
+
+   * _cffi_call_python_org, which on CPython is actually part of the
+     _cffi_exports[] array, is the function pointer copied from
+     _cffi_backend.
+
+   After initialization is complete, both are equal.  However, the
+   first one remains equal to &_cffi_start_and_call_python until the
+   very end of initialization, when we are (or should be) sure that
+   concurrent threads also see a completely initialized world, and
+   only then is it changed.
+*/
+#undef _cffi_call_python
+typedef void (*_cffi_call_python_fnptr)(struct _cffi_externpy_s *, char *);
+static void _cffi_start_and_call_python(struct _cffi_externpy_s *, char *);
+static _cffi_call_python_fnptr _cffi_call_python = 
&_cffi_start_and_call_python;
+
+
+#ifndef _MSC_VER
+   /* --- Assuming a GCC not infinitely old --- */
+# define cffi_compare_and_swap(l,o,n)  __sync_bool_compare_and_swap(l,o,n)
+# define cffi_write_barrier()          __sync_synchronize()
+# if !defined(__amd64__) && !defined(__x86_64__) &&   \
+     !defined(__i386__) && !defined(__i386)
+#   define cffi_read_barrier()         __sync_synchronize()
+# else
+#   define cffi_read_barrier()         (void)0
+# endif
+#else
+   /* --- Windows threads version --- */
+# include <Windows.h>
+# define cffi_compare_and_swap(l,o,n) \
+                               (InterlockedCompareExchangePointer(l,n,o) == 
(o))
+# define cffi_write_barrier()       
InterlockedCompareExchange(&_cffi_dummy,0,0)
+# define cffi_read_barrier()           (void)0
+static volatile LONG _cffi_dummy;
+#endif
+
+#ifdef WITH_THREAD
+# ifndef _MSC_VER
+#  include <pthread.h>
+   static pthread_mutex_t _cffi_embed_startup_lock;
+# else
+   static CRITICAL_SECTION _cffi_embed_startup_lock;
+# endif
+  static char _cffi_embed_startup_lock_ready = 0;
+#endif
+
+static void _cffi_acquire_reentrant_mutex(void)
+{
+    static void *volatile lock = NULL;
+
+    while (!cffi_compare_and_swap(&lock, NULL, (void *)1)) {
+        /* should ideally do a spin loop instruction here, but
+           hard to do it portably and doesn't really matter I
+           think: pthread_mutex_init() should be very fast, and
+           this is only run at start-up anyway. */
+    }
+
+#ifdef WITH_THREAD
+    if (!_cffi_embed_startup_lock_ready) {
+# ifndef _MSC_VER
+        pthread_mutexattr_t attr;
+        pthread_mutexattr_init(&attr);
+        pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+        pthread_mutex_init(&_cffi_embed_startup_lock, &attr);
+# else
+        InitializeCriticalSection(&_cffi_embed_startup_lock);
+# endif
+        _cffi_embed_startup_lock_ready = 1;
+    }
+#endif
+
+    while (!cffi_compare_and_swap(&lock, (void *)1, NULL))
+        ;
+
+#ifndef _MSC_VER
+    pthread_mutex_lock(&_cffi_embed_startup_lock);
+#else
+    EnterCriticalSection(&_cffi_embed_startup_lock);
+#endif
+}
+
+static void _cffi_release_reentrant_mutex(void)
+{
+#ifndef _MSC_VER
+    pthread_mutex_unlock(&_cffi_embed_startup_lock);
+#else
+    LeaveCriticalSection(&_cffi_embed_startup_lock);
+#endif
+}
+
+
+/**********  CPython-specific section  **********/
+#ifndef PYPY_VERSION
+
+
+#define _cffi_call_python_org  _cffi_exports[_CFFI_CPIDX]
+
+PyMODINIT_FUNC _CFFI_PYTHON_STARTUP_FUNC(void);   /* forward */
+
+static void _cffi_py_initialize(void)
+{
+    /* XXX use initsigs=0, which "skips initialization registration of
+       signal handlers, which might be useful when Python is
+       embedded" according to the Python docs.  But review and think
+       if it should be a user-controllable setting.
+
+       XXX we should also give a way to write errors to a buffer
+       instead of to stderr.
+
+       XXX if importing 'site' fails, CPython (any version) calls
+       exit().  Should we try to work around this behavior here?
+    */
+    Py_InitializeEx(0);
+}
+
+static int _cffi_initialize_python(void)
+{
+    /* This initializes Python, imports _cffi_backend, and then the
+       present .dll/.so is set up as a CPython C extension module.
+    */
+    int result;
+    PyGILState_STATE state;
+    PyObject *pycode=NULL, *global_dict=NULL, *x;
+
+#if PY_MAJOR_VERSION >= 3
+    /* see comments in _cffi_carefully_make_gil() about the
+       Python2/Python3 difference 
+    */
+#else
+    /* Acquire the GIL.  We have no threadstate here.  If Python is 
+       already initialized, it is possible that there is already one
+       existing for this thread, but it is not made current now.
+    */
+    PyEval_AcquireLock();
+
+    _cffi_py_initialize();
+
+    /* The Py_InitializeEx() sometimes made a threadstate for us, but
+       not always.  Indeed Py_InitializeEx() could be called and do
+       nothing.  So do we have a threadstate, or not?  We don't know,
+       but we can replace it with NULL in all cases.
+    */
+    (void)PyThreadState_Swap(NULL);
+
+    /* Now we can release the GIL and re-acquire immediately using the
+       logic of PyGILState(), which handles making or installing the
+       correct threadstate.
+    */
+    PyEval_ReleaseLock();
+#endif
+    state = PyGILState_Ensure();
+
+    /* Call the initxxx() function from the present module.  It will
+       create and initialize us as a CPython extension module, instead
+       of letting the startup Python code do it---it might reimport
+       the same .dll/.so and get maybe confused on some platforms.
+       It might also have troubles locating the .dll/.so again for all
+       I know.
+    */
+    (void)_CFFI_PYTHON_STARTUP_FUNC();
+    if (PyErr_Occurred())
+        goto error;
+
+    /* Now run the Python code provided to ffi.embedding_init_code().
+     */
+    pycode = Py_CompileString(_CFFI_PYTHON_STARTUP_CODE,
+                              "<init code for '" _CFFI_MODULE_NAME "'>",
+                              Py_file_input);
+    if (pycode == NULL)
+        goto error;
+    global_dict = PyDict_New();
+    if (global_dict == NULL)
+        goto error;
+    if (PyDict_SetItemString(global_dict, "__builtins__",
+                             PyThreadState_GET()->interp->builtins) < 0)
+        goto error;
+    x = PyEval_EvalCode(
+#if PY_MAJOR_VERSION < 3
+                        (PyCodeObject *)
+#endif
+                        pycode, global_dict, global_dict);
+    if (x == NULL)
+        goto error;
+    Py_DECREF(x);
+
+    /* Done!  Now if we've been called from
+       _cffi_start_and_call_python() in an ``extern "Python"``, we can
+       only hope that the Python code did correctly set up the
+       corresponding @ffi.def_extern() function.  Otherwise, the
+       general logic of ``extern "Python"`` functions (inside the
+       _cffi_backend module) will find that the reference is still
+       missing and print an error.
+     */
+    result = 0;
+ done:
+    Py_XDECREF(pycode);
+    Py_XDECREF(global_dict);
+    PyGILState_Release(state);
+    return result;
+
+ error:;
+    {
+        /* Print as much information as potentially useful.
+           Debugging load-time failures with embedding is not fun
+        */
+        PyObject *exception, *v, *tb, *f, *modules, *mod;
+        PyErr_Fetch(&exception, &v, &tb);
+        if (exception != NULL) {
+            PyErr_NormalizeException(&exception, &v, &tb);
+            PyErr_Display(exception, v, tb);
+        }
+        Py_XDECREF(exception);
+        Py_XDECREF(v);
+        Py_XDECREF(tb);
+
+        f = PySys_GetObject((char *)"stderr");
+        if (f != NULL && f != Py_None) {
+            PyFile_WriteString("\nFrom: " _CFFI_MODULE_NAME
+                               "\ncompiled with cffi version: 1.5.2"
+                               "\n_cffi_backend module: ", f);
+            modules = PyImport_GetModuleDict();
+            mod = PyDict_GetItemString(modules, "_cffi_backend");
+            if (mod == NULL) {
+                PyFile_WriteString("not loaded", f);
+            }
+            else {
+                v = PyObject_GetAttrString(mod, "__file__");
+                PyFile_WriteObject(v, f, 0);
+                Py_XDECREF(v);
+            }
+            PyFile_WriteString("\nsys.path: ", f);
+            PyFile_WriteObject(PySys_GetObject((char *)"path"), f, 0);
+            PyFile_WriteString("\n\n", f);
+        }
+    }
+    result = -1;
+    goto done;
+}
+
+PyAPI_DATA(char *) _PyParser_TokenNames[];  /* from CPython */
+
+static int _cffi_carefully_make_gil(void)
+{
+    /* This does the basic initialization of Python.  It can be called
+       completely concurrently from unrelated threads.  It assumes
+       that we don't hold the GIL before (if it exists), and we don't
+       hold it afterwards.
+
+       What it really does is completely different in Python 2 and 
+       Python 3.
+
+    Python 2
+    ========
+
+       Initialize the GIL, without initializing the rest of Python,
+       by calling PyEval_InitThreads().
+
+       PyEval_InitThreads() must not be called concurrently at all.
+       So we use a global variable as a simple spin lock.  This global
+       variable must be from 'libpythonX.Y.so', not from this
+       cffi-based extension module, because it must be shared from
+       different cffi-based extension modules.  We choose
+       _PyParser_TokenNames[0] as a completely arbitrary pointer value
+       that is never written to.  The default is to point to the
+       string "ENDMARKER".  We change it temporarily to point to the
+       next character in that string.  (Yes, I know it's REALLY
+       obscure.)
+
+    Python 3
+    ========
+
+       In Python 3, PyEval_InitThreads() cannot be called before
+       Py_InitializeEx() any more.  So this function calls
+       Py_InitializeEx() first.  It uses the same obscure logic to
+       make sure we never call it concurrently.
+
+       Arguably, this is less good on the spinlock, because
+       Py_InitializeEx() takes much longer to run than
+       PyEval_InitThreads().  But I didn't find a way around it.
+    */
+
+#ifdef WITH_THREAD
+    char *volatile *lock = (char *volatile *)_PyParser_TokenNames;
+    char *old_value;
+
+    while (1) {    /* spin loop */
+        old_value = *lock;
+        if (old_value[0] == 'E') {
+            assert(old_value[1] == 'N');
+            if (cffi_compare_and_swap(lock, old_value, old_value + 1))
+                break;
+        }
+        else {
+            assert(old_value[0] == 'N');
+            /* should ideally do a spin loop instruction here, but
+               hard to do it portably and doesn't really matter I
+               think: PyEval_InitThreads() should be very fast, and
+               this is only run at start-up anyway. */
+        }
+    }
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+    /* Python 3: call Py_InitializeEx() */
+    {
+        PyGILState_STATE state = PyGILState_UNLOCKED;
+        if (!Py_IsInitialized())
+            _cffi_py_initialize();
+        else
+            state = PyGILState_Ensure();
+
+        PyEval_InitThreads();
+        PyGILState_Release(state);
+    }
+#else
+    /* Python 2: call PyEval_InitThreads() */
+# ifdef WITH_THREAD
+    if (!PyEval_ThreadsInitialized()) {
+        PyEval_InitThreads();    /* makes the GIL */
+        PyEval_ReleaseLock();    /* then release it */
+    }
+    /* else: there is already a GIL, but we still needed to do the
+       spinlock dance to make sure that we see it as fully ready */
+# endif
+#endif
+
+#ifdef WITH_THREAD
+    /* release the lock */
+    while (!cffi_compare_and_swap(lock, old_value + 1, old_value))
+        ;
+#endif
+
+    return 0;
+}
+
+/**********  end CPython-specific section  **********/
+
+
+#else
+
+
+/**********  PyPy-specific section  **********/
+
+PyMODINIT_FUNC _CFFI_PYTHON_STARTUP_FUNC(const void *[]);   /* forward */
+
+static struct _cffi_pypy_init_s {
+    const char *name;
+    void (*func)(const void *[]);
+    const char *code;
+} _cffi_pypy_init = {
+    _CFFI_MODULE_NAME,
+    _CFFI_PYTHON_STARTUP_FUNC,
+    _CFFI_PYTHON_STARTUP_CODE,
+};
+
+extern int pypy_carefully_make_gil(const char *);
+extern int pypy_init_embedded_cffi_module(int, struct _cffi_pypy_init_s *);
+
+static int _cffi_carefully_make_gil(void)
+{
+    return pypy_carefully_make_gil(_CFFI_MODULE_NAME);
+}
+
+static int _cffi_initialize_python(void)
+{
+    return pypy_init_embedded_cffi_module(0xB011, &_cffi_pypy_init);
+}
+
+/**********  end PyPy-specific section  **********/
+
+
+#endif
+
+
+#ifdef __GNUC__
+__attribute__((noinline))
+#endif
+static _cffi_call_python_fnptr _cffi_start_python(void)
+{
+    /* Delicate logic to initialize Python.  This function can be
+       called multiple times concurrently, e.g. when the process calls
+       its first ``extern "Python"`` functions in multiple threads at
+       once.  It can also be called recursively, in which case we must
+       ignore it.  We also have to consider what occurs if several
+       different cffi-based extensions reach this code in parallel
+       threads---it is a different copy of the code, then, and we
+       can't have any shared global variable unless it comes from
+       'libpythonX.Y.so'.
+
+       Idea:
+
+       * _cffi_carefully_make_gil(): "carefully" call
+         PyEval_InitThreads() (possibly with Py_InitializeEx() first).
+
+       * then we use a (local) custom lock to make sure that a call to this
+         cffi-based extension will wait if another call to the *same*
+         extension is running the initialization in another thread.
+         It is reentrant, so that a recursive call will not block, but
+         only one from a different thread.
+
+       * then we grab the GIL and (Python 2) we call Py_InitializeEx().
+         At this point, concurrent calls to Py_InitializeEx() are not
+         possible: we have the GIL.
+
+       * do the rest of the specific initialization, which may
+         temporarily release the GIL but not the custom lock.
+         Only release the custom lock when we are done.
+    */
+    static char called = 0;
+
+    if (_cffi_carefully_make_gil() != 0)
+        return NULL;
+
+    _cffi_acquire_reentrant_mutex();
+
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to