[ZCM] [ZC] 1656/ 3 Resolve "Loop over enumeration builtin broken"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Tue Apr 5 16:49:05 EDT 2005


Issue #1656 Update (Resolve) "Loop over enumeration builtin broken"
 Status Resolved, Zope/bug medium
To followup, visit:
  http://www.zope.org/Collectors/Zope/1656

==============================================================
= Resolve - Entry #3 by tseaver on Apr 5, 2005 4:48 pm

 Status: Accepted => Resolved

SVN and HEAD and 2.8 are fortunately still the same.

  http://svn.zope.org/Zope/?sortby=date&view=rev&rev=29882
________________________________________
= Comment - Entry #2 by evan on Jan 7, 2005 5:06 pm

Fixes checked into the 2.7 branch.  I don't have SVN access set up, so can someone else apply to HEAD and 2.8?
________________________________________
= Request - Entry #1 by evan on Jan 7, 2005 5:01 pm

 Status: Pending => Accepted

 Supporters added: evan

The following all fail for me (raising Unauthorized):

  iter((1,)).next()
  enumerate((1,)).next()
  for k in iter((1,)): pass
  for i, k in enumerate((1,)): pass

SafeIter's signature doesn't match the builtin iter() -- the second argument is "container" with default None.

The first 'for' loop double-wraps with SafeIter, and the second ends up wrapping a raw iterator, which validate() doesn't like.

I'm replacing SafeIter almost everywhere with a guarded_iter() that tests whether its argument is already a SafeIter or NullIter (this is used to mark an iterator as safe), and only wraps if it isn't.  This has the side benefit of not exposing the SafeIter class to restricted code.

Next, I'm adding a security declaration to allow access to SafeIter.next().
==============================================================



More information about the Zope-Collector-Monitor mailing list