]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.2/Lib/test/crashers/nasty_eq_vs_dict.py
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Lib / test / crashers / nasty_eq_vs_dict.py
diff --git a/AppPkg/Applications/Python/Python-2.7.2/Lib/test/crashers/nasty_eq_vs_dict.py b/AppPkg/Applications/Python/Python-2.7.2/Lib/test/crashers/nasty_eq_vs_dict.py
deleted file mode 100644 (file)
index 20afeec..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-# from http://mail.python.org/pipermail/python-dev/2001-June/015239.html\r
-\r
-# if you keep changing a dictionary while looking up a key, you can\r
-# provoke an infinite recursion in C\r
-\r
-# At the time neither Tim nor Michael could be bothered to think of a\r
-# way to fix it.\r
-\r
-class Yuck:\r
-    def __init__(self):\r
-        self.i = 0\r
-\r
-    def make_dangerous(self):\r
-        self.i = 1\r
-\r
-    def __hash__(self):\r
-        # direct to slot 4 in table of size 8; slot 12 when size 16\r
-        return 4 + 8\r
-\r
-    def __eq__(self, other):\r
-        if self.i == 0:\r
-            # leave dict alone\r
-            pass\r
-        elif self.i == 1:\r
-            # fiddle to 16 slots\r
-            self.__fill_dict(6)\r
-            self.i = 2\r
-        else:\r
-            # fiddle to 8 slots\r
-            self.__fill_dict(4)\r
-            self.i = 1\r
-\r
-        return 1\r
-\r
-    def __fill_dict(self, n):\r
-        self.i = 0\r
-        dict.clear()\r
-        for i in range(n):\r
-            dict[i] = i\r
-        dict[self] = "OK!"\r
-\r
-y = Yuck()\r
-dict = {y: "OK!"}\r
-\r
-z = Yuck()\r
-y.make_dangerous()\r
-print dict[z]\r