Skip to content

Should Python.Runtime.Py.With use Runtime.None instead of new PyObject(Runtime.PyNone)? #1192

@IvanAntipov

Description

@IvanAntipov

I'm not sure if I'm right, but I apologize in advance if I'm misleading the community

After long exectution (I train large ML model), I fall into Fatal Python error: deallocating None

Fatal Python error: deallocating None

Current thread 0x00007fc518efd700 (most recent call first):

Thread 0x00007fc4997fe700 (most recent call first):
  File "/usr/local/lib/python3.7/threading.py", line 300 in wait
  File "/usr/local/lib/python3.7/queue.py", line 179 in get
  File "/usr/local/lib/python3.7/site-packages/tensorboard/summary/writer/event_file_writer.py", line 232 in run
  File "/usr/local/lib/python3.7/threading.py", line 926 in _bootstrap_inner
  File "/usr/local/lib/python3.7/threading.py", line 890 in _bootstrap

Sadly, I can't provide full repro, because problem does not occur in small data set, and I work on private project.

In my code I use Should Python.Runtime.Py.With method.

In this method I see PyNone to be used without increment of references count

IntPtr type = Runtime.PyNone;
...
new PyObject(type)

As I undestand from stackoverflow each usage of None should increment Ref counter.

There is Python.Runtime.Runtime.None property

Should Runtime.None be used instead of Runtime.PyNone

Environment

  • Pythonnet version: pythonnet_netstandard (I know, it is a fork of this project, but the code under dicussion is under this project) "Python.Runtime.Mono" Version="3.7.1"
  • Python version: 3.7.7
  • Operating System: Ubuntu 18.04.3 (in docker)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions