[New-bugs-announce] [issue29902] copy breaks staticmethod

Bruce Frederiksen report at bugs.python.org
Sat Mar 25 09:16:44 EDT 2017


New submission from Bruce Frederiksen:

Doing a copy on a staticmethod breaks it:

Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from copy import copy
>>> def foo(): pass
... 
>>> class bar: pass
... 
>>> bar.x = staticmethod(foo)
>>> bar.x.__name__
'foo'
>>> bar.y = copy(staticmethod(foo))
>>> bar.y.__name__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: uninitialized staticmethod object

----------
components: Library (Lib)
messages: 290481
nosy: dangyogi
priority: normal
severity: normal
status: open
title: copy breaks staticmethod
type: behavior
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29902>
_______________________________________


More information about the New-bugs-announce mailing list