cp -rf Python-2.7.10/Modules/_multiprocessing Modules/_multiprocessing
cp -rf Python-2.7.10/Lib/multiprocessing multiprocessing
cp -rf Python-2.7.10/Lib/test/test_multiprocessing.py tests/__init__.py
cp -rf py2.5.6/examples .
cp -f py2.5.6/*txt .
cp -f billiard-3.3.0.20/setup.py .
cp -rf py2.5.6/doc .
cp -f py2.5.6/index.html .

# ----------------------------------------------------------------------
CHANGES TO setup.py:
  HACKED billiard's setup.py together with processing's setup.py

CHANGES TO examples:
  updated from old (processing) to new (multiprocessing) methods
# ----------------------------------------------------------------------
diff Modules/_multiprocessing/semaphore.c Python-2.7.10/Modules/_multiprocessing/semaphore.c
211c211
< //ifndef HAVE_SEM_TIMEDWAIT
---
> #ifndef HAVE_SEM_TIMEDWAIT
272c272
< //endif /* !HAVE_SEM_TIMEDWAIT */
---
> #endif /* !HAVE_SEM_TIMEDWAIT */

# ----------------------------------------------------------------------
diff multiprocessing/__init__.py Python-2.7.10/Lib/multiprocessing/__init__.py
44c44
< __version__ = '0.70.1'
---
> __version__ = '0.70a1'

diff tests/__init__.py Python-2.7.10/Lib/test/test_multiprocessing.py 
2474c2474
<     def _test_noforkbomb(self):
---
>     def test_noforkbomb(self):

diff multiprocessing/forking.py Python-2.7.10/Lib/multiprocessing/forking.py
59,62c59
< try:
<     from dill import Pickler
< except ImportError:
<     from pickle import Pickler
---
> from pickle import Pickler
196,200c193,196
<     try:
<     #   from cPickle import dump, load, HIGHEST_PROTOCOL
<         from dill import load, DEFAULT_PROTOCOL as HIGHEST_PROTOCOL
<     except ImportError:
<         from pickle import load, HIGHEST_PROTOCOL
---
>     #try:
>     #    from cPickle import dump, load, HIGHEST_PROTOCOL
>     #except ImportError:
>     from pickle import load, HIGHEST_PROTOCOL

diff multiprocessing/managers.py Python-2.7.10/Lib/multiprocessing/managers.py
56c56
<     from dill import PicklingError
---
>     from cPickle import PicklingError
58,61c58
<     try:
<         from cPickle import PicklingError
<     except ImportError:
<         from pickle import PicklingError
---
>     from pickle import PicklingError

diff Modules/_multiprocessing/multiprocessing.c Python-2.7.10/Modules/_multiprocessing/multiprocessing.c
255,257c255
<     temp = PyImport_ImportModule("dill");
<     if (!temp)
<         temp = PyImport_ImportModule(PICKLE_MODULE);
---
>     temp = PyImport_ImportModule(PICKLE_MODULE);
262,264c260
<     pickle_protocol = PyObject_GetAttrString(temp, "DEFAULT_PROTOCOL");
<     if (!pickle_protocol)
<         pickle_protocol = PyObject_GetAttrString(temp, "HIGHEST_PROTOCOL");
---
>     pickle_protocol = PyObject_GetAttrString(temp, "HIGHEST_PROTOCOL");

# ----------------------------------------------------------------------
REPLACED "from multiprocessing" with "from multiprocess"
REPLACED "from _multiprocessing" with "from _multiprocess"
REPLACED "import _multiprocessing" with "import _multiprocess as _multiprocessing"
REPLACED "multprocessing" with "multiprocess" wherever else relevant...

# ----------------------------------------------------------------------
diff Python-2.7.10/Modules/_multiprocessing/connection.h Python-2.7.13/Modules/_multiprocessing/connection.h
22,23c22,23
<     PyErr_SetString(PyExc_IOError, "connection is write-only"); \
<     return NULL; \
---
>         PyErr_SetString(PyExc_IOError, "connection is write-only"); \
>         return NULL; \
28,29c28,29
<     PyErr_SetString(PyExc_IOError, "connection is read-only"); \
<     return NULL; \
---
>         PyErr_SetString(PyExc_IOError, "connection is read-only"); \
>         return NULL; \

diff Python-2.7.10/Modules/_multiprocessing/semaphore.c Python-2.7.13/Modules/_multiprocessing/semaphore.c
432c432
<     static int counter = 0;
---
>     int try = 0;
443c443,453
<     PyOS_snprintf(buffer, sizeof(buffer), "/mp%ld-%d", (long)getpid(), counter++);
---
>     /* Create a semaphore with a unique name. The bytes returned by
>      * _PyOS_URandom() are treated as unsigned long to ensure that the filename
>      * is valid (no special characters). */
>     do {
>         unsigned long suffix;
>         _PyOS_URandom((char *)&suffix, sizeof(suffix));
>         PyOS_snprintf(buffer, sizeof(buffer), "/mp%ld-%lu", (long)getpid(),
>                       suffix);
>         SEM_CLEAR_ERROR();
>         handle = SEM_CREATE(buffer, value, maxvalue);
>     } while ((handle == SEM_FAILED) && (errno == EEXIST) && (++try < 100));
445,446d454
<     SEM_CLEAR_ERROR();
<     handle = SEM_CREATE(buffer, value, maxvalue);

diff Python-2.7.10/Lib/multiprocessing/forking.py Python-2.7.13/Lib/multiprocessing/forking.py
472a473,478
>         # XXX (ncoghlan): The following code makes several bogus
>         # assumptions regarding the relationship between __file__
>         # and a module's real name. See PEP 302 and issue #10845
>         # The problem is resolved properly in Python 3.4+, as
>         # described in issue #19946
> 
478c484,492
<         if main_name != 'ipython':
---
>         if main_name == '__main__':
>             # For directory and zipfile execution, we assume an implicit
>             # "if __name__ == '__main__':" around the module, and don't
>             # rerun the main module code in spawned processes
>             main_module = sys.modules['__main__']
>             main_module.__file__ = main_path
>         elif main_name != 'ipython':
>             # Main modules not actually called __main__.py may
>             # contain additional code that should still be executed

diff Python-2.7.10/Lib/multiprocessing/managers.py Python-2.7.13/Lib/multiprocessing/managers.py
290c290
<                     send(('#UNSERIALIZABLE', repr(msg)))
---
>                     send(('#UNSERIALIZABLE', format_exc()))
887c887
<     Return an proxy type whose methods are given by `exposed`
---
>     Return a proxy type whose methods are given by `exposed`
# ----------------------------------------------------------------------
diff Python-2.7.13/Lib/multiprocessing/forking.py Python-2.7.15/Lib/multiprocessing/forking.py
408c408,409
<         if not WINEXE and not WINSERVICE:
---
>         if not WINEXE and not WINSERVICE and \
>            not d['sys_argv'][0].lower().endswith('pythonservice.exe'):
diff Python-2.7.13/Lib/multiprocessing/pool.py Python-2.7.15/Lib/multiprocessing/pool.py
89c89
<     assert maxtasks is None or (type(maxtasks) == int and maxtasks > 0)
---
>     assert maxtasks is None or (type(maxtasks) in (int, long) and maxtasks > 0)
122a123,124
> 
>         task = job = result = func = args = kwds = None
364a367,368
>             finally:
>                 task = taskseq = job = None
368d371
< 
407a411
>             task = job = obj = None
423a428
>             task = job = obj = None
diff Python-2.7.13/Lib/multiprocessing/process.py Python-2.7.15/Lib/multiprocessing/process.py
130a131,133
>         # Avoid a refcycle if the target function holds an indirect
>         # reference to the process object (see bpo-30775)
>         del self._target, self._args, self._kwargs
155a159
> 
158,159c162,168
<         self._popen.poll()
<         return self._popen.returncode is None
---
> 
>         returncode = self._popen.poll()
>         if returncode is None:
>             return True
>         else:
>             _current_process._children.discard(self)
>             return False
230c239
<         if type(status) is int:
---
>         if type(status) in (int, long):
265,266c274,275
<             elif isinstance(e.args[0], int):
<                 exitcode = e.args[0]
---
>             elif isinstance(e.args[0], (int, long)):
>                 exitcode = int(e.args[0])
diff Python-2.7.13/Lib/multiprocessing/queues.py Python-2.7.15/Lib/multiprocessing/queues.py
131c131
<                     if timeout < 0 or not self._poll(timeout):
---
>                     if not self._poll(timeout):
247,248c247,248
<         try:
<             while 1:
---
>         while 1:
>             try:
273,278c273,277
<         except Exception, e:
<             # Since this runs in a daemon thread the resources it uses
<             # may be become unusable while the process is cleaning up.
<             # We ignore errors which happen after the process has
<             # started to cleanup.
<             try:
---
>             except Exception as e:
>                 # Since this runs in a daemon thread the resources it uses
>                 # may be become unusable while the process is cleaning up.
>                 # We ignore errors which happen after the process has
>                 # started to cleanup.
280a280
>                     return
284,285d283
<             except Exception:
<                 pass
diff Python-2.7.13/Lib/multiprocessing/util.py Python-2.7.15/Lib/multiprocessing/util.py
177c177
<         assert exitpriority is None or type(exitpriority) is int
---
>         assert exitpriority is None or type(exitpriority) in (int, long)
267a268,270
>     # Careful: _finalizer_registry may be mutated while this function
>     # is running (either by a GC run or by another thread).
> 
# ----------------------------------------------------------------------
diff Python-2.7.15/Lib/multiprocessing/managers.py Python-2.7.16/Lib/multiprocessing/managers.py
1062c1062
<     '__contains__', '__delitem__', '__getitem__', '__len__',
---
>     '__contains__', '__delitem__', '__getitem__', '__iter__', '__len__',
1065a1066,1068
> DictProxy._method_to_typeid_ = {
>     '__iter__': 'Iterator',
>     }
diff Python-2.7.15/Lib/test/test_multiprocessing.py Python-2.7.16/Lib/test/test_multiprocessing.py 
19c19
< from test import test_support
---
> from test import support
21c21
< _multiprocessing = test_support.import_module('_multiprocessing')
---
> _multiprocessing = support.import_module('_multiprocessing')
28c28
< test_support.import_module('multiprocessing.synchronize')
---
> support.import_module('multiprocessing.synchronize')
344,345c344,345
<         testfn = test_support.TESTFN
<         self.addCleanup(test_support.unlink, testfn)
---
>         testfn = support.TESTFN
>         self.addCleanup(support.unlink, testfn)
643c643
<         with test_support.temp_cwd():
---
>         with support.temp_cwd():
655c655
<             with test_support.DirsOnSysPath(os.getcwd()):
---
>             with support.DirsOnSysPath(os.getcwd()):
1137a1138,1147
>     def test_list_iter(self):
>         a = self.list(range(10))
>         it = iter(a)
>         self.assertEqual(list(it), range(10))
>         self.assertEqual(list(it), [])  # exhausted
>         # list modified during iteration
>         it = iter(a)
>         a[0] = 100
>         self.assertEqual(next(it), 100)
> 
1147a1158,1170
>     def test_dict_iter(self):
>         d = self.dict()
>         indices = range(65, 70)
>         for i in indices:
>             d[i] = chr(i)
>         it = iter(d)
>         self.assertEqual(list(it), indices)
>         self.assertEqual(list(it), [])  # exhausted
>         # dictionary changed size during iteration
>         it = iter(d)
>         d.clear()
>         self.assertRaises(RuntimeError, next, it)
> 
1263,1264c1286,1287
<         it = self.pool.imap_unordered(sqr, range(1000))
<         self.assertEqual(sorted(it), map(sqr, range(1000)))
---
>         it = self.pool.imap_unordered(sqr, range(100))
>         self.assertEqual(sorted(it), map(sqr, range(100)))
1266c1289
<         it = self.pool.imap_unordered(sqr, range(1000), chunksize=53)
---
>         it = self.pool.imap_unordered(sqr, range(1000), chunksize=100)
1520c1543
<     if test_support.have_unicode:
---
>     if support.have_unicode:
1522,1523c1545,1546
<         uvalue = test_support.u(r'\u043f\u0440\u0438\u0432\u0456\u0442 '
<                                 r'\u0441\u0432\u0456\u0442')
---
>         uvalue = support.u(r'\u043f\u0440\u0438\u0432\u0456\u0442 '
>                            r'\u0441\u0432\u0456\u0442')
1541c1564
<             address=(test.test_support.HOST, 0), authkey=authkey, serializer=SERIALIZER
---
>             address=(test.support.HOST, 0), authkey=authkey, serializer=SERIALIZER
1578c1601
<             address=(test.test_support.HOST, 0), authkey=authkey, serializer=SERIALIZER)
---
>             address=(test.support.HOST, 0), authkey=authkey, serializer=SERIALIZER)
1789c1812
<         with open(test_support.TESTFN, "wb") as f:
---
>         with open(support.TESTFN, "wb") as f:
1795c1818
<         with open(test_support.TESTFN, "rb") as f:
---
>         with open(support.TESTFN, "rb") as f:
1814c1837
<         with open(test_support.TESTFN, "wb") as f:
---
>         with open(support.TESTFN, "wb") as f:
1827c1850
<         with open(test_support.TESTFN, "rb") as f:
---
>         with open(support.TESTFN, "rb") as f:
2210c2233
<             with test_support.start_threads(threads):
---
>             with support.start_threads(threads):
2638c2661
<     @test_support.requires_unicode  # XXX json needs unicode support
---
>     @support.requires_unicode  # XXX json needs unicode support
2683a2707,2709
>     # Sending CONN_MAX_SIZE bytes into a multiprocessing pipe must block
>     CONN_MAX_SIZE = max(support.PIPE_MAX_SIZE, support.SOCK_MAX_SIZE)
> 
2692c2718
<         conn.send_bytes(b'x'*(1024*1024))   # sending 1 MB should block
---
>         conn.send_bytes(b'x' * cls.CONN_MAX_SIZE)
2711c2737
<             self.assertEqual(conn.recv_bytes(), b'x'*(1024*1024))
---
>             self.assertEqual(conn.recv_bytes(), b'x' * self.CONN_MAX_SIZE)
2768c2794
<         from test.test_support import run_unittest as run
---
>         from test.support import run_unittest as run
2793c2819
<     with test_support.check_py3k_warnings(
---
>     with support.check_py3k_warnings(
# ----------------------------------------------------------------------
ADDED *args, **kwds for ForkingPickler in __init__ and dump
# ----------------------------------------------------------------------
diff Python-2.7.16/Modules/_multiprocessing/multiprocessing.c Python-2.7.17/Modules/_multiprocessing/multiprocessing.c
170c170
<     cmsg->cmsg_len = CMSG_LEN(sizeof(int));
---
>     cmsg->cmsg_len = CMSG_SPACE(sizeof(int));
