11# cython: embedsignature=True
22# cython: profile=False
3- # cython: language_level=2
3+ # cython: language_level=3
44import os
55import re
66import sys
@@ -55,13 +55,9 @@ cdef extern from "alps_cray.h" nogil:
5555cdef extern from " xmalloc.h" nogil:
5656 cdef void * xmalloc(size_t size)
5757
58- try :
59- import __builtin__
60- except ImportError :
61- # Python 3
62- import builtins as __builtin__
58+ import builtins as __builtin__
6359
64- cimport slurm
60+ from pyslurm cimport slurm
6561
6662include " pydefines/slurm_errno_defines.pxi"
6763include " pydefines/slurm_errno_enums.pxi"
@@ -910,7 +906,7 @@ cdef class partition:
910906
911907 if record.allow_accounts or not record.deny_accounts:
912908 if record.allow_accounts == NULL or \
913- record.allow_accounts[0 ] == " \0" :
909+ record.allow_accounts[0 ] == " \0" .encode( " UTF-8 " ) :
914910 Part_dict[u ' allow_accounts' ] = u " ALL"
915911 else :
916912 Part_dict[u ' allow_accounts' ] = slurm.listOrNone(
@@ -929,15 +925,15 @@ cdef class partition:
929925 record.allow_alloc_nodes, ' ,' )
930926
931927 if record.allow_groups == NULL or \
932- record.allow_groups[0 ] == " \0" :
928+ record.allow_groups[0 ] == " \0" .encode( " UTF-8 " ) :
933929 Part_dict[u ' allow_groups' ] = u " ALL"
934930 else :
935931 Part_dict[u ' allow_groups' ] = slurm.listOrNone(
936932 record.allow_groups, ' ,' )
937933
938934 if record.allow_qos or not record.deny_qos:
939935 if record.allow_qos == NULL or \
940- record.allow_qos[0 ] == " \0" :
936+ record.allow_qos[0 ] == " \0" .encode( " UTF-8 " ) :
941937 Part_dict[u ' allow_qos' ] = u " ALL"
942938 else :
943939 Part_dict[u ' allow_qos' ] = slurm.listOrNone(
@@ -2829,7 +2825,7 @@ cdef secs2time_str(uint32_t time):
28292825 """
28302826 cdef:
28312827 char * time_str
2832- long days, hours, minutes, seconds
2828+ double days, hours, minutes, seconds
28332829
28342830 if time == slurm.INFINITE:
28352831 time_str = " UNLIMITED"
@@ -2859,7 +2855,7 @@ cdef mins2time_str(uint32_t time):
28592855 :rtype: `str`
28602856 """
28612857 cdef:
2862- long days, hours, minutes, seconds
2858+ double days, hours, minutes, seconds
28632859
28642860 if time == slurm.INFINITE:
28652861 return u " UNLIMITED"
0 commit comments