Skip to content

Commit

Permalink
More flexible wrapping for singletons.
Browse files Browse the repository at this point in the history
  • Loading branch information
shakefu committed Aug 4, 2015
1 parent ef53ace commit 90592a9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pytool/lang.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ class Test(object):
# Mirror original class
cls_name = klass.__name__
for attr in functools.WRAPPER_ASSIGNMENTS:
cls_dict[attr] = getattr(klass, attr)
if hasattr(klass, attr):
cls_dict[attr] = getattr(klass, attr)

# Make new method that controls singleton behavior
def __new__(cls, *args, **kwargs):
Expand Down

0 comments on commit 90592a9

Please sign in to comment.