Skip to content

Make the meataxe wrapper work with py3 #27152

@simon-king-jena

Description

@simon-king-jena

In a py3-build of Sage, installation of the meataxe spkg works, but the wrapper doesn't:

sage: type(random_matrix(GF(9,'x'), 1000))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-1-01e73e06d744> in <module>()
----> 1 type(random_matrix(GF(Integer(9),'x'), Integer(1000)))

/home/king/Sage/git/py3/local/lib/python3.6/site-packages/sage/matrix/special.py in random_matrix(ring, nrows, ncols, algorithm, implementation, *args, **kwds)
    597     sparse = kwds.pop('sparse', False)
    598     # Construct the parent of the desired matrix
--> 599     parent = matrix_space.MatrixSpace(ring, nrows, ncols, sparse=sparse, implementation=implementation)
    600     if algorithm == 'randomize':
    601         density = kwds.pop('density', None)

/home/king/Sage/git/py3/local/lib/python3.6/site-packages/sage/misc/classcall_metaclass.pyx in sage.misc.classcall_metaclass.ClasscallMetaclass.__call__ (build/cythonized/sage/misc/classcall_metaclass.c:1701)()
    328         """
    329         if cls.classcall is not None:
--> 330             return cls.classcall(cls, *args, **kwds)
    331         else:
    332             # Fast version of type.__call__(cls, *args, **kwds)

/home/king/Sage/git/py3/local/lib/python3.6/site-packages/sage/matrix/matrix_space.py in __classcall__(cls, base_ring, nrows, ncols, sparse, implementation)
    474             raise OverflowError("number of rows and columns may be at most %s" % sys.maxsize)
    475 
--> 476         matrix_cls = get_matrix_class(base_ring, nrows, ncols, sparse, implementation)
    477         return super(MatrixSpace, cls).__classcall__(
    478                 cls, base_ring, nrows, ncols, sparse, matrix_cls)

/home/king/Sage/git/py3/local/lib/python3.6/site-packages/sage/matrix/matrix_space.py in get_matrix_class(R, nrows, ncols, sparse, implementation)
    253                 elif R.order() <= 255:
    254                     try:
--> 255                         from . import matrix_gfpn_dense
    256                     except ImportError:
    257                         implementation = 'generic'

/home/king/Sage/git/py3/local/lib/python3.6/site-packages/sage/matrix/matrix_gfpn_dense.pyx in init sage.matrix.matrix_gfpn_dense (build/cythonized/sage/matrix/matrix_gfpn_dense.c:20584)()
     60 
     61 # The following import is just to ensure that meataxe_init() is called.
---> 62 import sage.libs.meataxe
     63 
     64 ####################

/home/king/Sage/git/py3/local/lib/python3.6/site-packages/sage/libs/meataxe.pyx in init sage.libs.meataxe (build/cythonized/sage/libs/meataxe.c:2493)()
     85     MtxSetErrorHandler(sage_meataxe_error_handler)
     86 
---> 87 meataxe_init()

/home/king/Sage/git/py3/local/lib/python3.6/site-packages/sage/libs/meataxe.pyx in sage.libs.meataxe.meataxe_init (build/cythonized/sage/libs/meataxe.c:1740)()
     81     from sage.env import DOT_SAGE
     82     global MtxLibDir
---> 83     MtxLibDir = PyBytes_AsString(os.path.join(DOT_SAGE,'meataxe'))
     84     ## Error handling for MeatAxe, to prevent immediate exit of the program
     85     MtxSetErrorHandler(sage_meataxe_error_handler)

TypeError: expected bytes, str found

Component: packages: optional

Keywords: meataxe py3

Author: Simon King

Branch/Commit: b39ff35

Reviewer: Jeroen Demeyer

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions