File: _compat.py

package info (click to toggle)
python-click-threading 0.5.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 152 kB
  • sloc: python: 344; makefile: 200; sh: 7
file content (16 lines) | stat: -rw-r--r-- 383 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# -*- coding: utf-8 -*-

import inspect
import sys

PY2 = sys.version_info[0] == 2

if PY2:
    getargspec = inspect.getargspec
    exec('def reraise(tp, value, tb=None):\n raise tp, value, tb')
else:
    getargspec = inspect.getfullargspec
    def reraise(tp, value, tb=None):
        if value.__traceback__ is not tb:
            raise value.with_traceback(tb)
        raise value