diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-11-07 14:16:59 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-11-07 14:17:57 -0500 |
| commit | 89e748d7ad4426077313aaec916b41f999ae5a34 (patch) | |
| tree | d5482d7be6d6f69138bb45ad6b161876e8167bd0 | |
| parent | 8e486fa565bb91e3a21176bb029253e5f5544da4 (diff) | |
| download | sqlalchemy-89e748d7ad4426077313aaec916b41f999ae5a34.tar.gz | |
revert the code change part of the previous commit
Change-Id: I0af7b05fa00dbc706c66558873f4542d365acbc5
| -rw-r--r-- | lib/sqlalchemy/util/langhelpers.py | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py index bd10a33a6..8d6c2d8ee 100644 --- a/lib/sqlalchemy/util/langhelpers.py +++ b/lib/sqlalchemy/util/langhelpers.py @@ -235,17 +235,12 @@ def public_factory(target, location, class_location=None): location, ) ) - linked_to_target = target else: fn = callable_ = target doc = ( "This function is mirrored; see :func:`sqlalchemy%s` " "for a description of arguments." % location ) - if compat.py2k or hasattr(fn, "__func__"): - linked_to_target = fn.__func__ - else: - linked_to_target = fn location_name = location.split(".")[-1] spec = compat.inspect_getfullargspec(fn) @@ -263,8 +258,8 @@ def %(name)s(%(args)s): exec(code, env) decorated = env[location_name] - if hasattr(linked_to_target, "_linked_to"): - linked_to, linked_to_location = linked_to_target._linked_to + if hasattr(fn, "_linked_to"): + linked_to, linked_to_location = fn._linked_to linked_to_doc = linked_to.__doc__ if class_location is None: class_location = "%s.%s" % (target.__module__, target.__name__) @@ -290,13 +285,14 @@ def %(name)s(%(args)s): % (decorated.__module__,) ) - if not hasattr(linked_to_target, "_linked_to"): - linked_to_target._linked_to = (decorated, location) - if compat.py2k or hasattr(fn, "__func__"): fn.__func__.__doc__ = doc + if not hasattr(fn.__func__, "_linked_to"): + fn.__func__._linked_to = (decorated, location) else: fn.__doc__ = doc + if not hasattr(fn, "_linked_to"): + fn._linked_to = (decorated, location) return decorated |
