You can clone with
HTTPS or Subversion.
Before reporting a problem, please UPDATE TO LATEST SVN.
As this is a community-driven project, the developers only
have time available to fix problems reported in the LATEST
code. You are welcome to report problems in any other
version, but until you have upgraded to latest svn and provided
a test report against that, you will be reliant on people
OTHER than the core developers for bug-fixes. which could
happen, so feel free to ignore the above should you so choose.
What steps will reproduce the problem?
What is the expected output? What do you see instead?
Expect a random number within range. Get a very unhelpful alert saying "typeError: Object1 doesnt have 'lshift' "
What version of Pyjamas are you using? which svn revision number?
On what operating system?
latest pyjs as of feb 23 2012. Windows 7 starter. latest chrome.
from IE's Script Debugger or from Firefox Venkman / Firebug?
Have you attached a stack trace from using "-d" compiler option?
no stack trace, only an alert.
If using PyJD, have you attached a python stack trace?
If using PyJS, what compiler options did you use?
Please provide any additional information below.
probably caused by this line in random.py:
def randrange(self, start, stop=None, step=1, fint=int, default=None, maxwidth=1L<<BPF):
Original issue: http://code.google.com/p/pyjamas/issues/detail?id=690 (February 23, 2012 12:47:10)
From cornelis...@gmail.com on February 24, 2012 07:10:06:
As you noted email: if the second value is above somewhere between 2 and 3 million you get a very unhelpful lshift error message when loading the app in pyjs.
If it is the 1<<BPF, then the following patch should work. The 1<<BPF is replaced by the value of 1<<BPF. Could you check this?
diff --git a/pyjs/src/pyjs/lib/random.py b/pyjs/src/pyjs/lib/random.py
index 1cea795..dbdd8f8 100644
@@ -21,7 +21,7 @@ LOG4 = _log(4.0)
SG_MAGICCONST = 1.0 + _log(4.5)
BPF = 53 # Number of bits in a float
+BPF_VALUE = 9007199254740992L # 1 << BPF
# Translated by Guido van Rossum from C source provided by
# Adrian Baddeley. Adapted by Raymond Hettinger for use with
@@ -96,7 +96,7 @@ class Random(_random.Random):
## -------------------- integer methods -------------------
def randrange(self, start, stop=None, step=1, fint=int, default=None,
# """Choose a random item from range(start, stop[, step]).
# This fixes the problem with randint() which includes the
# endpoint; in Python this is usually not what you want.
@@ -164,7 +164,7 @@ class Random(_random.Random):
return self.randrange(a, b+1)
def _randbelow(self, n, _log=_log, fint=int, _maxwidth=1L<<BPF):