[issue15616] logging.FileHandler not correctly created with PyYaml (unpickling problems?)
New submission from Jordi Puigsegur: logging.FileHandler and logging.RotatingFileHandler (haven't tried other handlers) do not get correctly initialized in python 2.7 when loaded using PyYaml. Therefore I suspect that there is some problem with the implementation of the pickle protocol of these clases in python 2.7. Attached you can find a small test to reproduce the problem. It works in python 2.5 and 2.6 but fails in python 2.7. In all cases I've used PyYaml 3.10. -- components: Extension Modules messages: 167864 nosy: jordipf priority: normal severity: normal status: open title: logging.FileHandler not correctly created with PyYaml (unpickling problems?) type: crash versions: Python 2.7 ___ Python tracker <http://bugs.python.org/issue15616> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15616] logging.FileHandler not correctly created with PyYaml (unpickling problems?)
Jordi Puigsegur added the comment: import logging import logging.handlers import yaml logger = logging.getLogger() # root logger # Option 1 - OK ##handler = logging.handlers.RotatingFileHandler(filename = "test.log", maxBytes = 262144, backupCount = 3) # Option 2 - RotatingFileHandler fails when created through yaml handler = yaml.load(""" !!python/object/new:logging.handlers.RotatingFileHandler kwds: filename: test.log maxBytes: 262144 backupCount: 3 """) # Option 3 - FileHandler also fails when created through yaml ##handler = yaml.load(""" ##!!python/object/new:logging.FileHandler ##kwds: ##filename: test.log ##""") logger.addHandler(handler) logger.warning("test handler") -- ___ Python tracker <http://bugs.python.org/issue15616> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15616] logging.FileHandler not correctly created with PyYaml (unpickling problems?)
Jordi Puigsegur added the comment: Thanks for your answer. I am not sure it is a PyYaml bug. Did you notice that the same code works perfectly (with the same version of PyYaml) using python 2.6 and python 2.5? Could it be that the issue lies in some change in the way the pickle protocol is implemented in logging classes? -- status: pending -> open ___ Python tracker <http://bugs.python.org/issue15616> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15616] logging.FileHandler not correctly created with PyYaml (unpickling problems?)
Jordi Puigsegur added the comment: This is the output of your script when run in python 2.6 and the exact same PyYaml version: C:\>test.py RotatingFileHandler using code: {'backupCount': 3, 'baseFilename': 'C:\\test.log', 'encoding': None, 'filters': [], 'formatter': None, 'level': 0, 'lock': <_RLock(None, 0)>, 'maxBytes': 262144, 'mode': 'a', 'stream': } RotatingFileHandler using YAML: {'backupCount': 3, 'baseFilename': 'C:\\test.log', 'encoding': None, 'filters': [], 'formatter': None, 'level': 0, 'lock': <_RLock(None, 0)>, 'maxBytes': 262144, 'mode': 'a', 'stream': } FileHandler using code: {'baseFilename': 'C:\\test.log', 'encoding': None, 'filters': [], 'formatter': None, 'level': 0, 'lock': <_RLock(None, 0)>, 'mode': 'a', 'stream': } FileHandler using YAML: {'baseFilename': 'C:\\test.log', 'encoding': None, 'filters': [], 'formatter': None, 'level': 0, 'lock': <_RLock(None, 0)>, 'mode': 'a', 'stream': } -- ___ Python tracker <http://bugs.python.org/issue15616> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15616] logging.FileHandler not correctly created with PyYaml (unpickling problems?)
Jordi Puigsegur added the comment: It looks like the change from old to new style classes in python could have triggered this issue. I've created an issue in PyYaml (http://pyyaml.org/ticket/283). Thanks again! -- status: open -> pending ___ Python tracker <http://bugs.python.org/issue15616> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com