Ticket #11424 (closed defect: fixed)

Opened 2 years ago

Last modified 22 months ago

Build Integer from Unicode

Reported by: vdelecroix Owned by: vdelecroix
Priority: major Milestone: sage-4.7.2
Component: basic arithmetic Keywords: Integer, unicode
Cc: Work issues:
Report Upstream: N/A Reviewers: Mariah Lenox
Authors: Vincent Delecroix Merged in: sage-4.7.2.alpha1
Dependencies: Stopgaps:

Description (last modified by vdelecroix) (diff)

Currently, Sage fails to build Integer from Unicode

sage: Integer(u'1')
TypeError Traceback (most recent call last)
...
TypeError: unable to coerce <type 'unicode'> to an integer

The two lines patch attached to this ticket, allow such feature

sage: Integer(u'1')
1
sage: Integer(u'0X13')
19

Attachments

trac_11424-unicode_to_integer.patch Download (1.9 KB) - added by vdelecroix 2 years ago.

Change History

comment:1 Changed 2 years ago by vdelecroix

  • Status changed from new to needs_review

comment:2 Changed 2 years ago by mariah

  • Status changed from needs_review to positive_review
  • Reviewers set to Mariah Lenox

Patch fixes the reported problem. Did 'make testlong' and all tests passed. Positive review!

comment:3 follow-up: ↓ 4 Changed 2 years ago by jdemeyer

  • Status changed from positive_review to needs_work
  1. The commit message of the patch should be changed.
  2. Could you give a less trivial example in the doctest? At least something with more than one digit and something hexadecimal (Integer(u'0x2A')) or so...

Changed 2 years ago by vdelecroix

comment:4 in reply to: ↑ 3 Changed 2 years ago by vdelecroix

  • Status changed from needs_work to needs_review
  • Description modified (diff)

Replying to jdemeyer:

Thanks for comment.

  1. The commit message of the patch should be changed.

I add the number of the ticket and a short description.

  1. Could you give a less trivial example in the doctest? At least something with more than one digit and something hexadecimal (Integer(u'0x2A')) or so...

Done.

comment:5 Changed 2 years ago by mariah

  • Status changed from needs_review to positive_review

Applied patch, did 'sage -b' and 'make testlong'. All tests passed. Positive review!

comment:6 Changed 2 years ago by jdemeyer

  • Milestone changed from sage-4.7.1 to sage-4.7.2

comment:7 Changed 22 months ago by jdemeyer

  • Status changed from positive_review to closed
  • Resolution set to fixed
  • Merged in set to sage-4.7.2.alpha1
Note: See TracTickets for help on using tickets.