From: Mike Bayer Date: Thu, 20 Jan 2011 19:25:15 +0000 (-0500) Subject: - use types.MethodType here for python3 compat X-Git-Tag: rel_0_7b1~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79619c70e0cec3c9c210049679a7c0770bdcf56e;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - use types.MethodType here for python3 compat --- diff --git a/lib/sqlalchemy/ext/hybrid.py b/lib/sqlalchemy/ext/hybrid.py index 56abdabd82..4cf33ffa8b 100644 --- a/lib/sqlalchemy/ext/hybrid.py +++ b/lib/sqlalchemy/ext/hybrid.py @@ -289,7 +289,7 @@ SQL function to both sides:: """ from sqlalchemy import util from sqlalchemy.orm import attributes, interfaces -import new +types = __import__('types') class hybrid_method(object): """A decorator which allows definition of a Python object method with both @@ -320,9 +320,9 @@ class hybrid_method(object): def __get__(self, instance, owner): if instance is None: - return new.instancemethod(self.expr, owner, owner.__class__) + return types.MethodType(self.expr, owner, owner.__class__) else: - return new.instancemethod(self.func, instance, owner) + return types.MethodType(self.func, instance, owner) def expression(self, expr): """Provide a modifying decorator that defines a SQL-expression producing method."""