Opened 11 months ago
Closed 11 months ago
#27709 closed defect (fixed)
The attribute `_vector` of H and V representation is exposed
Reported by:  jipilab  Owned by:  

Priority:  major  Milestone:  sage8.8 
Component:  geometry  Keywords:  polytopes 
Cc:  vdelecroix, jhpalmieri  Merged in:  
Authors:  JeanPhilippe 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/sagedevel/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
 Branch set to u/jipilab/repr_exposed
 Cc jhpalmieri added
 Commit set to d969c02c0ca60fcf8821b63cca5477d9cbe4dc0f
 Status changed from new to needs_review
comment:2 Changed 11 months ago by
 Commit changed from d969c02c0ca60fcf8821b63cca5477d9cbe4dc0f to 8768f2eb32769bf8db3c0acfcc313dd8312117e8
Branch pushed to git repo; I updated commit sha1. New commits:
8768f2e  Removed old deprecation warnings

comment:3 Changed 11 months ago by
Please remove the deprecation in a distinct ticket.
comment:4 Changed 11 months ago by
 Reviewers set to Travis Scrimshaw
 Status changed from needs_review to positive_review
LGTM.
comment:6 Changed 11 months ago by
Whoops, we both missed a line.
comment:7 Changed 11 months ago by
 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
 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
 Status changed from needs_review to positive_review
comment:10 Changed 11 months ago by
 Branch changed from u/jipilab/repr_exposed to d969c02c0ca60fcf8821b63cca5477d9cbe4dc0f
 Resolution set to fixed
 Status changed from positive_review to closed
New commits:
Fixed the exposed _vector