[issue45248] Documentation example in copyreg errors

2021-09-20 Thread Ciaran Welsh


Change by Ciaran Welsh :


--
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45248] Documentation example in copyreg errors

2021-09-20 Thread Ciaran Welsh


New submission from Ciaran Welsh :

The example on https://docs.python.org/3/library/copyreg.html does not work: 

```
import copyreg, copy, pickle
class C:
def __init__(self, a):
self.a = a

def pickle_c(c):
print("pickling a C instance...")
return C, (c.a,)

copyreg.pickle(C, pickle_c)
c = C(1)
d = copy.copy(c)

>   p = pickle.dumps(c)
E   AttributeError: Can't pickle local object 
'RoadRunnerPickleTests.test_ex..C'

picklable_swig_tests.py:133: AttributeError
```

--
assignee: docs@python
components: Documentation
messages: 402227
nosy: CiaranWelsh, docs@python
priority: normal
severity: normal
status: open
title: Documentation example in copyreg errors
type: behavior
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com