Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Acquisition
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Acquisition
Commits
e5253424
Commit
e5253424
authored
Mar 21, 2013
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't raise AttributeError for '__iter__' if fallback to '__getitem__' succeeds.
LP #1155760. Cherry-pick
7b5c5fd1
from master.
parent
87ae5171
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
0 deletions
+25
-0
CHANGES.txt
CHANGES.txt
+6
-0
src/Acquisition/_Acquisition.c
src/Acquisition/_Acquisition.c
+1
-0
src/Acquisition/tests.py
src/Acquisition/tests.py
+18
-0
No files found.
CHANGES.txt
View file @
e5253424
Changelog
=========
2.13.9 (unreleased)
-------------------
- Don't raise an attribute error for ``__iter__`` if the fallback to
``__getitem__`` succeeds. LP #1155760.
2.13.8 (2011-06-11)
-------------------
...
...
src/Acquisition/_Acquisition.c
View file @
e5253424
...
...
@@ -984,6 +984,7 @@ Wrapper_iter(Wrapper *self)
res
=
NULL
;
}
}
else
if
(
PySequence_Check
(
obj
))
{
PyErr_Clear
();
ASSIGN
(
res
,
PySeqIter_New
(
OBJECT
(
self
)));
}
else
{
res
=
PyErr_Format
(
PyExc_TypeError
,
"iteration over non-sequence"
);
...
...
src/Acquisition/tests.py
View file @
e5253424
...
...
@@ -2397,6 +2397,24 @@ def test___parent__aq_parent_circles():
"""
def
test__iter__after_AttributeError
():
""" See https://bugs.launchpad.net/zope2/+bug/1155760
>>> from Acquisition import Implicit
>>> class C(Implicit):
... l = [0, 1, 2, 3, 4]
... def __getitem__(self, i):
... return self.l[i]
>>> a = C()
>>> b = C().__of__(a)
>>> import time
>>> try:
... for n in b:
... t = time.gmtime()
... except AttributeError:
... raise
"""
import
unittest
from
doctest
import
DocTestSuite
,
DocFileSuite
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment