[issue5773] Crash on shutdown after os.fdopen(2) in debug builds

2020-11-30 Thread Irit Katriel


Irit Katriel  added the comment:

Python 2.7 is no longer being maintained.

--
nosy: +iritkatriel
resolution:  -> out of date
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



[issue5773] Crash on shutdown after os.fdopen(2) in debug builds

2019-04-26 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue5773] Crash on shutdown after os.fdopen(2) in debug builds

2014-07-13 Thread Mark Lawrence

Mark Lawrence added the comment:

Using latest default.

c:\cpython\PCbuild>python_d -c "import os; os.fdopen(2)"
-c:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=2 mode='r' 
encoding='cp1252'>

Do we need to do anything with 2.7, can this be closed or what?

--
nosy: +BreamoreBoy
versions:  -Python 2.6

___
Python tracker 

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



[issue5773] Crash on shutdown after os.fdopen(2) in debug builds

2013-05-10 Thread Anselm Kruis

Anselm Kruis added the comment:

Hi,

I was faced with a very similar problem also caused by an invalid file 
descriptor.

My solution is to set an invalid parameter handler, that does nothing. This 
effectively disables Dr. Watson. Perhaps this is a suitable solution for other 
users too. And it does not require a patch.

def set_invalid_parameter_handler(flag):
"""
Set the MSVCRT invalid parameter handler.

If flag is True, this function sets an invalid parameter handler,
that does nothing. This effectively disables Dr. Watson.
If flag is an integer number, it must be the address of an 
invalid parameter handler function. 
If flag is None, this function removes the invalid parameter
handler. This effectively enables Dr. Watson.

The return value is the address of the current handler or None,
if no handler is installed.

Example::

old = set_invalid_parameter_handler(True)
try:
do_something_nasty
finally:
set_invalid_parameter_handler(old)
 
"""
try:
# get the msvcrt library
import ctypes.util
libc = ctypes.util.find_msvcrt()
if not libc:
# probably not windows
return None
libc = getattr(ctypes.cdll, libc)
siph = libc._set_invalid_parameter_handler
siph.restype = ctypes.c_void_p
siph.argtypes = [ ctypes.c_void_p ]
# now we need a suitable handler. 
# The handler must simply return without performing any actions.
# Of course there is none.
# But if we look at the calling convention (cdecl), and 
# at the fact, that we don't need the argument values
# we find, that we can call any function, as long as the function 
# does not harm. A suitable function is "int abs(abs)".
null_handler = libc.abs
except Exception:
# probably not the correct windows version 
return None
if flag is True:
flag = null_handler
return siph(flag)

--
nosy: +anselm.kruis

___
Python tracker 

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



[issue5773] Crash on shutdown after os.fdopen(2) in debug builds

2013-01-16 Thread Ramchandra Apte

Ramchandra Apte added the comment:

Though it may be valid in Python 2.7 still.

On 16 January 2013 10:53, Ramchandra Apte  wrote:

>
> Ramchandra Apte added the comment:
>
> Is this still valid because this seems fixed in latest Python 3.4 tip.
>
> --
> nosy: +ramchandra.apte
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue5773] Crash on shutdown after os.fdopen(2) in debug builds

2013-01-15 Thread Ramchandra Apte

Ramchandra Apte added the comment:

Is this still valid because this seems fixed in latest Python 3.4 tip.

--
nosy: +ramchandra.apte

___
Python tracker 

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



[issue5773] Crash on shutdown after os.fdopen(2) in debug builds

2009-04-17 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I thought there was a _PyVerify_Fd() just for that, why couldn't it be
used here too?
(not that I think sparkling _PyVerify_Fd() everywhere in our code base
is reasonable and maintainable, but I didn't make that choice :-))

--
nosy: +pitrou

___
Python tracker 

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



[issue5773] Crash on shutdown after os.fdopen(2) in debug builds

2009-04-16 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Sure. But we tried hard to remove all these assertion failures, so that 
python never shows a popup dialog.

--

___
Python tracker 

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



[issue5773] Crash on shutdown after os.fdopen(2) in debug builds

2009-04-16 Thread Amaury Forgeot d'Arc

New submission from Amaury Forgeot d'Arc :

With a 2.6 or 2.7 debug build:
python_d -c "import os; os.fdopen(2)"

Displays the famous Debug Assertion Failure:
...
Expression: (_osfile(fh) & FOPEN)
...

The error occurs when closing pyhon, in call_ll_exitfuncs() there is a
call to fflush(stderr)

--
assignee: krisvale
components: Windows
messages: 86026
nosy: amaury.forgeotdarc, krisvale
severity: normal
status: open
title: Crash on shutdown after os.fdopen(2) in debug builds
versions: Python 2.6, Python 2.7

___
Python tracker 

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