Author: Armin Rigo <[email protected]>
Branch: py3.5
Changeset: r91980:d7812755dc71
Date: 2017-07-27 17:25 +0200
http://bitbucket.org/pypy/pypy/changeset/d7812755dc71/
Log: This is how e71aec0042dd looks like in py3.5 (sorry, there are
likely conflicts and this is not solving them)
diff --git a/pypy/interpreter/function.py b/pypy/interpreter/function.py
--- a/pypy/interpreter/function.py
+++ b/pypy/interpreter/function.py
@@ -516,8 +516,9 @@
def __init__(self, space, w_function, w_instance):
self.space = space
+ assert w_instance is not None # unbound methods only exist in Python
2
self.w_function = w_function
- self.w_instance = w_instance # or None
+ self.w_instance = w_instance
def descr_method__new__(space, w_subtype, w_function, w_instance):
if space.is_w(w_instance, space.w_None):
@@ -577,24 +578,6 @@
return space.w_False
return space.newbool(space.eq_w(self.w_function, w_other.w_function))
- def is_w(self, space, other):
- if not isinstance(other, Method):
- return False
- return (self.w_instance is other.w_instance and
- self.w_function is other.w_function)
-
- def immutable_unique_id(self, space):
- from pypy.objspace.std.util import IDTAG_METHOD as tag
- from pypy.objspace.std.util import IDTAG_SHIFT
- if self.w_instance is not None:
- id = space.bigint_w(space.id(self.w_instance))
- id = id.lshift(LONG_BIT)
- else:
- id = rbigint.fromint(0)
- id = id.or_(space.bigint_w(space.id(self.w_function)))
- id = id.lshift(IDTAG_SHIFT).int_or_(tag)
- return space.newlong_from_rbigint(id)
-
def descr_method_hash(self):
space = self.space
w_result = space.hash(self.w_function)
@@ -606,7 +589,7 @@
from pypy.interpreter.gateway import BuiltinCode
w_mod = space.getbuiltinmodule('_pickle_support')
mod = space.interp_w(MixedModule, w_mod)
- w_instance = self.w_instance or space.w_None
+ w_instance = self.w_instance
w_function = self.w_function
if (isinstance(w_function, Function) and
isinstance(w_function.code, BuiltinCode)):
diff --git a/pypy/objspace/std/util.py b/pypy/objspace/std/util.py
--- a/pypy/objspace/std/util.py
+++ b/pypy/objspace/std/util.py
@@ -9,7 +9,6 @@
IDTAG_LONG = 3
IDTAG_FLOAT = 5
IDTAG_COMPLEX = 7
-IDTAG_METHOD = 9
IDTAG_SPECIAL = 11 # -1 - (-maxunicode-1): unichar
# 0 - 255: char
# 256: empty string
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit