Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6728649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:11:44+00:00 2026-05-26T10:11:44+00:00

I am using the Python multiprocessing module to place objects onto a queue and

  • 0

I am using the Python multiprocessing module to place objects onto a queue and have them processed by several workers. My first issue was getting bound instance methods to pickle, which I have working, but now I’m running into a separate issue caused by the fact that the objects are using __slots__.

When the mp module goes to pickle the objects, it seems to be using the older ascii pickle protocol, that can’t handle __slots__. The newer protocol does handle this, but I’m not sure how to make the mp module use this protocol.

Anyone have any experience with this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:11:45+00:00Added an answer on May 26, 2026 at 10:11 am

    If it’s not possible to change the pickle protocol the multiprocessing package uses, then define __getstate__ and __setstate__ for your objects:

    import pickle
    
    class Foo(object):
        __slots__ = ['this', 'that', 'other']
    
        def __init__(self):
            self.this = 1
            self.that = 2
            self.other = 3
    
        def __getstate__(self):
            return dict((name, getattr(self, name))
                        for name in self.__slots__)
    
        def __setstate__(self, state):
            for name, value in state.items():
                setattr(self, name, value)
    
    pickle.dumps(Foo(), protocol=0)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am sending simple objects between processes using pipes with Python's multiprocessing module. The
newcomer and first ever question here. I am using the multiprocessing module of Python
I am using the multiprocessing python module with Queue for communication between processes. Some
I have a program using python's packages multiprocessing and Queue. One of my functions
I am having trouble with the Python multiprocessing module. I am using the Process
Suppose I have a python script called my_parallel_script.py that involves using multiprocessing to parallelize
I'm getting the following error when using the multiprocessing module within a python daemon
I've been reading about Python's multiprocessing module . I still don't think I have
In python, using twisted loopingcall, multiprocessing.Process, and multiprocessing.Queue; is it possible to create a
I create a couple of worker processes using Python's Multiprocessing module 2.6. In each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.