Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

""" 

This file collects tests requiring Cython. 

""" 

#***************************************************************************** 

# Copyright (C) 2012 Jeroen Demeyer <jdemeyer@cage.ugent.be> 

# Copyright (C) 2012 Simon King <simon.king@uni-jena.de> 

# 

# Distributed under the terms of the GNU General Public License (GPL) 

# as published by the Free Software Foundation; either version 2 of 

# the License, or (at your option) any later version. 

# http://www.gnu.org/licenses/ 

#***************************************************************************** 

from __future__ import absolute_import 

  

from sage.misc.fast_methods cimport FastHashable_class 

  

  

cdef class ClassWithLargeHash(FastHashable_class): 

""" 

This class tests against a bug with :class:`FastHashable_class` 

(in an earlier version of the patch at :trac:`11900`) that occurred 

on systems where ``sys.maxsize`` does not fit into a C int. 

  

TESTS:: 

  

sage: import sage.tests.cython 

sage: C = sage.tests.cython.ClassWithLargeHash(); C 

A successfully created object with a very large hash 

sage: hash(C) == sys.maxsize 

True 

""" 

def __init__(self): 

import sys 

self._hash = sys.maxsize 

  

def __repr__(self): 

return 'A successfully created object with a very large hash'