Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/_main.inc.php on line 128

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/_main.inc.php on line 134

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/_main.inc.php on line 141

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/_main.inc.php on line 169

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/_main.inc.php on line 199

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/_main.inc.php on line 205

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/_main.inc.php on line 233

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/_main.inc.php on line 248

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/_main.inc.php on line 254

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/_main.inc.php on line 267

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/_main.inc.php on line 595

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/files/model/_file.funcs.php on line 559

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/_connect_db.inc.php on line 29

Strict Standards: Declaration of UserSettings::get() should be compatible with AbstractSettings::get($col_key1, $col_key2 = NULL, $col_key3 = NULL) in /home/fumanchu/webapps/b2/blogs/inc/users/model/_usersettings.class.php on line 208

Strict Standards: Declaration of UserSettings::set() should be compatible with AbstractSettings::set() in /home/fumanchu/webapps/b2/blogs/inc/users/model/_usersettings.class.php on line 208

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/_core/_param.funcs.php on line 1692

Warning: Cannot modify header information - headers already sent by (output started at /home/fumanchu/webapps/b2/blogs/inc/_main.inc.php:128) in /home/fumanchu/webapps/b2/blogs/inc/sessions/model/_session.class.php on line 219

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/generic/model/_genericelement.class.php on line 109

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/_core/model/dataobjects/_dataobject.class.php on line 428

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/_core/model/dataobjects/_dataobject.class.php on line 437

Strict Standards: Declaration of Blog::set() should be compatible with DataObject::set($parname, $parvalue, $make_null = false) in /home/fumanchu/webapps/b2/blogs/inc/collections/model/_blog.class.php on line 1886

Strict Standards: Declaration of Group::set() should be compatible with DataObject::set($parname, $parvalue, $make_null = false) in /home/fumanchu/webapps/b2/blogs/inc/users/model/_group.class.php on line 553

Strict Standards: Declaration of User::dbdelete() should be compatible with DataObject::dbdelete() in /home/fumanchu/webapps/b2/blogs/inc/users/model/_user.class.php on line 1343

Strict Standards: Declaration of User::set() should be compatible with DataObject::set($parname, $parvalue, $make_null = false) in /home/fumanchu/webapps/b2/blogs/inc/users/model/_user.class.php on line 1343

Strict Standards: Declaration of Filetype::set() should be compatible with DataObject::set($parname, $parvalue, $make_null = false) in /home/fumanchu/webapps/b2/blogs/inc/files/model/_filetype.class.php on line 192

Strict Standards: Declaration of Comment::set() should be compatible with DataObject::set($parname, $parvalue, $make_null = false) in /home/fumanchu/webapps/b2/blogs/inc/comments/model/_comment.class.php on line 1334

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/_blog_main.inc.php on line 412

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/items/model/_itemlist.class.php on line 483

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/items/model/_itemlistlight.class.php on line 119

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/items/model/_itemlistlight.class.php on line 838

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/items/model/_item.class.php on line 1411

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/items/model/_item.class.php on line 1414

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/items/model/_item.class.php on line 3000

Strict Standards: Declaration of ItemListLight::query() should be compatible with Results::query($create_default_cols_if_needed = true, $append_limit = true, $append_order_by = true, $query_title = 'Results::Q...') in /home/fumanchu/webapps/b2/blogs/inc/items/model/_itemlistlight.class.php on line 48

Strict Standards: Declaration of GenericCategoryCache::clear() should be compatible with DataObjectCache::clear($keep_shadow = false) in /home/fumanchu/webapps/b2/blogs/inc/generic/model/_genericcategorycache.class.php on line 375

Strict Standards: Declaration of GenericCategory::set() should be compatible with DataObject::set($parname, $parvalue, $make_null = false) in /home/fumanchu/webapps/b2/blogs/inc/generic/model/_genericcategory.class.php on line 133

Strict Standards: Declaration of CollectionSettings::_load() should be compatible with AbstractSettings::_load($arg1 = NULL, $arg2 = NULL, $arg3 = NULL) in /home/fumanchu/webapps/b2/blogs/inc/collections/model/_collsettings.class.php on line 130

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 334

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 334

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 334

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 334

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 334

Notice: Array to string conversion in /home/fumanchu/webapps/b2/blogs/inc/_core/_param.funcs.php on line 1161

Notice: Array to string conversion in /home/fumanchu/webapps/b2/blogs/inc/_core/_param.funcs.php on line 1161

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 334

Warning: Cannot modify header information - headers already sent by (output started at /home/fumanchu/webapps/b2/blogs/inc/_main.inc.php:128) in /home/fumanchu/webapps/b2/blogs/inc/skins/_skin.funcs.php on line 379
pickle.dumps not suitable for hashing

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/widgets/model/_widget.class.php on line 451

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/inc/widgets/model/_widget.class.php on line 547

Strict Standards: Declaration of ComponentWidget::set() should be compatible with DataObject::set($parname, $parvalue, $make_null = false) in /home/fumanchu/webapps/b2/blogs/inc/widgets/model/_widget.class.php on line 722
« The Dresden Codak GalleryCherryPy 3 request_queue_size »

pickle.dumps not suitable for hashing

11/03/07

Permalink 05:33:51 pm, by fumanchu Email , 169 words   English (US)

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 334

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 334
Categories: Python


Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 334
pickle.dumps not suitable for hashing


Strict Standards: Declaration of markdown_extra_plugin::GetDefaultSettings() should be compatible with Plugin::GetDefaultSettings(&$params) in /home/fumanchu/webapps/b2/blogs/plugins/_markdown_extra.plugin.php on line 84

Strict Standards: Declaration of smilies_plugin::GetDefaultSettings() should be compatible with Plugin::GetDefaultSettings(&$params) in /home/fumanchu/webapps/b2/blogs/plugins/_smilies.plugin.php on line 398

Strict Standards: Declaration of smilies_plugin::GetDefaultUserSettings() should be compatible with Plugin::GetDefaultUserSettings(&$params) in /home/fumanchu/webapps/b2/blogs/plugins/_smilies.plugin.php on line 398

For reasons I don't have time to fully explore, once in a great while pickle.dumps(obj) doesn't produce consistent strings on successive runs. Here's the one that bit me today:

((2, 'Tiger River'), "(I2\nS'Tiger River'\np1\ntp2\n.", '23ca69094eb994abc75cdec989d22398')
((2, 'Tiger River'), "(I2\nS'Tiger River'\ntp1\n.", '2b40ffb53a0be2c4cfe4f99b24d64842')

The first item in each set is the object being pickled. The second object is the result of pickle.dumps(obj). Note the same object is pickled to two different strings on distinct runs. No idea why.

This is important enough to blog about because the third item in each set above is an md5 hash of the pickle, which is how I discovered this--my attempts to recover memcached objects using keys from md5.new(pickle.dumps(object)).hexdigest() failed because the pickles differed. So until some with more time and brains than I comments on why, I recommend you don't use pickle.dumps to create md5 seeds.


Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 334

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/skins/_item_feedback.inc.php on line 156

3 comments

Comment from: Andrew Dalke [Visitor]

Strict Standards: Only variables should be passed by reference in /home/fumanchu/webapps/b2/blogs/inc/plugins/model/_plugins.class.php on line 677

Strict Standards: Declaration of PluginSettings::get() should be compatible with AbstractSettings::get($col_key1, $col_key2 = NULL, $col_key3 = NULL) in /home/fumanchu/webapps/b2/blogs/inc/plugins/model/_pluginsettings.class.php on line 95

Strict Standards: Declaration of PluginSettings::set() should be compatible with AbstractSettings::set() in /home/fumanchu/webapps/b2/blogs/inc/plugins/model/_pluginsettings.class.php on line 95

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 334

Strict Standards: Only variables should be passed by reference in /home/fumanchu/webapps/b2/blogs/inc/plugins/model/_plugins.class.php on line 677

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1030

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1030

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1053

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 721

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 721

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 721

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1729

Is that really pickle.dumps? It looks like cPickle.dumps.


>>> import pickle, cPickle
>>> pickle.dumps( (2, "Tiger River"), 0 )
"(I2\nS'Tiger River'\np0\ntp1\n."
>>> cPickle.dumps( (2, "Tiger River"), 0 )
"(I2\nS'Tiger River'\np1\ntp2\n."


It appears to be a different based on reference counts


>>> cPickle.dumps( (2, "Tiger River"), 0 )
"(I2\nS'Tiger River'\np1\ntp2\n."
>>> T = (2, "Tiger River")
>>> cPickle.dumps( T, 0)
"(I2\nS'Tiger River'\ntp1\n."


Probably because of this optimization in cPickle.c::put


static int
put(Picklerobject *self, PyObject *ob)
{
if (ob->ob_refcnt < 2 || self->fast)
return 0;

return put2(self, ob);
}


where "put2" is the one which generates the "p1\n" causing the problems.

11/03/07 @ 19:47
Comment from: Gustavo Picon [Visitor] · http://gpicon.org

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1030

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1030

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1053

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 721

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 721

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 721

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1030

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1030

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1053

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 721

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 721

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 721

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1030

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1030

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1053

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 721

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 721

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 721

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1030

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1030

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1053

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 721

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 721

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 721

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1729

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1729

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1729

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1729

I get different results between pickle and cPickle:


import pickle, cPickle, dis
tup = (2, 'Tiger River')
pickle.dumps(tup)
"(I2\nS'Tiger River'\np0\ntp1\n."
cPickle.dumps(tup)
"(I2\nS'Tiger River'\ntp1\n."


Try passing

dis.dis(pickle.dumps(tup))
0 STORE_SLICE+0
1 PRINT_ITEM_TO
2 DELETE_SLICE+0
3 UNARY_POSITIVE
4 RETURN_VALUE
5
6 IMPORT_STAR
7 LOAD_ATTR 25959 (25959)
10 21024
13 LOAD_ATTR 25974 (25974)
16 2599
19 JUMP_IF_TRUE 2608 (to 2630)
22 LOAD_GLOBAL 12656 (12656)
25 UNARY_POSITIVE
26
dis.dis(cPickle.dumps(tup))
0 STORE_SLICE+0
1 PRINT_ITEM_TO
2 DELETE_SLICE+0
3 UNARY_POSITIVE
4 RETURN_VALUE
5
6 IMPORT_STAR
7 LOAD_ATTR 25959 (25959)
10 21024
13 LOAD_ATTR 25974 (25974)
16 2599
19 LOAD_GLOBAL 12656 (12656)
22 UNARY_POSITIVE
23



Try using marshal.dumps, that should be faster, but afaik, neither pickle nor marshal guarantee the same dumps.

11/03/07 @ 21:24
Comment from: Ido [Visitor]

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1030

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1030

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1053

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 721

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 721

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 721

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1729

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1729

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/fumanchu/webapps/b2/blogs/plugins/markdown_extra/markdown.php on line 1729

pickle and cPickle aren't guaranteed to produce the same output:

http://docs.python.org/lib/module-cPickle.html#tex2html118

Since the pickle data format is actually a tiny stack-oriented programming language, and some freedom is taken in the encodings of certain objects, it is possible that the two modules produce different data streams for the same input objects. However it is guaranteed that they will always be able to read each other's data streams.



also, you may want to read this to further understand pickle:
http://peadrop.com/blog/2007/06/18/pickle-an-interesting-stack-language/

11/04/07 @ 16:03

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/skins/_item_comment_form.inc.php on line 67

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/skins/_item_comment_form.inc.php on line 84

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.

Please enter the phrase "I am a real human." in the textbox above.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/plugins/_calendar.plugin.php on line 190

Deprecated: Assigning the return value of new by reference is deprecated in /home/fumanchu/webapps/b2/blogs/plugins/_calendar.plugin.php on line 905

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 334

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 334
October 2020
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

Search

The requested Blog doesn't exist any more!

XML Feeds


Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 223
multi-blog

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 304

Deprecated: Non-static method Hitlist::dbprune() should not be called statically, assuming $this from incompatible context in /home/fumanchu/webapps/b2/blogs/inc/sessions/model/_hit.class.php on line 531

Warning: Creating default object from empty value in /home/fumanchu/webapps/b2/blogs/inc/settings/model/_abstractsettings.class.php on line 304