Skip to content

Various fixes to lazy imports #22755

@jdemeyer

Description

@jdemeyer

Assorted fixes to lazy imports:

  1. Drop support for lazy_import(overwrite=False) which was used only in one place in a dubious way to implement a 2-level lazy import (a lazy import being lazily imported).

  2. More optimal code for binary operations like __add__ by avoiding the operator module.

  3. Move the code to replace a lazy import in a class namespace from _get_object() to __get__.

  4. Partially inline _get_object() with a new cdef inline function for the case that the object has been initialized.

  5. A lazy import without at_startup being imported at startup is now an error (it used to just print a message, which is less useful than an error traceback).

  6. Implement matmul (pointless in Python 2, but useful for Python 3).

  7. Clean up the function lazy_import a bit.

Component: misc

Author: Jeroen Demeyer

Branch/Commit: 4dda1ae

Reviewer: Vincent Delecroix

Issue created by migration from https://trac.sagemath.org/ticket/22755

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions