[ZODB-Dev] Coredump: ZODB, nested scopes, and pdb

Greg Ward gward@mems-exchange.org
Thu, 25 Oct 2001 13:36:06 -0400


--zYM0uCDKw75PZbzx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On 25 October 2001, I said:
> I'll attach the full script

Oops, forgot the attachment.  Here it is.

--zYM0uCDKw75PZbzx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="pdb_coredump.py"

from __future__ import nested_scopes

# Notes on the coredump:
#  * it happens whether I go through FileStorage or ClientStorage
#
#  * it does *not* happen if I comment out the OptionParser lines
#    -- but if I do that, I get an inexplicable UnboundLocalError
#    exception
#
#  * I can move _fix() around in main(), and it still happens
#
#  * if I remove the reference to std_DC in _fix(), or remove
#    _fix() entirely, it doesn't happen

import ZODB
from ZODB.DB import DB
#from ZODB.FileStorage import FileStorage
from ZEO.ClientStorage import ClientStorage
from optik import OptionParser

def main ():
    parser = OptionParser()
    (options, args) = parser.parse_args()

    storage = ClientStorage(("localhost", 1972), var="/tmp")
    #storage = FileStorage("/www/var/mxdb.fs")
    db = DB(storage)
    conn = db.open()
    root = conn.root()

    std_DC = root["standard_units"].dims
    std_DC.foo
    std_DC_oid = std_DC._p_oid
    print "standard DimensionCollection: %r %r" % (std_DC_oid, std_DC)

    def _fix (val):
        std_DC

main()

--zYM0uCDKw75PZbzx--