From 5090f60fa83058aa03b1b76d2cbe71e952edc640 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Wed, 11 Oct 2006 23:32:28 +0000 Subject: [PATCH] Fix "_swig_property" fix to work with Python 2.1 as well. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9438 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Source/Modules/python.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/SWIG/Source/Modules/python.cxx b/SWIG/Source/Modules/python.cxx index 84a1a8b9b..85910d9a6 100644 --- a/SWIG/Source/Modules/python.cxx +++ b/SWIG/Source/Modules/python.cxx @@ -694,7 +694,12 @@ public: Printv(f_shadow,"import new\n",NULL); Printv(f_shadow,"new_instancemethod = new.instancemethod\n",NULL); if (modern || !classic) { - Printv(f_shadow, "_swig_property = property\n", NULL); + Printv(f_shadow, + "try:\n", + tab4, "_swig_property = property\n", + "except NameError:\n", + tab4, "pass # Python < 2.2 doesn't have 'property'.\n", + NULL); } /* if (!modern) */ /* always needed, a class can be forced to be no-modern, such as an exception */