zopefoundation / zope.file

Other
1 stars 4 forks source link

Tests fail on Python 3.12 #13

Closed icemac closed 1 month ago

icemac commented 4 months ago

PROBLEM REPORT

What I did:

Run the tests on Python 3.12 via https://github.com/zopefoundation/zope.file/pull/12

What I expect to happen:

Succeeding tests.

What actually happened:

Test failures with forbidden attributes, see https://github.com/zopefoundation/zope.file/actions/runs/9379282834/job/25823967864?pr=12 for details

What version of Python and Zope/Addons I am using:

icemac commented 4 months ago

Note: This repository is not marked as maintained this means it can end up archived if no-one actually needs it.

icemac commented 1 month ago

@zopefoundation/developers Sorry for this brought call: Is someone still using zope.file and is there someone willing to look into the test failues for Python 3.12?

cjwatson commented 1 month ago

I think this may be a zope.security bug. On 3.11, type() of the read and write methods says <class 'builtin_function_or_method'>; on 3.12, it says <class 'builtin_method'>. But, on both versions, types.BuiltinFunctionType and types.BuiltinMethodType are both <class 'builtin_function_or_method'>. builtin_method is a subclass of builtin_function_or_method, but zope.security requires actual type identity.

IMO zope.security's _default_checkers needs tweaking. Somehow.

cjwatson commented 1 month ago

I haven't actually bisected, but just from blame, my guess is that this is a consequence of the refactoring in https://github.com/python/cpython/pull/104369.

icemac commented 1 month ago

@cjwatson Thank you for looking into this issue. Your changes in zope.security made GHA green. 🚀