Skip to content

Better error handling of the polyhedron constructor for non-embedded NumberField and floats. #22605

@jplab

Description

@jplab

These error messages are not really informative of what the problem really is:


sage: K = NumberField(x^2-2,'s')
sage: s = K.0
sage: L = NumberField(x^3-2,'t')
sage: t = L.0
sage: P = Polyhedron(vertices = [[0,s],[t,0]])
Traceback (most recent call last):
...
AttributeError: 'Objects_with_category' object has no attribute 'is_exact'

similar problem with floats:


sage: f = float(1.1)
sage: f
1.1
sage: Polyhedron(vertices=[[f]])
Traceback (most recent call last):
...
AttributeError: type object 'float' has no attribute 'is_exact'

The constructor could try to detect the problem and return an informative message.

Once this is fixed, ticket #22552 is a follow-up ticket that should be fixed easily from the present resolution.

Depends on #23345

CC: @mo271 @mkoeppe @videlec @novoselt @sagetrac-tmonteil @tscrim

Component: geometry

Keywords: polyhedron, base ring

Author: Jean-Philippe Labbé, Vincent Delecroix, Marcelo Forets

Branch/Commit: af03de8

Reviewer: Vincent Delecroix

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions