[issue17941] namedtuple should support fully qualified name for more portable pickling

2016-09-12 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- resolution: -> fixed status: open -> closed versions: +Python 3.6 -Python 3.5 ___ Python tracker

[issue17941] namedtuple should support fully qualified name for more portable pickling

2016-09-12 Thread Roundup Robot
Roundup Robot added the comment: New changeset c8851a0ce7ca by Raymond Hettinger in branch 'default': Issue #17941: Add a *module* parameter to collections.namedtuple() https://hg.python.org/cpython/rev/c8851a0ce7ca -- nosy: +python-dev ___ Python

[issue17941] namedtuple should support fully qualified name for more portable pickling

2015-05-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: That will not work correctly if the module name has a dot in it. Pickling qualified names with arbitrary number of dots is supported in 3.4 with protocol 4 and in 3.5 with all protocols (backward compatibly). -- nosy: +serhiy.storchaka

[issue17941] namedtuple should support fully qualified name for more portable pickling

2014-06-14 Thread ctismer
ctismer added the comment: Ok, I almost forgot about this because I thought my idea was not considered, and wondered if I should keep that code online. It is still around, and I could put it into an experimental branch if someone asks for it. Missing pull-request on python.org. --

[issue17941] namedtuple should support fully qualified name for more portable pickling

2014-06-14 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- versions: +Python 3.5 -Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17941 ___

[issue17941] namedtuple should support fully qualified name for more portable pickling

2014-06-13 Thread Mark Lawrence
Mark Lawrence added the comment: Just slipped under the radar? -- nosy: +BreamoreBoy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17941 ___ ___

[issue17941] namedtuple should support fully qualified name for more portable pickling

2014-06-13 Thread Josh Rosenberg
Josh Rosenberg added the comment: I was already thinking of the same solution Christian.Tismer proposed before I reached his post. namedtuples seem cleaner if they naturally act as singletons, so (potentially whether or not pickling is involved) declaring a namedtuple with the same name and

[issue17941] namedtuple should support fully qualified name for more portable pickling

2014-06-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: Just slipped under the radar? Nope, I'll get to it before long. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17941 ___

[issue17941] namedtuple should support fully qualified name for more portable pickling

2013-06-11 Thread Christian Tismer
Christian Tismer added the comment: I would like to make an additional suggestion. (and I implemented this yesterday): Native namedtuple (not a derived class) can be made much simpler to handle when no module and class machinery is involved at all. The way I implemented it has no need for

[issue17941] namedtuple should support fully qualified name for more portable pickling

2013-06-10 Thread Stefan Drees
Changes by Stefan Drees ste...@drees.name: -- nosy: +dilettant ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17941 ___ ___ Python-bugs-list

[issue17941] namedtuple should support fully qualified name for more portable pickling

2013-05-13 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- keywords: +patch Added file: http://bugs.python.org/file30243/nt_module.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17941

[issue17941] namedtuple should support fully qualified name for more portable pickling

2013-05-13 Thread Guido van Rossum
Guido van Rossum added the comment: I'd like to propose one slight tweak to the patch. (Also to enum.py.) If no module name was passed and _getframe() fails, can you set the __module__ attribute to something that will cause pickling the object to fail? That would be much better than letting

[issue17941] namedtuple should support fully qualified name for more portable pickling

2013-05-13 Thread Richard Oudkerk
Richard Oudkerk added the comment: When pickling a class (or instance of a class) there is already a check that the invariant getattr(sys.modules[cls.__module__], cls.__name__) == cls holds. import pickle class A: pass ... A.__module__ = 'nonexistent' pickle.dumps(A()) Traceback

[issue17941] namedtuple should support fully qualified name for more portable pickling

2013-05-13 Thread Guido van Rossum
Guido van Rossum added the comment: Great, forget I said anything then. LGTM to the patch, feel free to commit (with update to Misc/NEWS please). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17941

[issue17941] namedtuple should support fully qualified name for more portable pickling

2013-05-13 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: LGTM too. Needs test and docs. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17941 ___ ___ Python-bugs-list

[issue17941] namedtuple should support fully qualified name for more portable pickling

2013-05-10 Thread Eli Bendersky
Eli Bendersky added the comment: A question that came up while reviewing the new enum code: module or module_name for this extra argument? The former is shorter, but the latter is more correct in a way. -- ___ Python tracker rep...@bugs.python.org

[issue17941] namedtuple should support fully qualified name for more portable pickling

2013-05-10 Thread Guido van Rossum
Guido van Rossum added the comment: Module, please. The class attribute is also called __module__ after all. On Friday, May 10, 2013, Eli Bendersky wrote: Eli Bendersky added the comment: A question that came up while reviewing the new enum code: module or module_name for this extra

[issue17941] namedtuple should support fully qualified name for more portable pickling

2013-05-10 Thread Eli Bendersky
Eli Bendersky added the comment: On Fri, May 10, 2013 at 7:02 AM, Guido van Rossum rep...@bugs.python.orgwrote: Guido van Rossum added the comment: Module, please. The class attribute is also called __module__ after all. Makes sense. Thanks. --

[issue17941] namedtuple should support fully qualified name for more portable pickling

2013-05-10 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- assignee: - rhettinger nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17941 ___

[issue17941] namedtuple should support fully qualified name for more portable pickling

2013-05-09 Thread Richard Oudkerk
Richard Oudkerk added the comment: If the name is a qualified dotted name, it will be split and the first part becomes the __module__. That will not work correctly if the module name has a dot in it. -- nosy: +sbt ___ Python tracker

[issue17941] namedtuple should support fully qualified name for more portable pickling

2013-05-09 Thread Eric V. Smith
Eric V. Smith added the comment: I agree it should work the same as Enum, and I agree it should be possible to supply the module name. But wouldn't it be cleaner as: Point = namedtuple('Point', 'x y z', module=__name__) rather than: Point = namedtuple(__name__ + '.Point', 'x y z') ?

[issue17941] namedtuple should support fully qualified name for more portable pickling

2013-05-09 Thread Barry A. Warsaw
Changes by Barry A. Warsaw ba...@python.org: -- nosy: +barry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17941 ___ ___ Python-bugs-list mailing

[issue17941] namedtuple should support fully qualified name for more portable pickling

2013-05-09 Thread Guido van Rossum
Guido van Rossum added the comment: Agreed with Eric. We're already modifying PEP 435 to do it that way. -- nosy: +gvanrossum ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17941 ___

[issue17941] namedtuple should support fully qualified name for more portable pickling

2013-05-08 Thread Eli Bendersky
New submission from Eli Bendersky: [this came up as part of the Enum discussions. Full details in this thread: http://mail.python.org/pipermail/python-dev/2013-May/126076.html] namedtuple currently uses this code to obtain the __module__ for the class it creates dynamically so that pickling