[Patches] [ python-Patches-514641 ] Negative ob_size of LongObjects

noreply@sourceforge.net noreply@sourceforge.net
Thu, 07 Feb 2002 19:26:56 -0800


Patches item #514641, was opened at 2002-02-07 19:26
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=514641&group_id=5470

Category: Core (C code)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Naofumi Honda (naofumi-h)
Assigned to: Nobody/Anonymous (nobody)
Summary: Negative ob_size of LongObjects

Initial Comment:
I found the following bugs due to the negative ob_size
of LongObjects representing the negative values.

1) The access of attribute "__dict__" causes
   panic.

class A(long):
    pass

x = A(-1)
x.__dict__
==> core dump!

2) pickle neglects the sign of LongObjects

import pickle
class A(long):
  pass

x = A(-1)
pickle.dumps(x)

==>  a string containing 1L (not -1L) !!!

The patch will resolve the above problems.

Naofumi Honda

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=514641&group_id=5470