Commit 1da14a3c authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #1168 from kmod/reftests2

Fix the last two reffail tests
parents 183aa5f7 3beb6d11
...@@ -81,7 +81,7 @@ PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *) PYSTON_NOEXCEPT; ...@@ -81,7 +81,7 @@ PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *) PYSTON_NOEXCEPT;
* can't fail, never sets an exception, and NULL is not an error (it just * can't fail, never sets an exception, and NULL is not an error (it just
* means "not found"). * means "not found").
*/ */
PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name) PYSTON_NOEXCEPT; PyAPI_FUNC(BORROWED(PyObject *)) _PyInstance_Lookup(PyObject *pinst, PyObject *name) PYSTON_NOEXCEPT;
// Pyston change: no longer macros // Pyston change: no longer macros
#if 0 #if 0
......
# expected: reffail # expected: fail
# - takes too long # - takes too long
# Copyright (c) 2004 Python Software Foundation. # Copyright (c) 2004 Python Software Foundation.
# All rights reserved. # All rights reserved.
......
# expected: fail
import os import os
import unittest import unittest
import shelve import shelve
......
# expected: reffail
# - leaked refs, some test failures?
# Copyright (C) 2003 Python Software Foundation # Copyright (C) 2003 Python Software Foundation
import unittest import unittest
......
# expected: fail
import unittest import unittest
from test import test_support from test import test_support
......
...@@ -3069,8 +3069,10 @@ init_elementtree(void) ...@@ -3069,8 +3069,10 @@ init_elementtree(void)
); );
if (!PyRun_String(bootstrap, Py_file_input, g, NULL)) PyObject* bootstrap_ret;
if (!(bootstrap_ret = PyRun_String(bootstrap, Py_file_input, g, NULL)))
return; return;
Py_DECREF(bootstrap_ret);
elementpath_obj = PyDict_GetItemString(g, "ElementPath"); elementpath_obj = PyDict_GetItemString(g, "ElementPath");
...@@ -3090,6 +3092,8 @@ init_elementtree(void) ...@@ -3090,6 +3092,8 @@ init_elementtree(void)
elementtree_iter_obj = PyDict_GetItemString(g, "iter"); elementtree_iter_obj = PyDict_GetItemString(g, "iter");
elementtree_itertext_obj = PyDict_GetItemString(g, "itertext"); elementtree_itertext_obj = PyDict_GetItemString(g, "itertext");
Py_DECREF(g);
#if defined(USE_PYEXPAT_CAPI) #if defined(USE_PYEXPAT_CAPI)
/* link against pyexpat, if possible */ /* link against pyexpat, if possible */
expat_capi = PyCapsule_Import(PyExpat_CAPSULE_NAME, 0); expat_capi = PyCapsule_Import(PyExpat_CAPSULE_NAME, 0);
......
...@@ -77,7 +77,7 @@ static BORROWED(Box*) classLookup(BoxedClassobj* cls, BoxedString* attr) { ...@@ -77,7 +77,7 @@ static BORROWED(Box*) classLookup(BoxedClassobj* cls, BoxedString* attr) {
return classLookup<NOT_REWRITABLE>(cls, attr, NULL); return classLookup<NOT_REWRITABLE>(cls, attr, NULL);
} }
extern "C" PyObject* _PyInstance_Lookup(PyObject* pinst, PyObject* pname) noexcept { extern "C" BORROWED(PyObject*) _PyInstance_Lookup(PyObject* pinst, PyObject* pname) noexcept {
RELEASE_ASSERT(PyInstance_Check(pinst), ""); RELEASE_ASSERT(PyInstance_Check(pinst), "");
BoxedInstance* inst = (BoxedInstance*)pinst; BoxedInstance* inst = (BoxedInstance*)pinst;
...@@ -92,7 +92,7 @@ extern "C" PyObject* _PyInstance_Lookup(PyObject* pinst, PyObject* pname) noexce ...@@ -92,7 +92,7 @@ extern "C" PyObject* _PyInstance_Lookup(PyObject* pinst, PyObject* pname) noexce
Box* v = inst->getattr(name); Box* v = inst->getattr(name);
if (v == NULL) if (v == NULL)
v = classLookup(inst->inst_cls, name); v = classLookup(inst->inst_cls, name);
return xincref(v); return v;
} catch (ExcInfo e) { } catch (ExcInfo e) {
setCAPIException(e); setCAPIException(e);
return NULL; return NULL;
......
...@@ -4807,6 +4807,9 @@ extern "C" void Py_Finalize() noexcept { ...@@ -4807,6 +4807,9 @@ extern "C" void Py_Finalize() noexcept {
call_sys_exitfunc(); call_sys_exitfunc();
// initialized = 0; // initialized = 0;
PyType_ClearCache();
PyGC_Collect();
PyImport_Cleanup(); PyImport_Cleanup();
#ifdef Py_REF_DEBUG #ifdef Py_REF_DEBUG
......
# expected: reffail
import os, sys import os, sys
sys.path.append(os.path.dirname(__file__) + "/../lib") sys.path.append(os.path.dirname(__file__) + "/../lib")
......
# expected: reffail
import os import os
import sys import sys
import subprocess import subprocess
......
# expected: fail
# - __del__ not supported
# probably need to have some gc collections going on as well # probably need to have some gc collections going on as well
# Classes should be freed right away # Classes should be freed right away
......
# expected: refstatfail
# skip-if: '-O' in EXTRA_JIT_ARGS # skip-if: '-O' in EXTRA_JIT_ARGS
# expected: statfail
# statcheck: 4 <= noninit_count('num_deopt') < 50 # statcheck: 4 <= noninit_count('num_deopt') < 50
# statcheck: 1 <= stats["num_osr_exits"] <= 2 # statcheck: 1 <= stats["num_osr_exits"] <= 2
......
# expected: refstatfail
# skip-if: '-O' in EXTRA_JIT_ARGS # skip-if: '-O' in EXTRA_JIT_ARGS
# statcheck: 4 <= noninit_count('num_deopt') < 50 # statcheck: 4 <= noninit_count('num_deopt') < 50
# statcheck: 1 <= stats["num_osr_exits"] <= 2 # statcheck: 1 <= stats["num_osr_exits"] <= 2
......
# expected: reffail
# test is based on the cpython ElementTree doc # test is based on the cpython ElementTree doc
def test(ET): def test(ET):
xml_str = """<?xml version="1.0"?> xml_str = """<?xml version="1.0"?>
......
...@@ -217,8 +217,6 @@ def get_test_options(fn, check_stats, run_memcheck): ...@@ -217,8 +217,6 @@ def get_test_options(fn, check_stats, run_memcheck):
if opts.expected == "reffail": if opts.expected == "reffail":
opts.expected = "fail" opts.expected = "fail"
if opts.expected == "refstatfail":
opts.expected = "statfail"
if not opts.skip: if not opts.skip:
# consider other reasons for skipping file # consider other reasons for skipping file
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment