[issue41237] Access violation in python39.dll!meth_dealloc on exit

2020-11-09 Thread Petr Viktorin


Change by Petr Viktorin :


--
nosy: +petr.viktorin

___
Python tracker 

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



[issue41237] Access violation in python39.dll!meth_dealloc on exit

2020-07-09 Thread Christoph Gohlke


Christoph Gohlke  added the comment:

This issue seems specific to C extensions built with pybind11 (using 2.5.0 and 
master branch). Building the minimal example at 
https://github.com/pybind/python_example and running `python.exe -c"import 
python_example"` will crash at exit.

--
status: open -> closed

___
Python tracker 

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



[issue41237] Access violation in python39.dll!meth_dealloc on exit

2020-07-08 Thread Christoph Gohlke


Change by Christoph Gohlke :


--
status: closed -> open

___
Python tracker 

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



[issue41237] Access violation in python39.dll!meth_dealloc on exit

2020-07-08 Thread Christoph Gohlke


Christoph Gohlke  added the comment:

I tracked this to an import of the numba-0.50.1 package during the numpy tests. 
`python -c"import numba'` is enough to reproduce this crash during interpreter 
exit. Probably the package needs to be ported to Python 3.9.

--
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



[issue41237] Access violation in python39.dll!meth_dealloc on exit

2020-07-08 Thread Christoph Gohlke


Change by Christoph Gohlke :


--
type:  -> crash

___
Python tracker 

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



[issue41237] Access violation in python39.dll!meth_dealloc on exit

2020-07-08 Thread Christoph Gohlke


New submission from Christoph Gohlke :

When testing extension packages on Python 3.9.0b4 for Windows, I often get 
access violations in `python39.dll!meth_dealloc` during interpreter exit. The 
crash only happens when heap verification is turned on (`"C:\Program Files 
(x86)\Windows Kits\10\Debuggers\x86\gflags.exe" /p /enable python.exe`; 
https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/gflags). The 
debug build does not crash.

Could be related to "PEP 573: Module State Access from C Extension Methods", 
https://bugs.python.org/issue38787

To reproduce the crash with with numpy-1.19.0 (built from source):
```
Python 3.9.0b4 (tags/v3.9.0b4:69dec9c, Jul  2 2020, 21:46:36) [MSC v.1924 64 
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy;numpy.test()
NumPy version 1.19.0

10364 passed, 438 skipped, 108 deselected, 17 xfailed, 1 xpassed in 243.52s 
(0:04:03)
True
>>> exit()
Windows fatal exception: access violation

Current thread 0x2688 (most recent call first):

```

The crash is at 
:
```
static void
meth_dealloc(PyCFunctionObject *m)
{
_PyObject_GC_UNTRACK(m);
if (m->m_weakreflist != NULL) {
PyObject_ClearWeakRefs((PyObject*) m);
}
Py_XDECREF(m->m_self);
Py_XDECREF(m->m_module);
Py_XDECREF(PyCFunction_GET_CLASS(m));  /* <-- crash */
PyObject_GC_Del(m);
}
```

Call Stack:
```
>   python39.dll!meth_dealloc(PyCFunctionObject * m) Line 169   C
[Inline Frame] python39.dll!_Py_Dealloc(_object *) Line 2209C
[Inline Frame] python39.dll!_Py_DECREF(_object *) Line 430  C
[Inline Frame] python39.dll!_Py_XDECREF(_object * op) Line 497  C
[Inline Frame] python39.dll!free_keys_object(_dictkeysobject *) Line 
598C
[Inline Frame] python39.dll!dictkeys_decref(_dictkeysobject *) Line 333 
C
python39.dll!dict_dealloc(PyDictObject * mp) Line 2026  C
[Inline Frame] python39.dll!_Py_Dealloc(_object *) Line 2209C
[Inline Frame] python39.dll!_Py_DECREF(_object *) Line 430  C
python39.dll!_PyInterpreterState_ClearModules(_is * interp) Line 768
C
python39.dll!_PyImport_Cleanup(_ts * tstate) Line 628   C
python39.dll!Py_FinalizeEx() Line 1432  C
python39.dll!Py_Exit(int sts) Line 2433 C
python39.dll!handle_system_exit() Line 696  C
python39.dll!_PyErr_PrintEx(_ts * tstate, int set_sys_last_vars) Line 
708   C
[Inline Frame] python39.dll!PyErr_Print() Line 807  C
python39.dll!PyRun_InteractiveLoopFlags(_iobuf * fp, const char * 
filename_str, PyCompilerFlags * flags) Line 137   C
python39.dll!PyRun_AnyFileExFlags(_iobuf * fp, const char * filename, 
int closeit, PyCompilerFlags * flags) Line 81 C
python39.dll!pymain_run_stdin(PyConfig * config, PyCompilerFlags * cf) 
Line 509 C
python39.dll!pymain_run_python(int * exitcode) Line 597 C
python39.dll!Py_RunMain() Line 675  C
python39.dll!Py_Main(int argc, wchar_t * * argv) Line 716   C
[External Code] 
```

Locals:
```
-   m   0x01fbea75ddb0 {ob_base={ob_refcnt=0 
ob_type=0x7fff5a1e5650 {python39.dll!_typeobject PyCFunction_Type} {...} } 
...}PyCFunctionObject *
-   ob_base {ob_refcnt=0 ob_type=0x7fff5a1e5650 
{python39.dll!_typeobject PyCFunction_Type} {ob_base={ob_base=...} ...} }   
_object
ob_refcnt   0   __int64
-   ob_type 0x7fff5a1e5650 {python39.dll!_typeobject 
PyCFunction_Type} {ob_base={ob_base={ob_refcnt=23 ob_type=...} ...} ...}   
_typeobject *
+   ob_base {ob_base={ob_refcnt=23 ob_type=0x7fff5a1e7c60 
{python39.dll!_typeobject PyType_Type} {ob_base={ob_base=...} ...} } ...} 
PyVarObject
+   tp_name 0x7fff5a16d8a0 "builtin_function_or_method" const 
char *
tp_basicsize56  __int64
tp_itemsize 0   __int64
tp_dealloc  0x7fff59e2c260 
{python39.dll!meth_dealloc(PyCFunctionObject *)} void(*)(_object *)
tp_vectorcall_offset48  __int64
tp_getattr  0x  _object *(*)(_object *, 
char *)
tp_setattr  0x  int(*)(_object *, char 
*, _object *)
+   tp_as_async 0xPyAsyncMethods *
tp_repr 0x7fff59e5c430 
{python39.dll!meth_repr(PyCFunctionObject *)}_object *(*)(_object *)
+   tp_as_number0xPyNumberMethods 
*
+   tp_as_sequence  0x
PySequenceMethods *
+   tp_as_mapping   0x
PyMappingMethods *
tp_hash 0x7fff59f44768