[issue37865] tempfile.NamedTemporaryFile() raises exception on close() when file is absent

2019-08-15 Thread Andrei Pashkin


New submission from Andrei Pashkin :

Here is an example:

import tempfile
import os


with tempfile.NamedTemporaryFile() as temp:
os.remove(temp.name)


And here is an error it produces:

Traceback (most recent call last):
  File "test.py", line 6, in 
os.remove(temp.name)
  File "/usr/lib/python3.7/tempfile.py", line 639, in __exit__
self.close()
  File "/usr/lib/python3.7/tempfile.py", line 646, in close
self._closer.close()
  File "/usr/lib/python3.7/tempfile.py", line 583, in close
unlink(self.name)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpzn8gtiz1'

--
messages: 349794
nosy: pashkin
priority: normal
severity: normal
status: open
title: tempfile.NamedTemporaryFile() raises exception on close() when file is 
absent
versions: Python 3.6, Python 3.7

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



[issue41062] Advanced Debugger Support C-API is useless without HEAD_LOCK()/HEAD_UNLOCK()

2020-06-21 Thread Andrei Pashkin


New submission from Andrei Pashkin :

To me it seems like Advanced Debugger Support C-API doesn't make sense without 
HEAD_LOCK() and HEAD_UNLOCK() which are private right now.

When researching how C-API works I've found this comment in the source code:
https://github.com/python/cpython/blob/e838a9324c1719bb917ca81ede8d766b5cb551f4/Python/pystate.c#L1176

It says that the lists of interpreter-state and thread-state objects (that Adv. 
Debugger Support API operates on) could be mutated even when GIL is held so 
there is need to acquire head mutex when accessing them. But there is no way to 
acquire head mutex using public C-API.

Am I right? If yes - it seems like HEAD_(UN)LOCK() should be made public.

--
components: C API
messages: 371988
nosy: pashkin
priority: normal
severity: normal
status: open
title: Advanced Debugger Support C-API is useless without 
HEAD_LOCK()/HEAD_UNLOCK()
type: behavior
versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

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



[issue41062] Advanced Debugger Support C-API is useless without HEAD_LOCK()/HEAD_UNLOCK()

2020-06-21 Thread Andrei Pashkin


Andrei Pashkin  added the comment:

Here is what I mean by "Advanced Debugger Support" API:
https://docs.python.org/dev/c-api/init.html#advanced-debugger-support

--

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