Skip to content

Commit

Permalink
Merge 90ea12e into 9936469
Browse files Browse the repository at this point in the history
  • Loading branch information
sallner committed Nov 19, 2021
2 parents 9936469 + 90ea12e commit 070a20f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,9 @@ jobs:
if: ${{ !startsWith(matrix.python-version, 'pypy') }}
run: |
python -m coverage run -p -m zope.testrunner --test-path=src --auto-color --auto-progress
# This is not supported
# - name: Run tests without C extensions
# run:
# # coverage makes PyPy run about 3x slower!
# PURE_PYTHON=1 python -m coverage run -p -m zope.testrunner --test-path=src --auto-color --auto-progress
- name: Run tests without C extensions
run: |
AC_PURE_PYTHON=1 python -m coverage run -p -m zope.testrunner --test-path=src --auto-color --auto-progress
- name: Report Coverage
run: |
coverage combine
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ For changes before version 3.0, see ``HISTORY.rst``.

- Provide ``AccessControl.get_safe_globals`` to facilitate safe use.

- Use ``AC_PURE_PYTHON`` as switch to enable python implementation as default.
This should not be used except for tests and debugging.


5.2 (2021-07-30)
Expand Down
4 changes: 2 additions & 2 deletions src/AccessControl/ImplPython.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ def rolesForPermissionOn(perm, object, default=_default_roles, n=None):
roles = getattr(object, n)
if roles is None:
if _embed_permission_in_roles:
return ('Anonymous', n)
return 'Anonymous'
return (('Anonymous',), n)
return ('Anonymous',)

t = type(roles)
if t is tuple:
Expand Down
13 changes: 12 additions & 1 deletion src/AccessControl/Implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
"""
from __future__ import absolute_import
import os

# We cannot use `PURE_PYTHON` as this would be propagated to `ExtensionClass`
# and `Acquisition`. Due to restrictions of python implementation concerning
# proxies it is not possible to run all with pure python and we influence only
# the AccessControl implementation here.
CAPI = not int(os.environ.get('AC_PURE_PYTHON', '0'))


def getImplementationName():
Expand Down Expand Up @@ -96,7 +103,11 @@ def setImplementation(name):
),
}

setImplementation(_default_implementation)

if CAPI:
setImplementation(_default_implementation)
else:
setImplementation('PYTHON')

# allow the implementation to change from the default
_implementation_set = 0

0 comments on commit 070a20f

Please sign in to comment.