[issue43093] Make modules picklable

2021-08-20 Thread Cornelius Krupp


Cornelius Krupp  added the comment:

I would also like to see this added, and I can also provided a usecase where I 
naturally came across this.

I am helping on a parsing library which uses regular expressions internally. We 
allow the user to select the stdlib re module or the third party regex module 
and store the selected module as an attribute in multiple different objects, 
since those modules (by design) have pretty much compatible interfaces. This 
however makes it unpicklable, unless one adds a custom __reduce__ function for 
each of those classes.

Most notably, this issue also extends to deepcopy and the multiprocessing 
module.

--
nosy: +MegaIng

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



[issue42286] f_trace gets call on different lines each loop

2020-11-07 Thread Cornelius Krupp


New submission from Cornelius Krupp :

When using a local trace function, sometimes the line event is issued at the 
wrong time. As can be seen from the example file `f_trace_wrong_line.py`, each 
loop iteration we get either 24 or 23, apparently in a fixed rhythm.

While this might seem harmless, it appears that the line event for 23 (In this 
example) is issued at a time where the state of the stack is not valid to 
switch line. I noticed this because I wanted to implement a context manager 
that skips to a specific line, but this broken with mysterious error message 
`TypeError: 'NoneType' object is not callable` which I think is caused by the 
`with`-line not being fully executed and the stack still having the return 
value of `__enter__` on it.



Here the intro line of the interpreter:

Python 3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC v.1927 64 bit 
(AMD64)] on win32

--
components: Interpreter Core
files: f_trace_wrong_line.py
messages: 380527
nosy: trampchamp
priority: normal
severity: normal
status: open
title: f_trace gets call on different lines each loop
type: behavior
versions: Python 3.9
Added file: https://bugs.python.org/file49580/f_trace_wrong_line.py

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