[issue42406] Importing multiprocessing breaks pickle.whichmodule
Renato Cunha added the comment: No worries, Gregory. Glad I could help. :-) -- ___ Python tracker <https://bugs.python.org/issue42406> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42406] Importing multiprocessing breaks pickle.whichmodule
Change by Renato Cunha : -- keywords: +patch pull_requests: +22295 stage: -> patch review pull_request: https://github.com/python/cpython/pull/23403 ___ Python tracker <https://bugs.python.org/issue42406> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42406] Importing multiprocessing breaks pickle.whichmodule
Change by Renato Cunha : -- components: +Library (Lib) -Interpreter Core ___ Python tracker <https://bugs.python.org/issue42406> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42406] Importing multiprocessing breaks pickle.whichmodule
New submission from Renato Cunha : Importing multiprocessing prior to other modules that define `ufunc`s breaks pickle.whichmodule for those functions. Example: Python 3.8.6 (default, Sep 30 2020, 04:00:38) [GCC 10.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import multiprocessing >>> from scipy.special import gdtrix >>> from pickle import whichmodule >>> whichmodule(gdtrix, gdtrix.__name__) '__mp_main__' Now, if we change the order of imports, whichmodule works fine: Python 3.8.6 (default, Sep 30 2020, 04:00:38) [GCC 10.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from scipy.special import gdtrix >>> from pickle import whichmodule >>> import multiprocessing >>> whichmodule(gdtrix, gdtrix.__name__) 'scipy.special._ufuncs' This happens because multiprocessing creates an alias to `__main__` when imported: Lib/multiprocessing/__init__.py 37:sys.modules['__mp_main__'] = sys.modules['__main__'] But doing so changes the ordering of `sys.modules`, and `whichmodule` returns `__mp_main__` instead of the correct `scipy.special._ufuncs`. This bug has arisen in the context of using `dill` (which imports multiprocessing) for serialization and is further documented at https://github.com/uqfoundation/dill/issues/392. I intend to submit a patch/PR with a fix soon. -- components: Interpreter Core messages: 381410 nosy: renatolfc priority: normal severity: normal status: open title: Importing multiprocessing breaks pickle.whichmodule type: behavior versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue42406> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15375] Trivial for fix in the subprocess documentation
New submission from Renato Cunha ren...@renatocunha.com: The word child is needlessly repeated in the subprocess documentation. This trivial patch fixes this. -- assignee: docs@python components: Documentation files: subprocess.diff keywords: patch messages: 165670 nosy: docs@python, trovao priority: normal severity: normal status: open title: Trivial for fix in the subprocess documentation type: enhancement versions: Python 2.7 Added file: http://bugs.python.org/file26408/subprocess.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15375 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9014] Incorrect documentation of the PyObject_HEAD macro
New submission from Renato Cunha ren...@renatocunha.com: PyObject_HEAD's documentation in py3k (http://docs.python.org/dev/py3k/c-api/structures.html#PyObject_HEAD) uses the same content used in the python 2.x's docs which is wrong, as there were some API changes. PyObject_HEAD is actually defined as #define PyObject_HEAD PyObject ob_base; with PyObject defined as typedef struct _object { _PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt; struct _typeobject *ob_type; } PyObject; (The PyTRACE_REFS discussion is still valid, though.) Additionally, it'd be nice to mention that the Py_REFCNT(ob) and Py_TYPE(ob) macros should be used to access the PyObject members. -- assignee: d...@python components: Documentation messages: 107953 nosy: d...@python, trovao priority: normal severity: normal status: open title: Incorrect documentation of the PyObject_HEAD macro type: behavior versions: Python 3.1, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9014 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9001] PyFile_FromFd wrong documentation
New submission from Renato Cunha ren...@renatocunha.com: PyFile_FromFd has a wrong argument cound and, consequently, a wrong description in py3k docs. The errors is never mentioned. -- assignee: d...@python components: Documentation files: correct-py3k-c-api-doc.diff keywords: patch messages: 107879 nosy: d...@python, trovao priority: normal severity: normal status: open title: PyFile_FromFd wrong documentation type: behavior versions: Python 3.2, Python 3.3 Added file: http://bugs.python.org/file17677/correct-py3k-c-api-doc.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9001 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9002] Add a pointer on where to find a better description of PyFile_FromFd arguments
New submission from Renato Cunha ren...@renatocunha.com: Even though the File Objects section in py3k documentation makes it clear that the functions there listed are just wrappers over the io module, it took me a bit to find which function PyFile_FromFd was wrapping. So, what about making it clear that PyFile_FromFd wraps io.open? The attached patch tries to do that. (It assumes that my previous patch, from issue #9001, will get accepted, as it builds on it.) -- assignee: d...@python components: Documentation files: py3k-pyfile-from-fd-io-module.diff keywords: patch messages: 107881 nosy: d...@python, trovao priority: normal severity: normal status: open title: Add a pointer on where to find a better description of PyFile_FromFd arguments type: feature request versions: Python 3.2, Python 3.3 Added file: http://bugs.python.org/file17678/py3k-pyfile-from-fd-io-module.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9002 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7400] Small typo in Python's library documentation: set
New submission from Renato Cunha ren...@renatocunha.com: In the documentation of the built-in functions, the description of set says Return a new set, optionally with elements ARE taken from iterable. The referenced text should be either ... optionally with elements taken from iterable. -- assignee: georg.brandl components: Documentation files: set-typo-fix.diff keywords: patch messages: 95752 nosy: georg.brandl, trovao severity: normal status: open title: Small typo in Python's library documentation: set type: behavior versions: Python 2.6 Added file: http://bugs.python.org/file15399/set-typo-fix.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7400 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com