This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author cxss
Recipients cxss
Date 2017-01-05.12:12:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1483618368.97.0.107401413332.issue29168@psf.upfronthosting.co.za>
In-reply-to
Content
Hello,

the following code doesn't work any longer in the new Python version 3.6.

import sys
import os
import subprocess
from multiprocessing import Pool, Value, Queue
import multiprocessing
import logging
import logging.handlers
import pickle

queue = multiprocessing.Manager().Queue(-1)
qh = logging.handlers.QueueHandler(queue)
pickle.dumps(qh)

It raises the following exception.
>>> TypeError: can't pickle _thread.RLock objects


Furthermore, also for customized logging handler classes it doesn't work anymore.

class CustomHandler(logging.Handler):
    def __init__(self, queue):
        logging.Handler.__init__(self)
        self.queue = queue
        
    def emit(self, record):
        try:
            ei = record.exc_info
            if ei:
                dummy = self.format(record)
                record.exc_info = None  
        except (KeyboardInterrupt, SystemExit):
            raise
        except:
            self.handleError(record)

For a centralized logging facility in a multiprocess environment this is a big problem. How can I handle this in the 3.6 version?
History
Date User Action Args
2017-01-05 12:12:49cxsssetrecipients: + cxss
2017-01-05 12:12:48cxsssetmessageid: <1483618368.97.0.107401413332.issue29168@psf.upfronthosting.co.za>
2017-01-05 12:12:48cxsslinkissue29168 messages
2017-01-05 12:12:48cxsscreate