Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update multiprocessing examples to Py3 and test #66500

Closed
terryjreedy opened this issue Aug 29, 2014 · 2 comments
Closed

Update multiprocessing examples to Py3 and test #66500

terryjreedy opened this issue Aug 29, 2014 · 2 comments
Labels
docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error

Comments

@terryjreedy
Copy link
Member

BPO 22304
Nosy @terryjreedy

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2014-08-29.23:36:55.313>
created_at = <Date 2014-08-29.23:25:38.926>
labels = ['type-bug', 'invalid', 'docs']
title = 'Update multiprocessing examples to Py3 and test'
updated_at = <Date 2014-08-29.23:36:55.311>
user = 'https://github.com/terryjreedy'

bugs.python.org fields:

activity = <Date 2014-08-29.23:36:55.311>
actor = 'terry.reedy'
assignee = 'docs@python'
closed = True
closed_date = <Date 2014-08-29.23:36:55.313>
closer = 'terry.reedy'
components = ['Documentation']
creation = <Date 2014-08-29.23:25:38.926>
creator = 'terry.reedy'
dependencies = []
files = []
hgrepos = []
issue_num = 22304
keywords = []
message_count = 2.0
messages = ['226103', '226105']
nosy_count = 3.0
nosy_names = ['terry.reedy', 'docs@python', 'sbt']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'needs patch'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue22304'
versions = ['Python 3.4', 'Python 3.5']

@terryjreedy
Copy link
Member Author

https://docs.python.org/2/library/multiprocessing.html#examples
contains several examples in Python2 code that need to be updated for Python 3. Richard, if you have them in .py files, perhaps you could run them through 2to3 and then test.

# Example where a pool of http servers share a single listening socket
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
...
    print 'Serving at http://%s:%d using %d worker processes' % \
          (ADDRESS[0], ADDRESS[1], NUMBER_OF_PROCESSES)
    print 'To exit press Ctrl-' + ['C', 'Break'][sys.platform=='win32']

#update
from http.server import HTTPServer, SimpleHTTPRequestHandler
...
    print('Serving at http://%s:%d using %d worker processes' % \
          (ADDRESS[0], ADDRESS[1], NUMBER_OF_PROCESSES))
    print('To exit press Ctrl-' + ['C', 'Break'][sys.platform=='win32'])

This still does not run on Windows
_pickle.PicklingError: Can't pickle <class '_thread.lock'>: attribute lookup lock on _thread failed
but that was true in 2.7 also (bpo-21204).

@terryjreedy terryjreedy added docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error labels Aug 29, 2014
@terryjreedy
Copy link
Member Author

Sorry, copied and pasted from the wrong place. Forget this.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant