| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Some minor cleanups and simplifications to test_proxy.py:
- use loadTestsFromName() and wrap the conditional test in
@unittest.skipIf. This gets environments closer to running the same
number of tests, which helps when comparing to make sure nothing
gets skipped.
- Break compound assertions in test_coerce out into separate
assertions for ease of reading and debuging.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- We have u'literals' so we don't need a _u() function.
For the record the Emacs replacement regex was
`_u(\(['"]\)\([^)]*\)\1) -> u\1\2\1`. Amazingly, I typed that right
on the first try.
A few things were only used in one (test) file or function, so it was
better to keep the use, if any, local and out of the "public" api:
- We can use io.StringIO everywhere and it's fast. It was only
imported in one file anyway.
- We can just import pickle. It was only imported in one file anyway.
- TEXT was only used in one test function, `type(u'')` is just as
clear (especially since the usual name is `text_type`).
- reload was only used in one test function, so move the definition
there.
|
|\
| |
| | |
Fix TypeError handling for ProxyPy.
|
| |
| |
| |
| |
| |
| |
| | |
Also add additional tests clarifying how the str-to-repr fallthrough
works.
Fixes #7
|
| | |
|
|/
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
.items was. See #20 and #21.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
Hopefully. Appveyor should tell me if I've succeeded.
Fixes #17.
|
|\
| |
| |
| | |
into pypy-support
|
| |\
| | |
| | | |
Skip the failing class-hashing tests under PyPy 2.5.0. Fixes #11.
|
| | | |
|
| |/
|/|
| |
| | |
pure-python implementation. Fixes zopefoundation/zope.component#16.
|
|/ |
|
|
|
|
| |
doesn't fail interactively though.
|
|
|
|
| |
would be wrong under PyPy. See zopefoundation/zope.pagetemplate#4
|
|
|
|
| |
with zope.proxy 4.1.5
|
| |
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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?
|
| |
|
| |
|
| |
|
|
|
|
| |
Get the one test which failed under that environment to pass.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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!
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
_wrapped and _checker.
|
| |
|
|
|
|
|
|
|
|
|
| |
implementation does.
Implemented __coerce__() in a special way, since _check_name did not work
for some reason.
All tests pass on Python 2.7.
|
|
|
|
| |
version.
|
|
|
|
|
| |
The main work consisted of making sure that access is allowed and that
results are also proxied.
|
|
|
|
|
| |
those cases we do not want to fail with a cryptic error, but provide an
informative output.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
expectation.
|
|
|
|
|
| |
Python proxy implementation is affected. I am not sure why __eq__ is not
looked up during test output comparison with C-based proxies.
|
| |
|
|
|
|
| |
Some tests are still failing. :(
|
|\ |
|
| |
| |
| |
| |
| | |
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.
|
| | |
|
| |
| |
| |
| |
| | |
``zope.untrustedpython`` in ZTK 2.0. If BBB is really needed, we will create
a 3.10.0 release.
|
| | |
|
| |\ |
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
Dict views for keys(), items(), and values() are not proxied, making
dicts work in python3 exactly as python2.
|