| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -144,23 +144,6 @@ | |||
| 144 | 144 | class Error(Exception): | |
| 145 | 145 | """Base class for ConfigParser exceptions.""" | |
| 146 | 146 | ||
| 147 | - def _get_message(self): | ||
| 148 | - """Getter for 'message'; needed only to override deprecation in | ||
| 149 | - BaseException. | ||
| 150 | - """ | ||
| 151 | - return self.__message | ||
| 152 | - | ||
| 153 | - def _set_message(self, value): | ||
| 154 | - """Setter for 'message'; needed only to override deprecation in | ||
| 155 | - BaseException. | ||
| 156 | - """ | ||
| 157 | - self.__message = value | ||
| 158 | - | ||
| 159 | - # BaseException.message has been deprecated since Python 2.6. To prevent | ||
| 160 | - # DeprecationWarning from popping up over this pre-existing attribute, use | ||
| 161 | - # a new property that takes lookup precedence. | ||
| 162 | - message = property(_get_message, _set_message) | ||
| 163 | - | ||
| 164 | 147 | def __init__(self, msg=''): | |
| 165 | 148 | self.message = msg | |
| 166 | 149 | Exception.__init__(self, msg) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -332,30 +332,6 @@ def _safe_import_hook(self, name, caller, fromlist, level=-1): | |||
| 332 | 332 | fullname = name + "." + sub | |
| 333 | 333 | self._add_badmodule(fullname, caller) | |
| 334 | 334 | ||
| 335 | - def scan_opcodes(self, co, | ||
| 336 | - unpack = struct.unpack): | ||
| 337 | - # Scan the code, and yield 'interesting' opcode combinations | ||
| 338 | - # Version for Python 2.4 and older | ||
| 339 | - code = co.co_code | ||
| 340 | - names = co.co_names | ||
| 341 | - consts = co.co_consts | ||
| 342 | - while code: | ||
| 343 | - c = code[0] | ||
| 344 | - if c in STORE_OPS: | ||
| 345 | - oparg, = unpack('<H', code[1:3]) | ||
| 346 | - yield "store", (names[oparg],) | ||
| 347 | - code = code[3:] | ||
| 348 | - continue | ||
| 349 | - if c == LOAD_CONST and code[3] == IMPORT_NAME: | ||
| 350 | - oparg_1, oparg_2 = unpack('<xHxH', code[:6]) | ||
| 351 | - yield "import", (consts[oparg_1], names[oparg_2]) | ||
| 352 | - code = code[6:] | ||
| 353 | - continue | ||
| 354 | - if c >= HAVE_ARGUMENT: | ||
| 355 | - code = code[3:] | ||
| 356 | - else: | ||
| 357 | - code = code[1:] | ||
| 358 | - | ||
| 359 | 335 | def scan_opcodes_25(self, co, | |
| 360 | 336 | unpack = struct.unpack): | |
| 361 | 337 | # Scan the code, and yield 'interesting' opcode combinations | |
@@ -387,10 +363,7 @@ def scan_opcodes_25(self, co, | |||
| 387 | 363 | ||
| 388 | 364 | def scan_code(self, co, m): | |
| 389 | 365 | code = co.co_code | |
| 390 | - if sys.version_info >= (2, 5): | ||
| 391 | - scanner = self.scan_opcodes_25 | ||
| 392 | - else: | ||
| 393 | - scanner = self.scan_opcodes | ||
| 366 | + scanner = self.scan_opcodes_25 | ||
| 394 | 367 | for what, args in scanner(co): | |
| 395 | 368 | if what == "store": | |
| 396 | 369 | name, = args | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -645,14 +645,8 @@ def _check_type(self): | |||
| 645 | 645 | self.type = "string" | |
| 646 | 646 | else: | |
| 647 | 647 | # Allow type objects or builtin type conversion functions | |
| 648 | - # (int, str, etc.) as an alternative to their names. (The | ||
| 649 | - # complicated check of builtins is only necessary for | ||
| 650 | - # Python 2.1 and earlier, and is short-circuited by the | ||
| 651 | - # first check on modern Pythons.) | ||
| 652 | - import builtins | ||
| 653 | - if ( isinstance(self.type, type) or | ||
| 654 | - (hasattr(self.type, "__name__") and | ||
| 655 | - getattr(builtins, self.type.__name__, None) is self.type) ): | ||
| 648 | + # (int, str, etc.) as an alternative to their names. | ||
| 649 | + if isinstance(self.type, type): | ||
| 656 | 650 | self.type = self.type.__name__ | |
| 657 | 651 | ||
| 658 | 652 | if self.type == "str": | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -455,7 +455,6 @@ profiler_callback(PyObject *self, PyFrameObject *frame, int what, | |||
| 455 | 455 | PyTrace_RETURN event will be generated, so we don't need to | |
| 456 | 456 | handle it. */ | |
| 457 | 457 | ||
| 458 | - #ifdef PyTrace_C_CALL /* not defined in Python <= 2.3 */ | ||
| 459 | 458 | /* the Python function 'frame' is issuing a call to the built-in | |
| 460 | 459 | function 'arg' */ | |
| 461 | 460 | case PyTrace_C_CALL: | |
@@ -477,7 +476,6 @@ profiler_callback(PyObject *self, PyFrameObject *frame, int what, | |||
| 477 | 476 | ((PyCFunctionObject *)arg)->m_ml); | |
| 478 | 477 | } | |
| 479 | 478 | break; | |
| 480 | - #endif | ||
| 481 | 479 | ||
| 482 | 480 | default: | |
| 483 | 481 | break; | |
@@ -667,13 +665,7 @@ setBuiltins(ProfilerObject *pObj, int nvalue) | |||
| 667 | 665 | if (nvalue == 0) | |
| 668 | 666 | pObj->flags &= ~POF_BUILTINS; | |
| 669 | 667 | else if (nvalue > 0) { | |
| 670 | - #ifndef PyTrace_C_CALL | ||
| 671 | - PyErr_SetString(PyExc_ValueError, | ||
| 672 | - "builtins=True requires Python >= 2.4"); | ||
| 673 | - return -1; | ||
| 674 | - #else | ||
| 675 | 668 | pObj->flags |= POF_BUILTINS; | |
| 676 | - #endif | ||
| 677 | 669 | } | |
| 678 | 670 | return 0; | |
| 679 | 671 | } | |
@@ -771,11 +763,7 @@ profiler_init(ProfilerObject *pObj, PyObject *args, PyObject *kw) | |||
| 771 | 763 | PyObject *timer = NULL; | |
| 772 | 764 | double timeunit = 0.0; | |
| 773 | 765 | int subcalls = 1; | |
| 774 | - #ifdef PyTrace_C_CALL | ||
| 775 | 766 | int builtins = 1; | |
| 776 | - #else | ||
| 777 | - int builtins = 0; | ||
| 778 | - #endif | ||
| 779 | 767 | static char *kwlist[] = {"timer", "timeunit", | |
| 780 | 768 | "subcalls", "builtins", 0}; | |
| 781 | 769 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,20 +33,6 @@ Copyright (C) 1994 Steen Lumholt. | |||
| 33 | 33 | #include <windows.h> | |
| 34 | 34 | #endif | |
| 35 | 35 | ||
| 36 | - /* Allow using this code in Python 2.[12] */ | ||
| 37 | - #ifndef PyDoc_STRVAR | ||
| 38 | - #define PyDoc_STRVAR(name,str) static char name[] = str | ||
| 39 | - #endif | ||
| 40 | - | ||
| 41 | - #ifndef PyMODINIT_FUNC | ||
| 42 | - #define PyMODINIT_FUNC void | ||
| 43 | - #endif | ||
| 44 | - | ||
| 45 | - #ifndef PyBool_Check | ||
| 46 | - #define PyBool_Check(o) 0 | ||
| 47 | - #define PyBool_FromLong PyLong_FromLong | ||
| 48 | - #endif | ||
| 49 | - | ||
| 50 | 36 | #define CHECK_SIZE(size, elemsize) \ | |
| 51 | 37 | ((size_t)(size) <= Py_MAX((size_t)INT_MAX, UINT_MAX / (size_t)(elemsize))) | |
| 52 | 38 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1534,13 +1534,6 @@ PyObject_GC_Track(void *op) | |||
| 1534 | 1534 | _PyObject_GC_TRACK(op); | |
| 1535 | 1535 | } | |
| 1536 | 1536 | ||
| 1537 | - /* for binary compatibility with 2.2 */ | ||
| 1538 | - void | ||
| 1539 | - _PyObject_GC_Track(PyObject *op) | ||
| 1540 | - { | ||
| 1541 | - PyObject_GC_Track(op); | ||
| 1542 | - } | ||
| 1543 | - | ||
| 1544 | 1537 | void | |
| 1545 | 1538 | PyObject_GC_UnTrack(void *op) | |
| 1546 | 1539 | { | |
@@ -1551,13 +1544,6 @@ PyObject_GC_UnTrack(void *op) | |||
| 1551 | 1544 | _PyObject_GC_UNTRACK(op); | |
| 1552 | 1545 | } | |
| 1553 | 1546 | ||
| 1554 | - /* for binary compatibility with 2.2 */ | ||
| 1555 | - void | ||
| 1556 | - _PyObject_GC_UnTrack(PyObject *op) | ||
| 1557 | - { | ||
| 1558 | - PyObject_GC_UnTrack(op); | ||
| 1559 | - } | ||
| 1560 | - | ||
| 1561 | 1547 | PyObject * | |
| 1562 | 1548 | _PyObject_GC_Malloc(size_t basicsize) | |
| 1563 | 1549 | { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments