Skip to content

"v52.betas.to52beta1" puts the Python import machinery in an inconsistent state #245

Description

@d-maurer

Python 2.7, plone.app.upgrade==2.0.34, Products.ResourceRegistries installed:
After the call of to52beta1 import Products.ResourceRegistries fails with cannot import name "config" - even though config.py exists in Products.ResourceRegistries.

The reason: to52beta1 hacks the Python import machinery and brings it into an inconsistent state regarding Products.ResourceRegistries. The import machinery raises an ImportError for from m import n if n happens to be a module in sys.modules and is not an attribute of m. to52beta1 deletes Products.ResourceRegistries but lets Products.ResourceRegistries.config in sys.modules -- causing the inconsistency and the error above.

I recommend to remove all modules related to Products.ResourceRegistries from sys.modules in v52beta1 to properly clean up after the import machinery hack.

In recent versions (e.g. plone.app.upgrade==2.0.34), to52beta1 has got at its end an install_product('plone.staticresources'). This fails for us with the ImportError above (due to the import machinery inconsistency). Apparently, this ImportError is hidden by upper layers of the upgrade machinery (this likely should not happen).

The problems possibly only occur if Products.ResourceRegistries is installed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions