You are not logged in Log in Join
You are here: Home » Members » Brian » Python For .NET » Python for .NET Issue Tracker » ClassObject.tp_new can mask constructor exceptions » dc_view

Log in
Name

Password

 
 


Dublin Core Elements

The Dublin Core metadata element set is a standard for cross-domain information resource description.
Element Description Value
Identifier resource ID http://old.zope.org/Members/Brian/PythonNet/Collector/15
Title resource name ClassObject.tp_new can mask constructor exceptions
Description resource summary This: >>> from CLR.System.Drawing import Font >>> Font("Verdana", 0.0) raises a TypeError ("no constructor matches given arguments") even though there is a Font(String, Single) constructor overload. I believe the problem is in ClassObject.tp_new. It assumes that if the call to binder.InvokeRaw returns null, it means no matching overload was found. However, in the above case, the constructor raises an ArgumentException, which is then lost by the attempt to call the default constructor (since Font doesn't have a default constructor, it raises the TypeError). (Also, I note that the attempt to call the default constructor is passing in the kw parameter; if keywords are going to be supported in PythonNet method calls, it would probably be better to pass IntPtr.Zero).
Creator resource creator glchapman
Date default date 2005-07-26 14:47:09
Format resource format text/html
Type resource type Collector Issue
Subject resource keywords General, bug, medium
Contributors resource collaborators
Language resource language
Publisher resource publisher No publisher
Rights resource copyright


Additional Zope Elements

Element Description Value
CreationDate date resource created 2005-07-26 14:47:06
ModificationDate date resource last modified 2005-07-26 14:47:09
EffectiveDate date resource becomes effective None
ExpirationDate date resource expires None

Backlinks: via Google / Technorati