[PEAK] Re: Trellis + Python 2.6

Sergey Schetinin maluke at gmail.com
Tue Nov 18 17:55:06 EST 2008


Oh I'm sorry for this, I completely missed that I'm not using
trellis.Set anymore, so my checks didn't test that at all. So not
importing the sets module is completely wrong. An equivalent of
sets.Set doesn't seem to be available in py2.6 from a non-deprecated
module, so this can either be resolved by copying the relevant parts
of Set implementation into trellis or adding a
warnings.simplefilter('ignore', ...), which one would you prefer?

On Wed, Nov 19, 2008 at 00:24, Phillip J. Eby <pje at telecommunity.com> wrote:
> I would be rather surprised if this patch is actually working correctly for
> any Python version (except ones with no built-in 'set' type).  The reason
> trellis.Set inherits from sets.Set is because I rely on some of the base
> class methods to call inherited methods; it seems rather unlikely that this
> constraint is kept to by the C version of the set type.
>
> Have you tried, e.g., iterating over a Set that inherits from 'set' and
> seeing whether that actually creates a dependency on the object, for
> example?  trellis.Set inherits __iter__ from its base class, expecting that
> it will iterate the ._data attribute.  This would be the sort of thing I'd
> expect to fail.
>
> Hm, in fact, a quick test of your patch shows that it fails on this line
> anyway:
>
>            sets.Set._update(self, iterable)
>
> Because even if you change this to a super call or use set._update, there is
> no such method on C set objects.
>
> At 11:04 PM 11/18/2008 +0200, Sergey Schetinin wrote:
>>
>> Here's the patch. I also left two more changes in:
>>  - cancel the rule if assigned
>>  - log undo for new Component cells
>>
>> On Tue, Nov 18, 2008 at 20:23, Sergey Schetinin <maluke at gmail.com> wrote:
>> > I've only checked with python 2.5, but it should work with others too,
>> > because it basically only chages where things are imported etc. I'll
>> > send it when I get to my desktop.
>> >
>> > On Tue, Nov 18, 2008 at 18:10, Phillip J. Eby <pje at telecommunity.com>
>> > wrote:
>> >> At 01:25 PM 11/18/2008 +0200, Sergey Schetinin wrote:
>> >>>
>> >>> > Issue 1:
>> >>> > UserList.UserList now has a metaclass, so trellis.List needs to
>> >>> > redefine its metaclass to inherit from it
>> >>>
>> >>> > Issue 2:
>> >>> > trellis.py imports `sets` module which is deprecated and results in
>> >>> > a
>> >>> > warning.
>> >>>
>> >>> Issue 3:
>> >>>
>> >>> peak\events\trellis.py:511: DeprecationWarning: object.__new__() takes
>> >>> no parameters
>> >>>  return ReadOnlyCell.__new__(cls, rule, value, discrete)
>> >>>
>> >>>
>> >>> If you don't have py2.6 installed, let me know and I'll send the patch
>> >>> with relevant changes.
>> >>
>> >> Does your patch still work with older Pythons?
>
>



-- 
Best Regards,
Sergey Schetinin

http://s3bk.com/ -- S3 Backup
http://word-to-html.com/ -- Word to HTML Converter



More information about the PEAK mailing list