Skip to content

Commit

Permalink
patch Popen.__init__, not Popen
Browse files Browse the repository at this point in the history
asyncio.windows_utils subclasses/aliases Popen like this:

```python
class Popen(subprocess.Popen)
  def __init__(...):
    ...
    try:
      super().__init__(...)
    ...

```

Calling `partial()` on Popen directly works when
using it like a function, but breaks when
subclassing Popen (like asyncio does).

Closes rstudio/keras#1375
Closes #1478
  • Loading branch information
t-kalinowski committed Sep 13, 2023
1 parent 873094f commit 42fc525
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion inst/python/rpytools/subprocess.py
Expand Up @@ -6,4 +6,4 @@ def patch_subprocess_Popen():
import subprocess
from functools import partial

subprocess.Popen = partial(subprocess.Popen, stdin = subprocess.DEVNULL)
subprocess.Popen.__init__ = partial(subprocess.Popen.__init__, stdin = subprocess.DEVNULL)

0 comments on commit 42fc525

Please sign in to comment.