[issue42705] Intercepting thread lock objects not working under context managers

2021-01-17 Thread Jeremy Kloth


Change by Jeremy Kloth :


--
components:  -Distutils

___
Python tracker 

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



[issue42705] Intercepting thread lock objects not working under context managers

2020-12-21 Thread Mohamad Kanj


Mohamad Kanj  added the comment:

Thanks Raymond for the input.
So with some experimentation, the __enter__() & __exit__() functions could be 
traceable when other kinds of objects are used with the context manager (i.e 
with statement using file IO or custom class objects). However, just when the 
object is a Lock object, then this is not the case anymore - which basically 
shows an unusual behavior if we were to think that such statements are executed 
for a specific thread. Also please mind that the threading module already 
implements settrace() and setprofile() methods like the sys module to extend 
tracing capabilities.

--

___
Python tracker 

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



[issue42705] Intercepting thread lock objects not working under context managers

2020-12-21 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The sys.setprofile() doc don't make it clear whether the __enter__ and __exit__ 
call were intended to be traceable events.  The docs do state, "there is no way 
for the profiler to know about context switches between threads, so it does not 
make sense to use this in the presence of multiple threads."

--
nosy: +rhettinger, vstinner

___
Python tracker 

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



[issue42705] Intercepting thread lock objects not working under context managers

2020-12-21 Thread Mohamad Kanj


New submission from Mohamad Kanj :

The interception of Python and C functions is achieved through the `sys` module 
- however, when using thread locks from `threading` module for instance under 
context managers, the calls on the lock to `acquire()` and `release()` cannot 
be witnessed. If these methods were to be called explicitly then this is no 
problem.

--

___
Python tracker 

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



[issue42705] Intercepting thread lock objects not working under context managers

2020-12-21 Thread Mohamad Kanj


Change by Mohamad Kanj :


--
assignee: docs@python
components: C API, Demos and Tools, Distutils, Documentation
files: tracing-locking-mechanisms.py
nosy: docs@python, dstufft, eric.araujo, mhmdkanj
priority: normal
severity: normal
status: open
title: Intercepting thread lock objects not working under context managers
type: behavior
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file49695/tracing-locking-mechanisms.py

___
Python tracker 

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