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
7b5c5fd1
Commit
7b5c5fd1
authored
Mar 21, 2013
by
Tres Seaver
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't raise AttributeError for '__iter__' if fallback to '__getitem__' succeeds.
LP #1155760.
parent
92677d60
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
0 deletions
+22
-0
CHANGES.txt
CHANGES.txt
+3
-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 @
7b5c5fd1
...
...
@@ -4,6 +4,9 @@ Changelog
4.0.1 (unreleased)
------------------
- Don't raise an attribute error for ``__iter__`` if the fallback to
``__getitem__`` succeeds. LP #1155760.
4.0 (2013-02-24)
----------------
...
...
src/Acquisition/_Acquisition.c
View file @
7b5c5fd1
...
...
@@ -994,6 +994,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 @
7b5c5fd1
...
...
@@ -2414,6 +2414,24 @@ def test_unwrapped_implicit_acquirer_unwraps__parent__():
True
"""
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
...
...
Kirill Smelkov
@kirr
mentioned in commit
e5253424
·
Sep 19, 2016
mentioned in commit
e5253424
mentioned in commit e5253424b59a48311f7f85ecace07b0555771532
Toggle commit list
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