This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: object.__new__ too dangerous
Type: Stage:
Components: Interpreter Core Versions: Python 2.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: gvanrossum, skip.montanaro
Priority: normal Keywords:

Created on 2001-08-19 05:47 by gvanrossum, last changed 2022-04-10 16:04 by admin. This issue is now closed.

Messages (3)
msg6048 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2001-08-19 05:47
object.__new__(type) or object.__new__(dictionary)
creates insufficiently initialized objects. Not clear
what to do about that -- this is supposed to be called
only from a subclass constructor, but how do I verify
that?
msg6049 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2001-08-19 06:07
Logged In: YES 
user_id=44345

(Just thinking out loud before I trundle off to bed...)

Can you call (the equivalent of) sys._getframe, then from
there work your way back to a method object and check that
the method is named __init__ and that its first argument is
an instance of a subclass of object?  Sounds messy.
msg6050 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2001-08-19 06:58
Logged In: YES 
user_id=6380

Fortunately, I figured a better check. Read the code I added
to tp_new_wrapper().
History
Date User Action Args
2022-04-10 16:04:20adminsetgithub: 35002
2001-08-19 05:47:52gvanrossumcreate