summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Allow iteration of all the custom itertools types.issue9Jason Madden2017-09-072-8/+101
|
* Fix issue 9: add default checkers for itertools.groupbyJason Madden2017-09-072-38/+64
| | | | | | | | | Also rename all the test classes in test_checker for consistency. I changed the test_suite function to not call them out by name and noticed the number of tests run dropped. At first I thought it had something to do with test class names or inheritance, so I made them all consistent. But it turned out that the manual list actually had some duplicates in it.
* Fix issue with __length_hint__ in pure Python 3. This is picked out of #29Jason Madden2017-09-071-1/+6
|
* Fix proxying of providedBy on Python 3 and fix __length_hint__Jason Madden2017-08-304-36/+219
| | | | | | | | | | | | | | | | | Fixes #27. Add special cases to defaultCheckers for the two types of objects that can be returned from zope.interface.providedBy. On Python 2, these were never proxied, but on Python 3 they were. Now it's consistent (they're never proxied). (Using an _iteratorChecker for them would be a breaking change because the results of iterating them would be security proxied interface objects that don't compare equally.) Also fix `__length_hint__` while we're at it. Previously it was ignored because it is looked up on the type of the object, and proxy didn't implement that. So implement it, and add it to the list of names allowed for iterators.
* OrderedDict, BTree and dict all iterate the same way.fix-ordered-dict-checkerJason Madden2017-05-172-29/+58
| | | | | | | | | | | Fixes #23. Also a further fix for #20 (you couldn't iterate a BTree all by itself). Refactor the test case for BTree to be a shared implementation and confirm that it works as expected for dict, using the actual dict checker. Then apply it to OrderedDict and BTree and fix the resulting failures by refactoring the fixup in checker.py to a shared implementation and applying it.
* Be specific that BTrees.keys and .values also are fixed in the same way that ↵issue20-extensionJason Madden2017-04-262-2/+9
| | | | .items was. See #20 and #21.
* Fix iteration of BTrees.items() in pure-python; and 3.6 supportJason Madden2017-04-242-7/+68
| | | | | | | | | | | | | | | Also fix ``list(proxy_btree.items())`` (or a list comprehension of the same) in Python 3, which wants the ``__len__`` for a hint. This is a central place to make sure these all behave consistently. Fixes #20 Also drop pypy3 As a 3.2 implementation, it's not supported by pip anymore. There is a much more recent version, 3.5-beta, but it's not on Travis yet. The 3.3-alpha which is on Travis is a dead end.
* Fix test failures on 64-bit WindowsMarius Gedminas2016-06-061-2/+4
| | | | | | Hopefully. Appveyor should tell me if I've succeeded. Fixes #17.
* Merge branch 'master' of https://github.com/zopefoundation/zope.security ↵Jason Madden2015-06-022-2/+2
|\ | | | | | | into pypy-support
| * Merge pull request #12 from NextThought/pypy-supportTres Seaver2015-06-021-0/+16
| |\ | | | | | | Skip the failing class-hashing tests under PyPy 2.5.0. Fixes #11.
| * | Fix 'py27-pure'/'py33-pure' tox environments.Tres Seaver2015-06-012-2/+2
| | |
* | | Make iteration over security-proxied items work under Python3 using the ↵Jason Madden2015-06-022-7/+15
| |/ |/| | | | | pure-python implementation. Fixes zopefoundation/zope.component#16.
* | Skip the failing class-hashing tests under PyPy 2.5.0. Fixes #11.Jason Madden2015-06-021-0/+16
|/
* Restore dict access of __builtins__ for non-PyPy. Interesting that it ↵Jason Madden2015-05-311-1/+4
| | | | doesn't fail interactively though.
* If the very first call to removeSecurityProxy was given a proxy, the results ↵Jason Madden2015-05-312-11/+27
| | | | would be wrong under PyPy. See zopefoundation/zope.pagetemplate#4
* Let z.s.checker.Global objects be pickled when security-proxied under PyPy ↵Jason Madden2015-05-271-3/+26
| | | | with zope.proxy 4.1.5
* Merge the two duplicated _fmt_address()Marius Gedminas2014-01-092-10/+3
|
* Try to make the tests pass on Windows, harderMarius Gedminas2014-01-081-1/+1
| | | | | Judging from http://winbot.zope.org/builders/zope.security_py_265_32/builds/1107/steps/test/logs/stdio the address is generated using upper-case hex digits.
* Typo in comment, PEP-8 spacing around assignmentMarius Gedminas2014-01-081-2/+2
|
* Allow public access to CheckerPublic.__module__Marius Gedminas2014-01-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Story time: when you pickle an object (call it obj) with a custom __reduce__ method that returns a string, the pickle module assumes this is a global and wants to know which module it came from. It obviously tries obj.__module__ first, but if that raises AttributeError, it has this insane fallback loop where it iterates over sys.modules.items() and for each module (excepting only __main__) checks if getattr(module, obj.__name__, None) is obj. Before my change if you tried >>> from zope.security.checker import CheckerPublic >>> CheckerPublic.__module__ you'd get ForbiddenAttribute: ('__module__', Global(CheckerPublic,zope.security.checker)) Until now it was just a silly inefficiency. But then six 1.5.0 was released with an interesting change: https://bitbucket.org/gutworth/six/commits/fc2decf405ea6bcd3226bb1b77069d2a2279e0b7 Now six puts these six.MovedModule() wrappers into sys.modules. When you try to access their attributes, the wrappers try to import random modules, including those that may not exist in your Python (_winreg on Linux? _tkinter also is often split off into a separate OS package). Boom: running zope.security's tests now fails in random ways: https://bitbucket.org/gutworth/six/issue/54/dependency-on-optional-tkinter-gdbm So let's make sure pickle doesn't need to iterate through sys.modules.items() and avoid the issue, m'kay?
* Fix typo in docstringMarius Gedminas2013-03-271-1/+1
|
* Bugfix: ZOPE_WATCH_CHECKERS=1 used to miss most of the checksMarius Gedminas2013-03-272-0/+14
|
* Fix a long-standing bug with ZOPE_WATCH_CHECKERS=2Marius Gedminas2013-03-272-1/+11
|
* Add test environments for the PURE_PYTHON environment variable.Tres Seaver2013-03-111-1/+5
| | | | Get the one test which failed under that environment to pass.
* - Make sure that __str__ and __repr__ never fail by catching all exceptionsStephan Richter2013-03-115-15/+22
| | | | | | | | | | | | | | | and using the custom fallback. (This is equivalent to the C Proxy behavior.) - Allow __getslice__ and __setslice__ to access the original object's implementation instead of always falling back to __getitem__ and __setitem__. Do we really want to support this or just remove the test? (It is deprecated this Python 2.0!) - Make sure that Checker.set_permissions is set initiated as an empty dict, if not provided. While not immediately obvious, this is the C-based checker behavior as well. Oh yeah, all tests pass now on py26, py27, py32, py33, and pypy!
* Changed strategy to hide wrapped to not use the secret anymore, but lookStephan Richter2013-03-114-59/+80
| | | | | | | | | | at the frames. This fixes a bunch of issues when actually doing binary ops (for which I added a test now). __len__ must return a non-proxied object, so I added a new parameter to the name check wrapper to handle that case. Fixed all but 12 test failures on PyPy.
* Actually made the security proxy secure by not allowing access toStephan Richter2013-03-112-15/+30
| | | | _wrapped and _checker.
* Start of PyPy support.Stephan Richter2013-03-115-17/+34
|
* Implemented rich comparison operators as non-checked, which is what the CStephan Richter2013-03-101-16/+65
| | | | | | | | | implementation does. Implemented __coerce__() in a special way, since _check_name did not work for some reason. All tests pass on Python 2.7.
* Change the test expectation that was failing for the C and Py proxyStephan Richter2013-03-101-1/+1
| | | | version.
* Fixed all attr access: __getattr__, __setattr__, __delattr__.Stephan Richter2013-03-101-2/+11
| | | | | The main work consisted of making sure that access is allowed and that results are also proxied.
* Implemented proper handling when __str__ and __repr__ are not allowed. InStephan Richter2013-03-102-4/+32
| | | | | those cases we do not want to fail with a cryptic error, but provide an informative output.
* Fixed power tests by disabling the ones for PyProxy that expectedStephan Richter2013-03-101-12/+25
| | | | | | | | | | | | behavior that cannot be created with a pure Python proxy implementation. Undid one previous checking where the DummyChecker only records the first checked name. In several forbidden tests, add a few allowed names, since those are needed to make the tests pass. In the Python version of the proxy, some __<name>__ methods are used where the C implementation gets away without them.
* Make sure we use the API to create a new proxy. The tests depend on thatStephan Richter2013-03-101-1/+1
| | | | expectation.
* Avoid overwriting of checked name when tests compare. Strangely, only theStephan Richter2013-03-081-1/+5
| | | | | Python proxy implementation is affected. I am not sure why __eq__ is not looked up during test output comparison with C-based proxies.
* I think I fixed some tests. Tres, can you review?Stephan Richter2013-03-082-4/+4
|
* Restore 100% coverage.Tres Seaver2013-03-082-3/+34
| | | | Some tests are still failing. :(
* Merge branch 'master' into pure_python_proxyTres Seaver2013-03-087-23/+57
|\
| * Fix ImportError: cannot import name _checkersMarius Gedminas2013-03-081-5/+6
| | | | | | | | | | The problem was a local variable `m` was being clobbered by importing 3rd party modules between the new location of MOD_DEF() and actual use.
| * Fix build error with MSVC++ on Python 3Adam Groszer2013-03-072-12/+12
| |
| * - Remove ``untrustedpython`` extra again, since we do not want to supportStephan Richter2013-02-284-83/+0
| | | | | | | | | | ``zope.untrustedpython`` in ZTK 2.0. If BBB is really needed, we will create a 3.10.0 release.
| * Python-3.3 compatibility for examplesAndrey Lebedev2013-02-201-1/+1
| |
| * Merge branch 'moretests'Andrey Lebedev2013-02-192-3/+24
| |\
| | * Use python3.3 to run documentation testsmoretestsAndrey Lebedev2013-02-191-2/+2
| | |
| | * Dictionary views are not proxiedAndrey Lebedev2013-02-191-1/+5
| | | | | | | | | | | | | | | Dict views for keys(), items(), and values() are not proxied, making dicts work in python3 exactly as python2.
| | * More tests are running under python-3Andrey Lebedev2013-02-191-1/+18
| | | | | | | | | | | | | | | | | | Include documentation doctests into main test suite. Documentation is updated to be valid under python-3 and some critical bugs in python-3 are revealed.
| * | Try to make the tests pass on WindowsMarius Gedminas2013-02-191-2/+14
| |/
| * Fix test breakage under 4.0.0a2 due to deprecation strategy.Tres Seaver2013-02-154-16/+28
| |
| * Restore deprecated BBB imports of z.s.untrustedpython modules.Tres Seaver2013-02-154-0/+71
| |
| * Fix nondeterministic test failuresMarius Gedminas2013-02-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | This fixes three test failures I've seen on Python 3.3: test_allow_w_single_interface test_require_w_set_schema_normal_fields test_require_w_single_interface All caused by dictionary iteration returning items in a different order than the test expected.