#27709 closed defect (fixed)

The attribute `_vector` of H and V representation is exposed

Reported by: jipilab Owned by:
Priority: major Milestone: sage-8.8
Component: geometry Keywords: polytopes
Cc: vdelecroix, jhpalmieri Merged in:
Authors: Jean-Philippe Labbé Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: d969c02 (Commits) Commit: d969c02c0ca60fcf8821b63cca5477d9cbe4dc0f
Dependencies: Stopgaps:

Description

Following the sage devel thread:

https://groups.google.com/forum/#!topic/sage-devel/iHvm9wfvr5g

The following code changes the internal attributes of V and H representations:

sage: C = polytopes.cube()
sage: C.vertices()[0].vector()[0] = 3
sage: C.vertices()[0]
A vertex at (3, -1, -1)

and:

sage: C.inequalities()[0].A()[2] = 5
sage: C.inequalities()[0]
An inequality (0, 0, 5) x + 1 >= 0

As mentioned in the __hash__ function of the file representation.py inside of the folder src/sage/geometry/polyhedron/, the attribute _vector is not immutable, due to the way it is constructed and its requirement to change in the current setup.

This ticket provides a small fix that creates a copy of the vectors.

Change History (10)

comment:1 Changed 11 months ago by jipilab

  • Branch set to u/jipilab/repr_exposed
  • Cc jhpalmieri added
  • Commit set to d969c02c0ca60fcf8821b63cca5477d9cbe4dc0f
  • Status changed from new to needs_review

New commits:

d969c02Fixed the exposed _vector

comment:2 Changed 11 months ago by git

  • Commit changed from d969c02c0ca60fcf8821b63cca5477d9cbe4dc0f to 8768f2eb32769bf8db3c0acfcc313dd8312117e8

Branch pushed to git repo; I updated commit sha1. New commits:

8768f2eRemoved old deprecation warnings

comment:3 Changed 11 months ago by vdelecroix

Please remove the deprecation in a distinct ticket.

comment:4 Changed 11 months ago by tscrim

  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to positive_review

LGTM.

comment:5 Changed 11 months ago by vbraun

  • Status changed from positive_review to needs_work

See patchbot

comment:6 Changed 11 months ago by tscrim

Whoops, we both missed a line.

comment:7 Changed 11 months ago by git

  • Commit changed from 8768f2eb32769bf8db3c0acfcc313dd8312117e8 to d969c02c0ca60fcf8821b63cca5477d9cbe4dc0f

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

comment:8 Changed 11 months ago by jipilab

  • Status changed from needs_work to needs_review

As suggested, I removed the deprecation warning removal from the branch.

The failing doctest is related to that.

comment:9 Changed 11 months ago by tscrim

  • Status changed from needs_review to positive_review

comment:10 Changed 11 months ago by vbraun

  • Branch changed from u/jipilab/repr_exposed to d969c02c0ca60fcf8821b63cca5477d9cbe4dc0f
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.