Opened 4 years ago

Closed 4 years ago

#24200 closed enhancement (fixed)

py3: handle some unbound methods __func__

Reported by: chapoton Owned by:
Priority: major Milestone: sage-8.1
Component: python3 Keywords:
Cc: tscrim, jdemeyer, jhpalmieri, aapitzsch, fbissey Merged in:
Authors: Frédéric Chapoton Reviewers: François Bissey
Report Upstream: N/A Work issues:
Branch: 9724e81 (Commits, GitHub, GitLab) Commit: 9724e81a85f3c86bae05ef7830b6f7f96737789e
Dependencies: Stopgaps:

Status badges

Description


Change History (8)

comment:1 Changed 4 years ago by chapoton

  • Branch set to u/chapoton/24200
  • Cc tscrim jdemeyer jhpalmieri aapitzsch fbissey added
  • Commit set to 9724e81a85f3c86bae05ef7830b6f7f96737789e
  • Status changed from new to needs_review

New commits:

9724e81py3: handle some unbound methods __func__

comment:2 Changed 4 years ago by fbissey

  • Reviewers set to François Bissey
  • Status changed from needs_review to positive_review

Looks good to me, it allows to progress further in starting sage with python3.6.

comment:3 Changed 4 years ago by chapoton

merci !

comment:4 Changed 4 years ago by fbissey

Do you already have something for the next "stop"

/usr/lib64/python3.6/site-packages/sage/rings/real_mpfr.pyx in init sage.rings.real_mpfr()
   2033 
   2034             sage: [RR(s).hex() for s in ['+inf', '-inf', 'nan']]
   2035             ['inf', '-inf', 'nan']
   2036         """
   2037         cdef char *s
   2038         cdef int r
   2039         sig_on()
   2040         r = mpfr_asprintf(&s, "%Ra", self.value)
   2041         sig_off()
   2042         if r < 0:  # MPFR free()s its buffer itself in this case
   2043             raise RuntimeError("unable to convert an mpfr number to a string")
   2044         t = str(s)
   2045         mpfr_free_str(s)
   2046         return t
   2047 
-> 2048     hex = __hex__
        global hex = undefined
        global __hex__ = undefined
   2049 
   2050     def __copy__(self):
   2051         """
   2052         Return copy of ``self`` - since ``self`` is immutable, we just return
   2053         ``self`` again.
   2054 
   2055         EXAMPLES::
   2056 
   2057             sage: a = 3.5
   2058             sage: copy(a) is  a
   2059             True
   2060         """
   2061         return self    # since object is immutable.
   2062 
   2063     def _integer_(self, Z=None):

NameError: name '__hex__' is not defined

?

comment:5 Changed 4 years ago by chapoton

no ticket yet for the hex problem

in the experimental branch (https://git.sagemath.org/sage.git/log/?h=public/python3-experiment-8.1.rc0) that permit to start sage:

https://git.sagemath.org/sage.git/commit/?h=public/python3-experiment-8.1.rc0&id=2ffe4e29422d4e331c65d16d7590fd9fb0bbd9b3

I just remove the alias. This is probably not a good solution.

comment:6 Changed 4 years ago by chapoton

See #24201 for the hex problem (experts help is needed)

comment:7 Changed 4 years ago by embray

Instead of the try/except and whatnot we could use six.get_unbound_method() for this. The name is a bit long but can be rebound to something shorter in the import statement.

comment:8 Changed 4 years ago by vbraun

  • Branch changed from u/chapoton/24200 to 9724e81a85f3c86bae05ef7830b6f7f96737789e
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.