[Python-Dev] [bug?] UserLong.py - pow(5, UserLong(3), 26) fails

Luke Kenneth Casson Leighton lkcl@samba-tng.org
Wed, 1 May 2002 19:14:14 +0000

hiya people,

been a while, i'm back onto python exploration for
a serious monster exciting parallelisation project.

as part of the evaluation, i have created UserLong.py,
and am working my way through the list of all operations.

i may have some mistakes and/or missing operators, and
am trying to work this one out.

at the bottom of the file are some inline debug tests.

one of these - pow(int(5), UserLong(3), 26) - is failing:

Script started on Wed May  1 19:06:30 2002
highfield:/usr/local/lib/python2.2# python UserLong.py
int 3
long 3
5**int(y) 125
5**y rpow: (5,)
x^y%26 (3L, 26)
Traceback (most recent call last):
  File "UserLong.py", line 153, in ?
    print "5^y%26", pow(5, y, 26)
TypeError: unsupported operand type(s) for pow(): 'int', 'instance', 'int'
Script done on Wed May  1 19:06:37 2002

now, if i read this correctly, what is happening is that in
the [optimised] code, Objects/intobject.c, support for types
other than int, float and long - via the macro CONVERT_TO_LONG -
are simply not supported.

this i believe can be demonstrated to be so because if you
do pow(5, [], 26) you get the same error except replace
'instance' above with 'list'.

now, could someone with a little more knowledge than i kindly
evaluate, if they have the time, whether:

- _is_ this happening because i have missed out a function in
UserLong.py that i do not know the name of?


- _is_ this due to a bug in intobject.c's int_pow()


- _is_ this due to a bug in the implementation of the pow()
"spam" function?

- other?

many thanks,


this message is private, confidential, and is intented for
the specified recipients only.  if you received in error,
altered, deleted, modified, destroyed or interfered with
the contents of this message, in whole or in part, please
inform the sender (that's me), immediately.

if you, the recipient, reply to this message, and do not
then receive a response, please consider your reply to have
been lost or deliberately destroyed: i *always* acknowledge
personal email received.  please therefore take appropriate
action and use appropriate protocols to ensure effective

thank you.