We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Jython - Internal error detected.
@kostermw commented on [Sat Dec 15 2018](https://github.com/Microsoft/vscode-python/issues/3715)

<!-- 
Do you have a question instead of a bug report or enhancement request? Please ask it on https://stackoverflow.com/questions/tagged/visual-studio-code+python. 

Unable to install a linter or formatter? 'No installers available'? 
Windows - https://stackoverflow.com/questions/4750806/how-do-i-install-pip-on-windows
Linux - https://www.cyberciti.biz/faq/debian-ubuntu-centos-rhel-linux-install-pipclient/ , https://www.tecmint.com/install-pip-in-linux/

Python configuration issues? Please check https://code.visualstudio.com/docs/python/python-tutorial#_prerequisites

Otherwise **please** fill in the requested details below. "XXX" markers should not be present in the final bug report.

If you think a GIF of what is happening would be helpful, consider tools like https://www.cockos.com/licecap/, https://github.com/phw/peek or https://www.screentogif.com/ .
-->

## Environment data

- VS Code version: 1.30.0
- Extension version (available under the Extensions sidebar): 2018.12.1
- OS and version: W10 Pro 1803 build 17134.471
- Python version (& distribution if applicable, e.g. Anaconda): Jython 2.7.0
- Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
- Relevant/affected Python packages and their versions: XXX

## Expected behaviour

XXX

## Actual behaviour

XXX

## Steps to reproduce:
1. debugging hello world example

## Logs
Output for `Python` in the `Output` panel (`View`→`Output`, change the drop-down the upper-right of the `Output` panel to `Python`)

```
XXX
```   

Output from `Console` under the `Developer Tools` panel (toggle Developer Tools on under `Help`)

```
PS D:\Users\koste\vs\hello> cd 'd:\Users\koste\vs\hello'; ${env:PYTHONIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFERED}='1'; & 'C:\jython2.7.0\bin\jython.exe' 'd:\Users\koste\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\ptvsd_launcher.py' '--default' '--client' '--host' 'localhost' '--port' '51023' 'd:\Users\koste\vs\hello\hello.py'
Traceback (most recent call last):
  File "d:\Users\koste\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\ptvsd_launcher.py", line 21, in <module>
    import ptvsd
  File "d:\Users\koste\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\ptvsd_launcher.py", line 21, in <module>
    import ptvsd
  File "d:\Users\koste\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\__init__.py", line 15, in <module>
    from ptvsd.attach_server import (
  File "d:\Users\koste\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\attach_server.py", line 5, in <module>
    from ptvsd._remote import (
  File "d:\Users\koste\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\_remote.py", line 11, in <module>
    from ptvsd.pydevd_hooks import install
  File "d:\Users\koste\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\pydevd_hooks.py", line 15, in <module>
    from ptvsd.daemon import Daemon, DaemonStoppedError, DaemonClosedError
  File "d:\Users\koste\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\daemon.py", line 12, in <module>
    from .exit_handlers import (
  File "d:\Users\koste\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\exit_handlers.py", line 28, in <module>
    class ExitHandlers(object):
  File "d:\Users\koste\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\exit_handlers.py", line 36, in ExitHandlers
    SIGNALS = [
AttributeError: 'module' object has no attribute 'SIGHUP'

Internal error detected. Please copy the above traceback and report at
https://github.com/Microsoft/vscode-python/issues/new
```


---

@kostermw commented on [Sat Dec 15 2018](https://github.com/Microsoft/vscode-python/issues/3715#issuecomment-447572774)

Reported as requested 



--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/ptvsd/exit_handlers.py`
Content:
```
1 # Copyright (c) Microsoft Corporation. All rights reserved.
2 # Licensed under the MIT License. See LICENSE in the project root
3 # for license information.
4 
5 import atexit
6 import os
7 import platform
8 import signal
9 
10 
11 class AlreadyInstalledError(RuntimeError):
12     """Exit handlers were already installed."""
13 
14 
15 class UnsupportedSignalError(RuntimeError):
16     """A signal is not supported."""
17 
18 
19 def kill_current_proc(signum=signal.SIGTERM):
20     """Kill the current process.
21 
22     Note that this directly kills the process (with SIGTERM, by default)
23     rather than using sys.exit().
24     """
25     os.kill(os.getpid(), signum)
26 
27 
28 class ExitHandlers(object):
29     """Manages signal and atexit handlers."""
30 
31     if platform.system() == 'Windows':
32         # TODO: Windows *does* support these signals:
33         #  SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, SIGTERM, SIGBREAK
34         SIGNALS = []
35     else:
36         SIGNALS = [
37             signal.SIGHUP,
38         ]
39 
40     def __init__(self):
41         self._signal_handlers = {sig: []
42                                  for sig in self.SIGNALS}
43         self._atexit_handlers = []
44         self._installed = False
45 
46     @property
47     def supported_signals(self):
48         return set(self.SIGNALS)
49 
50     @property
51     def installed(self):
52         return self._installed
53 
54     def install(self):
55         """Set the parent handlers.
56 
57         This must be called in the main thread.
58         """
59         if self._installed:
60             raise AlreadyInstalledError('exit handlers already installed')
61         self._installed = True
62         self._install_signal_handler()
63         self._install_atexit_handler()
64 
65     # TODO: Add uninstall()?
66 
67     def add_atexit_handler(self, handle_atexit, nodupe=True):
68         """Add an atexit handler to the list managed here."""
69         if nodupe and handle_atexit in self._atexit_handlers:
70             raise ValueError('atexit handler alraedy added')
71         self._atexit_handlers.append(handle_atexit)
72 
73     def add_signal_handler(self, signum, handle_signal, nodupe=True,
74                            ignoreunsupported=False):
75         """Add a signal handler to the list managed here."""
76         # TODO: The initialization of self.SIGNALS should make this
77         # special-casing unnecessary.
78         if platform.system() == 'Windows':
79             return
80 
81         try:
82             handlers = self._signal_handlers[signum]
83         except KeyError:
84             if ignoreunsupported:
85                 return
86             raise UnsupportedSignalError(signum)
87         if nodupe and handle_signal in handlers:
88             raise ValueError('signal handler alraedy added')
89         handlers.append(handle_signal)
90 
91     # internal methods
92 
93     def _install_signal_handler(self):
94         # TODO: The initialization of self.SIGNALS should make this
95         # special-casing unnecessary.
96         if platform.system() == 'Windows':
97             return
98 
99         orig = {}
100         try:
101             for sig in self._signal_handlers:
102                 # TODO: Skip or fail if signal.getsignal() returns None?
103                 orig[sig] = signal.signal(sig, self._signal_handler)
104         except ValueError:
105             # Wasn't called in main thread!
106             raise
107 
108     def _signal_handler(self, signum, frame):
109         for handle_signal in self._signal_handlers.get(signum, ()):
110             handle_signal(signum, frame)
111 
112     def _install_atexit_handler(self):
113         self._atexit_handlers = []
114         atexit.register(self._atexit_handler)
115 
116     def _atexit_handler(self):
117         for handle_atexit in self._atexit_handlers:
118             handle_atexit()
119
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/ptvsd/exit_handlers.py b/src/ptvsd/exit_handlers.py
--- a/src/ptvsd/exit_handlers.py
+++ b/src/ptvsd/exit_handlers.py
@@ -28,7 +28,7 @@
 class ExitHandlers(object):
     """Manages signal and atexit handlers."""
 
-    if platform.system() == 'Windows':
+    if platform.system() == 'Windows' or not hasattr(signal, 'SIGHUP'):
         # TODO: Windows *does* support these signals:
         #  SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, SIGTERM, SIGBREAK
         SIGNALS = []

{"golden_diff": "diff --git a/src/ptvsd/exit_handlers.py b/src/ptvsd/exit_handlers.py\n--- a/src/ptvsd/exit_handlers.py\n+++ b/src/ptvsd/exit_handlers.py\n@@ -28,7 +28,7 @@\n class ExitHandlers(object):\n     \"\"\"Manages signal and atexit handlers.\"\"\"\n \n-    if platform.system() == 'Windows':\n+    if platform.system() == 'Windows' or not hasattr(signal, 'SIGHUP'):\n         # TODO: Windows *does* support these signals:\n         #  SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, SIGTERM, SIGBREAK\n         SIGNALS = []\n", "issue": "Jython - Internal error detected.\n@kostermw commented on [Sat Dec 15 2018](https://github.com/Microsoft/vscode-python/issues/3715)\n\n<!-- \r\nDo you have a question instead of a bug report or enhancement request? Please ask it on https://stackoverflow.com/questions/tagged/visual-studio-code+python. \r\n\r\nUnable to install a linter or formatter? 'No installers available'? \r\nWindows - https://stackoverflow.com/questions/4750806/how-do-i-install-pip-on-windows\r\nLinux - https://www.cyberciti.biz/faq/debian-ubuntu-centos-rhel-linux-install-pipclient/ , https://www.tecmint.com/install-pip-in-linux/\r\n\r\nPython configuration issues? Please check https://code.visualstudio.com/docs/python/python-tutorial#_prerequisites\r\n\r\nOtherwise **please** fill in the requested details below. \"XXX\" markers should not be present in the final bug report.\r\n\r\nIf you think a GIF of what is happening would be helpful, consider tools like https://www.cockos.com/licecap/, https://github.com/phw/peek or https://www.screentogif.com/ .\r\n-->\r\n\r\n## Environment data\r\n\r\n- VS Code version: 1.30.0\r\n- Extension version (available under the Extensions sidebar): 2018.12.1\r\n- OS and version: W10 Pro 1803 build 17134.471\r\n- Python version (& distribution if applicable, e.g. Anaconda): Jython 2.7.0\r\n- Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A\r\n- Relevant/affected Python packages and their versions: XXX\r\n\r\n## Expected behaviour\r\n\r\nXXX\r\n\r\n## Actual behaviour\r\n\r\nXXX\r\n\r\n## Steps to reproduce:\r\n1. debugging hello world example\r\n\r\n## Logs\r\nOutput for `Python` in the `Output` panel (`View`\u2192`Output`, change the drop-down the upper-right of the `Output` panel to `Python`)\r\n\r\n```\r\nXXX\r\n```   \r\n\r\nOutput from `Console` under the `Developer Tools` panel (toggle Developer Tools on under `Help`)\r\n\r\n```\r\nPS D:\\Users\\koste\\vs\\hello> cd 'd:\\Users\\koste\\vs\\hello'; ${env:PYTHONIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFERED}='1'; & 'C:\\jython2.7.0\\bin\\jython.exe' 'd:\\Users\\koste\\.vscode\\extensions\\ms-python.python-2018.12.1\\pythonFiles\\ptvsd_launcher.py' '--default' '--client' '--host' 'localhost' '--port' '51023' 'd:\\Users\\koste\\vs\\hello\\hello.py'\r\nTraceback (most recent call last):\r\n  File \"d:\\Users\\koste\\.vscode\\extensions\\ms-python.python-2018.12.1\\pythonFiles\\ptvsd_launcher.py\", line 21, in <module>\r\n    import ptvsd\r\n  File \"d:\\Users\\koste\\.vscode\\extensions\\ms-python.python-2018.12.1\\pythonFiles\\ptvsd_launcher.py\", line 21, in <module>\r\n    import ptvsd\r\n  File \"d:\\Users\\koste\\.vscode\\extensions\\ms-python.python-2018.12.1\\pythonFiles\\lib\\python\\ptvsd\\__init__.py\", line 15, in <module>\r\n    from ptvsd.attach_server import (\r\n  File \"d:\\Users\\koste\\.vscode\\extensions\\ms-python.python-2018.12.1\\pythonFiles\\lib\\python\\ptvsd\\attach_server.py\", line 5, in <module>\r\n    from ptvsd._remote import (\r\n  File \"d:\\Users\\koste\\.vscode\\extensions\\ms-python.python-2018.12.1\\pythonFiles\\lib\\python\\ptvsd\\_remote.py\", line 11, in <module>\r\n    from ptvsd.pydevd_hooks import install\r\n  File \"d:\\Users\\koste\\.vscode\\extensions\\ms-python.python-2018.12.1\\pythonFiles\\lib\\python\\ptvsd\\pydevd_hooks.py\", line 15, in <module>\r\n    from ptvsd.daemon import Daemon, DaemonStoppedError, DaemonClosedError\r\n  File \"d:\\Users\\koste\\.vscode\\extensions\\ms-python.python-2018.12.1\\pythonFiles\\lib\\python\\ptvsd\\daemon.py\", line 12, in <module>\r\n    from .exit_handlers import (\r\n  File \"d:\\Users\\koste\\.vscode\\extensions\\ms-python.python-2018.12.1\\pythonFiles\\lib\\python\\ptvsd\\exit_handlers.py\", line 28, in <module>\r\n    class ExitHandlers(object):\r\n  File \"d:\\Users\\koste\\.vscode\\extensions\\ms-python.python-2018.12.1\\pythonFiles\\lib\\python\\ptvsd\\exit_handlers.py\", line 36, in ExitHandlers\r\n    SIGNALS = [\r\nAttributeError: 'module' object has no attribute 'SIGHUP'\r\n\r\nInternal error detected. Please copy the above traceback and report at\r\nhttps://github.com/Microsoft/vscode-python/issues/new\r\n```\r\n\n\n---\n\n@kostermw commented on [Sat Dec 15 2018](https://github.com/Microsoft/vscode-python/issues/3715#issuecomment-447572774)\n\nReported as requested \n\n\n", "before_files": [{"content": "# Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under the MIT License. See LICENSE in the project root\n# for license information.\n\nimport atexit\nimport os\nimport platform\nimport signal\n\n\nclass AlreadyInstalledError(RuntimeError):\n    \"\"\"Exit handlers were already installed.\"\"\"\n\n\nclass UnsupportedSignalError(RuntimeError):\n    \"\"\"A signal is not supported.\"\"\"\n\n\ndef kill_current_proc(signum=signal.SIGTERM):\n    \"\"\"Kill the current process.\n\n    Note that this directly kills the process (with SIGTERM, by default)\n    rather than using sys.exit().\n    \"\"\"\n    os.kill(os.getpid(), signum)\n\n\nclass ExitHandlers(object):\n    \"\"\"Manages signal and atexit handlers.\"\"\"\n\n    if platform.system() == 'Windows':\n        # TODO: Windows *does* support these signals:\n        #  SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, SIGTERM, SIGBREAK\n        SIGNALS = []\n    else:\n        SIGNALS = [\n            signal.SIGHUP,\n        ]\n\n    def __init__(self):\n        self._signal_handlers = {sig: []\n                                 for sig in self.SIGNALS}\n        self._atexit_handlers = []\n        self._installed = False\n\n    @property\n    def supported_signals(self):\n        return set(self.SIGNALS)\n\n    @property\n    def installed(self):\n        return self._installed\n\n    def install(self):\n        \"\"\"Set the parent handlers.\n\n        This must be called in the main thread.\n        \"\"\"\n        if self._installed:\n            raise AlreadyInstalledError('exit handlers already installed')\n        self._installed = True\n        self._install_signal_handler()\n        self._install_atexit_handler()\n\n    # TODO: Add uninstall()?\n\n    def add_atexit_handler(self, handle_atexit, nodupe=True):\n        \"\"\"Add an atexit handler to the list managed here.\"\"\"\n        if nodupe and handle_atexit in self._atexit_handlers:\n            raise ValueError('atexit handler alraedy added')\n        self._atexit_handlers.append(handle_atexit)\n\n    def add_signal_handler(self, signum, handle_signal, nodupe=True,\n                           ignoreunsupported=False):\n        \"\"\"Add a signal handler to the list managed here.\"\"\"\n        # TODO: The initialization of self.SIGNALS should make this\n        # special-casing unnecessary.\n        if platform.system() == 'Windows':\n            return\n\n        try:\n            handlers = self._signal_handlers[signum]\n        except KeyError:\n            if ignoreunsupported:\n                return\n            raise UnsupportedSignalError(signum)\n        if nodupe and handle_signal in handlers:\n            raise ValueError('signal handler alraedy added')\n        handlers.append(handle_signal)\n\n    # internal methods\n\n    def _install_signal_handler(self):\n        # TODO: The initialization of self.SIGNALS should make this\n        # special-casing unnecessary.\n        if platform.system() == 'Windows':\n            return\n\n        orig = {}\n        try:\n            for sig in self._signal_handlers:\n                # TODO: Skip or fail if signal.getsignal() returns None?\n                orig[sig] = signal.signal(sig, self._signal_handler)\n        except ValueError:\n            # Wasn't called in main thread!\n            raise\n\n    def _signal_handler(self, signum, frame):\n        for handle_signal in self._signal_handlers.get(signum, ()):\n            handle_signal(signum, frame)\n\n    def _install_atexit_handler(self):\n        self._atexit_handlers = []\n        atexit.register(self._atexit_handler)\n\n    def _atexit_handler(self):\n        for handle_atexit in self._atexit_handlers:\n            handle_atexit()\n", "path": "src/ptvsd/exit_handlers.py"}], "after_files": [{"content": "# Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under the MIT License. See LICENSE in the project root\n# for license information.\n\nimport atexit\nimport os\nimport platform\nimport signal\n\n\nclass AlreadyInstalledError(RuntimeError):\n    \"\"\"Exit handlers were already installed.\"\"\"\n\n\nclass UnsupportedSignalError(RuntimeError):\n    \"\"\"A signal is not supported.\"\"\"\n\n\ndef kill_current_proc(signum=signal.SIGTERM):\n    \"\"\"Kill the current process.\n\n    Note that this directly kills the process (with SIGTERM, by default)\n    rather than using sys.exit().\n    \"\"\"\n    os.kill(os.getpid(), signum)\n\n\nclass ExitHandlers(object):\n    \"\"\"Manages signal and atexit handlers.\"\"\"\n\n    if platform.system() == 'Windows' or not hasattr(signal, 'SIGHUP'):\n        # TODO: Windows *does* support these signals:\n        #  SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, SIGTERM, SIGBREAK\n        SIGNALS = []\n    else:\n        SIGNALS = [\n            signal.SIGHUP,\n        ]\n\n    def __init__(self):\n        self._signal_handlers = {sig: []\n                                 for sig in self.SIGNALS}\n        self._atexit_handlers = []\n        self._installed = False\n\n    @property\n    def supported_signals(self):\n        return set(self.SIGNALS)\n\n    @property\n    def installed(self):\n        return self._installed\n\n    def install(self):\n        \"\"\"Set the parent handlers.\n\n        This must be called in the main thread.\n        \"\"\"\n        if self._installed:\n            raise AlreadyInstalledError('exit handlers already installed')\n        self._installed = True\n        self._install_signal_handler()\n        self._install_atexit_handler()\n\n    # TODO: Add uninstall()?\n\n    def add_atexit_handler(self, handle_atexit, nodupe=True):\n        \"\"\"Add an atexit handler to the list managed here.\"\"\"\n        if nodupe and handle_atexit in self._atexit_handlers:\n            raise ValueError('atexit handler alraedy added')\n        self._atexit_handlers.append(handle_atexit)\n\n    def add_signal_handler(self, signum, handle_signal, nodupe=True,\n                           ignoreunsupported=False):\n        \"\"\"Add a signal handler to the list managed here.\"\"\"\n        # TODO: The initialization of self.SIGNALS should make this\n        # special-casing unnecessary.\n        if platform.system() == 'Windows':\n            return\n\n        try:\n            handlers = self._signal_handlers[signum]\n        except KeyError:\n            if ignoreunsupported:\n                return\n            raise UnsupportedSignalError(signum)\n        if nodupe and handle_signal in handlers:\n            raise ValueError('signal handler alraedy added')\n        handlers.append(handle_signal)\n\n    # internal methods\n\n    def _install_signal_handler(self):\n        # TODO: The initialization of self.SIGNALS should make this\n        # special-casing unnecessary.\n        if platform.system() == 'Windows':\n            return\n\n        orig = {}\n        try:\n            for sig in self._signal_handlers:\n                # TODO: Skip or fail if signal.getsignal() returns None?\n                orig[sig] = signal.signal(sig, self._signal_handler)\n        except ValueError:\n            # Wasn't called in main thread!\n            raise\n\n    def _signal_handler(self, signum, frame):\n        for handle_signal in self._signal_handlers.get(signum, ()):\n            handle_signal(signum, frame)\n\n    def _install_atexit_handler(self):\n        self._atexit_handlers = []\n        atexit.register(self._atexit_handler)\n\n    def _atexit_handler(self):\n        for handle_atexit in self._atexit_handlers:\n            handle_atexit()\n", "path": "src/ptvsd/exit_handlers.py"}]}