Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

py3: handle some unbound methods __func__ #24200

Closed
fchapoton opened this issue Nov 11, 2017 · 11 comments
Closed

py3: handle some unbound methods __func__ #24200

fchapoton opened this issue Nov 11, 2017 · 11 comments

Comments

@fchapoton
Copy link
Contributor

CC: @tscrim @jdemeyer @jhpalmieri @a-andre @kiwifb

Component: python3

Author: Frédéric Chapoton

Branch/Commit: 9724e81

Reviewer: François Bissey

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

@fchapoton fchapoton added this to the sage-8.1 milestone Nov 11, 2017
@fchapoton
Copy link
Contributor Author

Commit: 9724e81

@fchapoton
Copy link
Contributor Author

Branch: u/chapoton/24200

@fchapoton
Copy link
Contributor Author

New commits:

9724e81py3: handle some unbound methods __func__

@kiwifb
Copy link
Member

kiwifb commented Nov 11, 2017

comment:2

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

@kiwifb
Copy link
Member

kiwifb commented Nov 11, 2017

Reviewer: François Bissey

@fchapoton
Copy link
Contributor Author

comment:3

merci !

@kiwifb
Copy link
Member

kiwifb commented Nov 11, 2017

comment:4

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

?

@fchapoton
Copy link
Contributor Author

comment:5

no ticket yet for the hex problem

in the experimental branch (https://github.com/sagemath/sagetrac-mirror/commits/public/python3-experiment-8.1.rc0) that permit to start sage:

sagemath/sagetrac-mirror@2ffe4e2

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

@fchapoton
Copy link
Contributor Author

comment:6

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

@embray
Copy link
Contributor

embray commented Nov 15, 2017

comment:7

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.

@vbraun
Copy link
Member

vbraun commented Dec 11, 2017

Changed branch from u/chapoton/24200 to 9724e81

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants