[ python-Bugs-942706 ] Python crash on __init__/__getattr__/__setattr__ interaction

SourceForge.net noreply at sourceforge.net
Mon Apr 26 19:39:19 EDT 2004


Bugs item #942706, was opened at 2004-04-26 23:39
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=942706&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: has (hhas)
Assigned to: Nobody/Anonymous (nobody)
Summary: Python crash on __init__/__getattr__/__setattr__ interaction

Initial Comment:
The following code causes [Mac]Python 2.3 process to crash 
(Bad!) rather than raise an error (good) when creating a new 
instance of Foo:

class Foo:
	def __init__(self):
		self.x = 1
	
	def __getattr__(self, name):
		if self.x:
			pass # etc...
	
	def __setattr__(self, name, val):
		if self.x:
			pass # etc...


(See <http://freespace.virgin.net/hamish.sanderson/
HTMLTemplate-0.4.0.tar.gz> for a working example plus general 
solution to the referencing-instance-var-before-it's-created 
paradox that threw up this bug in the first place.)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=942706&group_id=5470



More information about the Python-bugs-list mailing list