title: Why multiprocessing.Process behave differently on windows and linux for global object and function arguments
body: <p>The following code has different output when running  on windows and linux (both with python2.7)</p>
  
  <pre><code>'''import_mock.py'''
  to_mock = None
  </code></pre>
  
  <pre class="lang-python prettyprint-override"><code>'''test.py'''
  import import_mock
  from multiprocessing import Process
  
  class A(object):
      def __init__(self):
          self.a = 1
          self.b = 2
          self.c = 3
  
      def __getstate__(self):
          print '__getstate__'
          return { 'a': self.a, 'b': self.b,
                   'c':0 }
  
  def func():
      import_mock.to_mock = 1
      a = A()
      return a
  
  def func1(a):
      print a.a, a.b, a.c
      print import_mock.to_mock
  
  
  if __name__ == '__main__':
      a = func()
      p = Process(target=func1, args=(a,))
      p.start()
      p.join()
  </code></pre>
  
  <p>On windows, the output is:</p>
  
  <pre class="lang-none prettyprint-override"><code>__getstate__
  1 2 0
  None
  </code></pre>
  
  <p>Which is what I expected</p>
  
  <p>On linux, it is:</p>
  
  <pre class="lang-none prettyprint-override"><code>1 2 3
  1
  </code></pre>
  
  <p>Which not clone the global object and the passed args.</p>
  
  <p>My question is why they behave differently? And how to make the linux code behave the same as windows one?</p>