RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1223037 - Python raises exception on deepcopy of instance methods
Summary: Python raises exception on deepcopy of instance methods
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: python
Version: 6.7
Hardware: All
OS: All
urgent
urgent
Target Milestone: rc
: 6.7
Assignee: Python Maintainers
QA Contact: Branislav Náter
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-05-19 16:17 UTC by mulhern
Modified: 2015-07-22 06:40 UTC (History)
12 users (show)

Fixed In Version: python-2.6.6-64.el6
Doc Type: Bug Fix
Doc Text:
Cause: When using deepcopy on instance methods, a TypeError exception is thrown. Consequence: An exception TypeError is thrown, when using deepcopy on instance methods. Fix: Make deepcopy take shallow copies of functions and classes. Result: Deepcopy is now usable on instance methods.
Clone Of:
Environment:
Last Closed: 2015-07-22 06:40:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:1330 0 normal SHIPPED_LIVE Moderate: python security, bug fix, and enhancement update 2015-07-20 18:00:12 UTC

Description mulhern 2015-05-19 16:17:49 UTC
Description of problem:

Python 2.6 raises an exception on deepcopy of instance methods.

Version-Release number of selected component (if applicable):

2.6.6

How reproducible:

Always, if non-builtin instance method is explicitly deep copied.

Steps to Reproduce:
1. start python
2. type following at python prompt

>>> import uuid
>>> an_id = uuid.uuid1()
>>> import copy
>>> copy.deepcopy(an_id.get_bytes)

3. See TypeError: instancemethod expected...

Actual results:

TypeError raised

Expected results:

Deepcopy made.

Additional info:

The patch is located here: https://hg.python.org/cpython/rev/83c702c17e02/.
It landed in Python 2.7 and has remained stable since.

Comment 4 Branislav Náter 2015-06-12 16:27:50 UTC
Reproduced on python-2.6.6-52.el6:

:: [  BEGIN   ] :: Run reproducer :: actually running 'python test.py'
Traceback (most recent call last):
  File "test.py", line 5, in <module>
    copy.deepcopy(an_id.get_bytes)
  File "/usr/lib64/python2.6/copy.py", line 189, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/usr/lib64/python2.6/copy.py", line 323, in _reconstruct
    y = callable(*args)
  File "/usr/lib64/python2.6/copy_reg.py", line 93, in __newobj__
    return cls.__new__(cls, *args)
TypeError: instancemethod expected at least 2 arguments, got 0
:: [   FAIL   ] :: Run reproducer (Expected 0, got 1)

Verified on python-2.6.6-64.el6:
:: [  BEGIN   ] :: Run reproducer :: actually running 'python test.py'
:: [   PASS   ] :: Run reproducer (Expected 0, got 0)

Comment 5 errata-xmlrpc 2015-07-22 06:40:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-1330.html


Note You need to log in before you can comment on or make changes to this bug.