From 80feaf57fcc826f55d037cabb393a48f5e460786 Mon Sep 17 00:00:00 2001 From: Nicolas Dandrimont Date: Fri, 11 Oct 2013 08:09:28 +0200 Subject: [PATCH] Make HyObject.replace more resilient This makes it work on quoted objects --- hy/models/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hy/models/__init__.py b/hy/models/__init__.py index 42032ca..31820f1 100644 --- a/hy/models/__init__.py +++ b/hy/models/__init__.py @@ -29,7 +29,7 @@ class HyObject(object): if isinstance(other, HyObject): for attr in ["start_line", "end_line", "start_column", "end_column"]: - if not hasattr(self, attr): + if not hasattr(self, attr) and hasattr(other, attr): setattr(self, attr, getattr(other, attr)) else: raise TypeError("Can't replace a non Hy object with a Hy object")