Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compat: Python 3.8 no longer tolerates embezzling __classcell__ attrib
While this is highly internal thing, it seems that whenever Python's semantic analyzer hits __class__ or super(), it will arrange for injecting said new (rather internal) attribute towards __new__() material instantiation of the the class as defined within respective metaclass. Then, when either of these will get effectively called, presence of said attribute is checked. Until 3.8, this was just warning-worth, but with 3.8, it becomes a hard error. In our case, (least resistance) solution is to simply refrain from using either of those built-in constructs -- in fact, we don't really need them(!). Also the all-time explanatory guard is added for a good measure. Note that this may not be hit in casual run of clufter, but it certainly was the case in the test suite, where the already prepared objects are asked once again and hence our harness intercepting such repeated requests and avoiding thus unnecessary computations kicks in. Error sample (./run-tests command_manager filter_manager): ERROR:clufter.plugin_registry:Module load error: <_io.TextIOWrapper name='/clufter/formats/simpleconfig.py' mode='r' encoding='utf-8'>: __class__ not set defining 'simpleconfig' as <class 'clufter.formats.simpleconfig.simpleconfig'>. Was __classcell__ propagated to type.__new__? References: https://docs.python.org/3/whatsnew/3.6.html#pep-487-simpler-customization-of-class-creation https://docs.python.org/3/whatsnew/3.8.html#changes-in-the-python-api python/cpython@f5e7b19 Signed-off-by: Jan Pokorný <[email protected]>
- Loading branch information