Menu

#891 import pickle problem

1.4.4
closed-fixed
5
2009-04-08
2009-04-03
No

Windows Server 2003
Eclipse 3.4.2
pydev 1.4.5.2721 (logged against 1.4.4 because 1.4.5 isn't in the tracker's group list)
Python 3.1a1 (r31a1:70244, Mar 8 2009, 18:15:03) [MSC v.1500 32 bit (Intel)] on win32

import pickle
print(dir(pickle))
pickle.|<-(code completion -- see screenshot)
pickle.load("test.pck")

The print statement outputs (correctly):

['APPEND', 'APPENDS', 'BINBYTES', 'BINFLOAT', 'BINGET', 'BININT', 'BININT1', 'BININT2', 'BINPERSID', 'BINPUT', 'BINSTRING', 'BINUNICODE', 'BUILD', 'BuiltinFunctionType', 'DEFAULT_PROTOCOL', 'DICT', 'DUP', 'EMPTY_DICT', 'EMPTY_LIST', 'EMPTY_TUPLE', 'EXT1', 'EXT2', 'EXT4', 'FALSE', 'FLOAT', 'FunctionType', 'GET', 'GLOBAL', 'HIGHEST_PROTOCOL', 'INST', 'INT', 'LIST', 'LONG', 'LONG1', 'LONG4', 'LONG_BINGET', 'LONG_BINPUT', 'MARK', 'NEWFALSE', 'NEWOBJ', 'NEWTRUE', 'NONE', 'OBJ', 'PERSID', 'POP', 'POP_MARK', 'PROTO', 'PUT', 'PickleError', 'Pickler', 'PicklingError', 'PyStringMap', 'REDUCE', 'SETITEM', 'SETITEMS', 'SHORT_BINBYTES', 'SHORT_BINSTRING', 'STOP', 'STRING', 'TRUE', 'TUPLE', 'TUPLE1', 'TUPLE2', 'TUPLE3', 'UNICODE', 'Unpickler', 'UnpicklingError', '_EmptyClass', '_Pickler', '_Stop', '_Unpickler', '__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__version__', '_binascii', '_extension_cache', '_extension_registry', '_inverted_registry', '_keep_alive', '_test', '_tuplesize2code', 'bytes_types', 'classmap', 'codecs', 'compatible_formats', 'decode_long', 'dispatch_table', 'dump', 'dumps', 'encode_long', 'format_version', 'io', 'load', 'loads', 'marshal', 'mloads', 're', 'struct', 'sys', 'whichmodule']

However, completion lists only __file__ and __name__.

Without pydev-extensions installed the pickle.load statement is accepted without complaint.

With pydev-extensions installed, it is flagged as an error:

Undefined variable from import: load
function: <function load at 0x00B94108>

In both cases the code executes correctly, it's just completion and syntax checking that fail.

This seems to affect only the pickle module. I tried the above code with a dozen stdlib modules at random and the only one to show any problems was pickle.

Discussion

  • James Garrison

    James Garrison - 2009-04-03

    Screenshot

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2009-04-03

    Just a doubt: have you tried adding 'pickle' to the forced builtins?

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2009-04-03
    • status: open --> pending
     
  • James Garrison

    James Garrison - 2009-04-03

    Ah. I'm still new enough to pydev that I didn't know about forced builtins.

    I looked in the list, and while _pickle was present, "pickle" was not.

    After adding it, code-completion is now listing the expected entries.

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2009-04-08

    This was actually a problem when recognizing the grammar that should be used for parsing that file (as it didn't recognize 3.1, it returned the last in the 2.x series) -- fixed for 1.4.5 (svn: 2723)

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2009-04-08
    • status: pending --> closed-fixed