[issue1303614] Bypassing __dict__ readonlyness

2008-01-24 Thread Guido van Rossum

Guido van Rossum added the comment:

On Jan 23, 2008 11:12 PM, Neal Norwitz [EMAIL PROTECTED] wrote:

 Neal Norwitz added the comment:

 I looked at Guido's latest deldict.diff patch--the one to
 Objects/object.c only.  It seems good.  I can't convince myself either
 way about the change to Objects/typeobject.c.  I can't think of a way
 to cause a problem.  It seems safer to use Py_CLEAR in this case
 though.

Here's my reasoning: the object whose dict is being cleared itself has
a refcount of zero at this point. So it is truly unreachable from
Python code. So I'm not going to submit that part of the change.

 There are several other uses of _PyObject_GetDictPtr in
 Objects/typeobject.c.  It was pretty much the same--I can't convince
 myself either way.  Can Py_VISIT cause any Python code to execute that
 might lead to a problem?

The answer lies in the gc module which does all the visiting. A quick
scan of all the traverse() calls there indicates that none of them
call back into Python -- not a DECREF in sight.

 The other uses of _PyObject_GetDictPtr in
 Objects/typeobject.c seemed safer.  Not a very useful review.

I reviewed those too and found them safe.

I'll submit the change now.

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1303614
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1303614] Bypassing __dict__ readonlyness

2008-01-24 Thread Guido van Rossum

Guido van Rossum added the comment:

r60247 (2.5.2 branch), r60246 (2.6 trunk).

--
resolution:  - fixed
status: open - closed

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1303614
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1303614] Bypassing __dict__ readonlyness

2008-01-23 Thread Guido van Rossum

Guido van Rossum added the comment:

Reopening, since test67.py still causes a segfault in the trunk.  It is
represented as Lib/test/crashers/loosing_dict_ref.py [sic].

--
nosy: +gvanrossum
priority: normal - urgent
status: closed - open

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1303614
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1303614] Bypassing __dict__ readonlyness

2008-01-23 Thread Guido van Rossum

Guido van Rossum added the comment:

Here's a better fix, which also fixes the similar code path in
GenericSetAttr().  As a bonus, I reviewed all uses of
_PyObject_GetDictPtr() and found one questionable place where the dict
at *dictptr was DECREF'ed before that location was set to NULL.  I think
we're better off setting it to NULL and *then* DECREF'ing the dict.

--
resolution: fixed - 
versions: +Python 2.5, Python 2.6

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1303614
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1303614] Bypassing __dict__ readonlyness

2008-01-23 Thread Guido van Rossum

Changes by Guido van Rossum:


Added file: http://bugs.python.org/file9275/deldict.diff

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1303614
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1303614] Bypassing __dict__ readonlyness

2008-01-23 Thread Guido van Rossum

Changes by Guido van Rossum:


Removed file: http://bugs.python.org/file9274/deldict.diff

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1303614
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1303614] Bypassing __dict__ readonlyness

2008-01-23 Thread Neal Norwitz

Changes by Neal Norwitz:


--
nosy: +nnorwitz

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1303614
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1303614] Bypassing __dict__ readonlyness

2008-01-23 Thread Guido van Rossum

Guido van Rossum added the comment:

The more i think about it, I don't think the issue in typeobject.c can
ever occur, so I'm skipping that part of the fix.

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1303614
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1303614] Bypassing __dict__ readonlyness

2008-01-23 Thread Adam Olsen

Changes by Adam Olsen:


--
nosy: +Rhamphoryncus

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1303614
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1303614] Bypassing __dict__ readonlyness

2008-01-23 Thread Neal Norwitz

Neal Norwitz added the comment:

I looked at Guido's latest deldict.diff patch--the one to
Objects/object.c only.  It seems good.  I can't convince myself either
way about the change to Objects/typeobject.c.  I can't think of a way
to cause a problem.  It seems safer to use Py_CLEAR in this case
though.

There are several other uses of _PyObject_GetDictPtr in
Objects/typeobject.c.  It was pretty much the same--I can't convince
myself either way.  Can Py_VISIT cause any Python code to execute that
might lead to a problem?  The other uses of _PyObject_GetDictPtr in
Objects/typeobject.c seemed safer.  Not a very useful review.

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1303614
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com