Commit 9674585f authored by Kevin Modzelewski's avatar Kevin Modzelewski

[xxx -- to remove] Batch-label currently failing tests

Put a "expected: reffail" on any test that the tester thought was failing
(which includes a few that currently fail due to the llvm-only mode)

Used a different word (vs "fail") so that we can see whether it was failing
before refcounting or not.
parent 2b6d70d3
# expected: reffail
import _collections import _collections
d = _collections.deque() d = _collections.deque()
......
# expected: reffail
def f((a,b)): def f((a,b)):
print a,b print a,b
print sorted(list(locals().iteritems())) print sorted(list(locals().iteritems()))
......
# expected: reffail
import array import array
a = array.array("c", "hello world") a = array.array("c", "hello world")
print type(a) print type(a)
......
# expected: reffail
# skip-if: '-x' in EXTRA_JIT_ARGS # skip-if: '-x' in EXTRA_JIT_ARGS
# - CPython parser backend doesn't handle well the errors # - CPython parser backend doesn't handle well the errors
# should_error # should_error
......
# expected: reffail
import _ast import _ast
def ast_parse(source, filename='<unknown>', mode='exec'): def ast_parse(source, filename='<unknown>', mode='exec'):
......
# expected: reffail
# Augassigns are somewhat odd because they encode both a use and a def of a variable. # Augassigns are somewhat odd because they encode both a use and a def of a variable.
# So for the sake of determining if a scope sets a variable, they count as a def, but # So for the sake of determining if a scope sets a variable, they count as a def, but
# for the sake of whether or not a variable is live, they count as a use. # for the sake of whether or not a variable is live, they count as a use.
......
# expected: reffail
print `42` print `42`
print `int` print `int`
print `2+3` print `2+3`
......
# expected: reffail
# Regression test: we rely internally on CompilerType.nonzero() always returning a BOOL, # Regression test: we rely internally on CompilerType.nonzero() always returning a BOOL,
# in at least these two cases. # in at least these two cases.
......
# expected: reffail
# Test that we can pass known-bool values through OSRs and what not: # Test that we can pass known-bool values through OSRs and what not:
def f(b): def f(b):
......
# expected: reffail
s = 'Hello world' s = 'Hello world'
t = buffer(s, 6, 5) t = buffer(s, 6, 5)
print t print t
......
# expected: reffail
import re import re
import inspect import inspect
def gen(): def gen():
......
# expected: reffail
import sys import sys
__builtins__.aoeu = 1 __builtins__.aoeu = 1
......
# expected: reffail
from future_builtins import hex, oct, map, zip, filter from future_builtins import hex, oct, map, zip, filter
from itertools import imap, izip, ifilter from itertools import imap, izip, ifilter
......
# expected: reffail
import bz2 import bz2
print bz2.decompress(bz2.compress("hello world")) print bz2.decompress(bz2.compress("hello world"))
# expected: reffail
import cPickle import cPickle
l = [[], (123,)] l = [[], (123,)]
......
# expected: reffail
# Make sure that callattrs handle exceptions (including # Make sure that callattrs handle exceptions (including
# different exception styles) correctly. # different exception styles) correctly.
class C(object): class C(object):
......
# expected: reffail
import slots_test import slots_test
for i in xrange(3): for i in xrange(3):
......
# expected: reffail
class C(object): class C(object):
pass pass
......
# expected: reffail
class C(object): class C(object):
pass pass
......
# expected: reffail
import gc import gc
l = [] l = []
......
# expected: reffail
# Tests to make sure that setting __class__ changes the class, and that it's ok to disallow # Tests to make sure that setting __class__ changes the class, and that it's ok to disallow
# having anything other than a type as the class # having anything other than a type as the class
class C(object): class C(object):
......
# expected: reffail
from testing_helpers import test_gc from testing_helpers import test_gc
unordered_finalize = {} unordered_finalize = {}
......
# expected: reffail
# Regression test: this triggers a bug in the way we guard for boxedfunctions and their closures. # Regression test: this triggers a bug in the way we guard for boxedfunctions and their closures.
# In particular, we guard on the specific value of a BoxedFunction to say that it is the same, but # In particular, we guard on the specific value of a BoxedFunction to say that it is the same, but
# it's possible for the function to get destructed and then a new (and different) boxedfunction to # it's possible for the function to get destructed and then a new (and different) boxedfunction to
......
# expected: reffail
# closure tests # closure tests
# simple closure: # simple closure:
......
# expected: reffail
# coding: cp1252 # coding: cp1252
s = u"" s = u""
print ord(s), s print ord(s), s
# expected: reffail
import os.path import os.path
s = open(os.path.join(os.path.dirname(__file__), "coding_cp1252.py"), 'r').read() s = open(os.path.join(os.path.dirname(__file__), "coding_cp1252.py"), 'r').read()
......
# expected: reffail
# -*- coding: koi8-r -*- # -*- coding: koi8-r -*-
def test(s): def test(s):
print s, "len:", len(s) print s, "len:", len(s)
......
# expected: reffail
import collections import collections
o = collections.OrderedDict() o = collections.OrderedDict()
......
# expected: reffail
def f(a, b): def f(a, b):
print repr(a), repr(b), "<", a < b print repr(a), repr(b), "<", a < b
print repr(a), repr(b), "<=", a <= b print repr(a), repr(b), "<=", a <= b
......
# expected: reffail
print compile print compile
c = compile("a", "test.py", "eval") c = compile("a", "test.py", "eval")
print type(c), c.co_filename, c.co_name print type(c), c.co_filename, c.co_name
......
# expected: reffail
c = compile("a = 1; print a", "test.py", "exec") c = compile("a = 1; print a", "test.py", "exec")
print type(c), c.co_filename, c.co_name print type(c), c.co_filename, c.co_name
......
# expected: reffail
from __future__ import division from __future__ import division
# compile() inherits the future flags of the parent module # compile() inherits the future flags of the parent module
......
# expected: reffail
# co is compiled without the __future__ division import. # co is compiled without the __future__ division import.
# So even though the import is present in the exec statements, # So even though the import is present in the exec statements,
# the code will be evaluated without it. Each should print 0. # the code will be evaluated without it. Each should print 0.
......
# expected: reffail
from __future__ import print_function from __future__ import print_function
import _ast import _ast
......
# expected: reffail
# this tests are from cpythons test_compile.py # this tests are from cpythons test_compile.py
import unittest import unittest
from test import test_support from test import test_support
......
# expected: reffail
# TODO repr is wrong, so for now, only printing complex numbers whose real # TODO repr is wrong, so for now, only printing complex numbers whose real
# and imaginary parts are non-integers # and imaginary parts are non-integers
......
# expected: reffail
class C(object): class C(object):
def __init__(self, a): def __init__(self, a):
print a print a
......
# expected: reffail
class C(object): class C(object):
def __init__(self, x): def __init__(self, x):
self.x = x self.x = x
......
# expected: reffail
import copy import copy
class C(object): class C(object):
pass pass
......
# expected: reffail
# This segfaults under python-dbg # This segfaults under python-dbg
# (In a release build it "works" since the use-after-free happens without penalty.) # (In a release build it "works" since the use-after-free happens without penalty.)
......
# expected: reffail
import csv import csv
import StringIO import StringIO
......
# expected: reffail
# We can only import ctypes for now - it would be nice to have tests later, # We can only import ctypes for now - it would be nice to have tests later,
# which will probably involve running the existing test suite for ctype rather # which will probably involve running the existing test suite for ctype rather
# than add our own here (unless there's special Pyston-related edge cases). # than add our own here (unless there's special Pyston-related edge cases).
......
# expected: reffail
from ctypes import * from ctypes import *
s = "tmp" s = "tmp"
ap = create_string_buffer(s) ap = create_string_buffer(s)
......
# expected: reffail
from ctypes import * from ctypes import *
libc = CDLL("libc.so.6") libc = CDLL("libc.so.6")
qsort = libc.qsort qsort = libc.qsort
......
# expected: reffail
import curses, sys import curses, sys
try: try:
......
# expected: reffail
import sys import sys
import subprocess import subprocess
......
# expected: reffail
import os import os
import sys import sys
import subprocess import subprocess
......
# expected: reffail
# Simple datetime test # Simple datetime test
# Doesn't test much of the functionality, but even importing the module is tough: # Doesn't test much of the functionality, but even importing the module is tough:
......
# expected: reffail
from decimal import Decimal from decimal import Decimal
for d in (Decimal("0.5"), Decimal("0"), Decimal(0), Decimal(1.0)): for d in (Decimal("0.5"), Decimal("0"), Decimal(0), Decimal(1.0)):
......
# expected: reffail
def wrapper(f): def wrapper(f):
return f return f
......
# expected: reffail
d = {} d = {}
print d.get(1) print d.get(1)
print d.setdefault(2) print d.setdefault(2)
......
# expected: reffail
def func(a, b=1): def func(a, b=1):
print a, b print a, b
......
# expected: reffail
# Test for various defaults arguments in builtin functions: # Test for various defaults arguments in builtin functions:
class ExpectationFailedException(Exception): class ExpectationFailedException(Exception):
......
# expected: reffail
try: try:
import __pyston__ import __pyston__
__pyston__.setOption("LAZY_SCOPING_ANALYSIS", 0) __pyston__.setOption("LAZY_SCOPING_ANALYSIS", 0)
......
# expected: reffail
def f4(): def f4():
a = 1 a = 1
b = 2 b = 2
......
# expected: reffail
import sys import sys
def p(): def p():
......
# expected: reffail
x = 1 x = 1
def f(): def f():
if 0: if 0:
......
# expected: reffail
#delete attribute of built-in types #delete attribute of built-in types
def del_builtin_attr(o): def del_builtin_attr(o):
try: try:
......
# expected: reffail
# skip-if: '-O' in EXTRA_JIT_ARGS or '-n' in EXTRA_JIT_ARGS # skip-if: '-O' in EXTRA_JIT_ARGS or '-n' 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
# 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: reffail
# 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: statfail
# skip-if: '-O' in EXTRA_JIT_ARGS or '-n' in EXTRA_JIT_ARGS # skip-if: '-O' in EXTRA_JIT_ARGS or '-n' in EXTRA_JIT_ARGS
# statcheck: 4 == noninit_count('num_deopt') # statcheck: 4 == noninit_count('num_deopt')
# this used to hit an abort in our LLVM tier codegen # this used to hit an abort in our LLVM tier codegen
......
# expected: reffail
# Test some internals: when we execute some special functions, we often need to # Test some internals: when we execute some special functions, we often need to
# make sure to keep a reference to that function, in case that function ends up # make sure to keep a reference to that function, in case that function ends up
# unsetting itself. # unsetting itself.
......
# expected: reffail
# TODO This is a hodgepodge of stuff, should probably organize it better # TODO This is a hodgepodge of stuff, should probably organize it better
# maybe merge some of it into dunder_descriptors? # maybe merge some of it into dunder_descriptors?
......
# expected: reffail
# run_args: -n # run_args: -n
# statcheck: noninit_count('slowpath_getattr') <= 10 # statcheck: noninit_count('slowpath_getattr') <= 10
# statcheck: noninit_count('slowpath_setattr') <= 10 # statcheck: noninit_count('slowpath_setattr') <= 10
......
# expected: fail # expected: reffail
# See what happens when we make __get__ and __set__ things other than functions... # See what happens when we make __get__ and __set__ things other than functions...
# TODO add some with __del__ # TODO add some with __del__
......
# expected: reffail
d = {2:2} d = {2:2}
d[1] = 1 d[1] = 1
print d print d
......
# expected: reffail
try: try:
object().__dict__ = 1 object().__dict__ = 1
except AttributeError as e: except AttributeError as e:
......
# expected: reffail
class MyDict(dict): class MyDict(dict):
pass pass
......
# expected: reffail
def dict2str(d): def dict2str(d):
result = '' result = ''
for k, v in sorted(d.items()): for k, v in sorted(d.items()):
......
# expected: reffail
import sys import sys
......
# expected: reffail
from distutils.core import setup from distutils.core import setup
import distutils.command.build as build import distutils.command.build as build
# expected: reffail
# requires: # requires:
# - code.co_firstlineno # - code.co_firstlineno
# - sys.dysplayhook # - sys.dysplayhook
......
# 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"?>
......
# expected: reffail
import codecs import codecs
### Codec APIs ### Codec APIs
......
# expected: reffail
try: try:
eval("\n 2") eval("\n 2")
print "bad, should have thrown an exception" print "bad, should have thrown an exception"
......
# expected: reffail
print eval("3 + 4") print eval("3 + 4")
a = 5 a = 5
......
# expected: reffail
def f(x): def f(x):
print x print x
......
# expected: reffail
# should_error # should_error
class BadException(Exception): class BadException(Exception):
def __str__(self): def __str__(self):
......
# expected: reffail
class TestException(Exception): class TestException(Exception):
pass pass
......
# expected: reffail
exec """print 'hi' exec """print 'hi'
a = 5 a = 5
print a""" print a"""
......
# expected: reffail
import sys import sys
import os import os
import subprocess import subprocess
......
# expected: reffail
print 1 / 2 print 1 / 2
exec """ exec """
......
# expected: reffail
from __future__ import division from __future__ import division
print 1 / 2 print 1 / 2
......
# expected: reffail
d = {} d = {}
exec "a = 5" in d exec "a = 5" in d
print d['a'] print d['a']
......
# expected: reffail
print 'Test getting' print 'Test getting'
g = {'a': 1} g = {'a': 1}
......
# expected: reffail
def f(): def f():
exec "a = 5" exec "a = 5"
print a print a
......
# expected: reffail
s = """ s = """
def f(): def f():
a = 1 a = 1
......
# expected: reffail
# fail-if: '-x' in EXTRA_JIT_ARGS # fail-if: '-x' in EXTRA_JIT_ARGS
# - we don't get syntax errors through the old parser correctly # - we don't get syntax errors through the old parser correctly
......
# expected: reffail
try: try:
execfile("doesnt_exist.py") execfile("doesnt_exist.py")
except IOError, e: except IOError, e:
......
# expected: reffail
# no-collect-stats # no-collect-stats
import os import os
......
# expected: reffail
import basic_test import basic_test
print type(basic_test) print type(basic_test)
......
# expected: reffail
import fcntl import fcntl
for k in sorted(dir(fcntl)): for k in sorted(dir(fcntl)):
......
# expected: reffail
import sys import sys
import tempfile import tempfile
......
# expected: reffail
import gc import gc
def open_lots_of_files(): def open_lots_of_files():
......
# expected: reffail
import os import os
import tempfile import tempfile
import array import array
......
# expected: reffail
import gc import gc
finalized_at_least_once = False finalized_at_least_once = False
......
# expected: reffail
# Exceptions from finalizers should get caught: # Exceptions from finalizers should get caught:
import sys import sys
from testing_helpers import test_gc from testing_helpers import test_gc
......
# expected: reffail
from testing_helpers import test_gc from testing_helpers import test_gc
# __del__ does not get called because it doesn't fallback to getattr # __del__ does not get called because it doesn't fallback to getattr
......
# expected: reffail
import gc import gc
from testing_helpers import test_gc from testing_helpers import test_gc
......
# expected: reffail
from testing_helpers import test_gc from testing_helpers import test_gc
class C(object): class C(object):
......
# expected: reffail
# Similar to finally_continue.py, but this is allowable # Similar to finally_continue.py, but this is allowable
for i in xrange(10): for i in xrange(10):
......
# expected: reffail
# these may seem pointless, but they exercise a family of corner cases in our # these may seem pointless, but they exercise a family of corner cases in our
# CFG generation pass (cfg.cpp). # CFG generation pass (cfg.cpp).
def returner(): def returner():
......
# expected: reffail
print 123542598.12938712938192831293812983 print 123542598.12938712938192831293812983
f = 1.0 f = 1.0
print f print f
......
# expected: reffail
for i in range(10): for i in range(10):
print i print i
for i in xrange(1, 15, 2): for i in xrange(1, 15, 2):
......
# expected: reffail
class C(object): class C(object):
def __iter__(self): def __iter__(self):
print "orig iter" print "orig iter"
......
# expected: reffail
# no-collect-stats # no-collect-stats
from thread import start_new_thread from thread import start_new_thread
......
# expected: reffail
def f(): def f():
def f1(a, b, c): def f1(a, b, c):
print a, b, c print a, b, c
......
# expected: reffail
def f(): def f():
"""very nice function""" """very nice function"""
......
# expected: reffail
import functools import functools
f = functools.partial(lambda *args: args, 1, 23) f = functools.partial(lambda *args: args, 1, 23)
......
# expected: reffail
"docstring" "docstring"
from __future__ import division from __future__ import division
......
# expected: reffail
import gc import gc
# Dynamically create new classes and instances of those classes in such a way # Dynamically create new classes and instances of those classes in such a way
......
# expected: reffail
import sys import sys
def compact(s): def compact(s):
......
# expected: reffail
import sys import sys
if __name__ == "__main__": if __name__ == "__main__":
......
# expected: reffail
import sys import sys
P = 1000000007 P = 1000000007
......
# expected: reffail
# Test to make sure that generators create and receive closures as appropriate. # Test to make sure that generators create and receive closures as appropriate.
def f(E, N, M): def f(E, N, M):
......
# expected: reffail
# This test checks if generators which get started but haven't yet stopped (=not raisen a StopIteration exc, etc) # This test checks if generators which get started but haven't yet stopped (=not raisen a StopIteration exc, etc)
# get freed when there aren't any references to the generators left. # get freed when there aren't any references to the generators left.
......
# expected: reffail
s = """ s = """
def g(): def g():
yield x yield x
......
# expected: reffail
# Test a generator cycle involving an unfinished generator. # Test a generator cycle involving an unfinished generator.
def f(): def f():
......
# expected: reffail
def g(): def g():
l1 = [1] l1 = [1]
l2 = [2] l2 = [2]
......
# expected: reffail
# This test could really benefit from defined/settable OSR limits # This test could really benefit from defined/settable OSR limits
def f(x): def f(x):
......
# expected: reffail
# Start a generator on one thread, pass it to another, and have that execute it for a while # Start a generator on one thread, pass it to another, and have that execute it for a while
def gen(): def gen():
......
# expected: reffail
# Pass a started generator to two different threads, and make them both # Pass a started generator to two different threads, and make them both
# try to run it at the same time. # try to run it at the same time.
......
# expected: reffail
import threading import threading
import traceback, sys import traceback, sys
......
# expected: reffail
import sys import sys
def generate(lst): def generate(lst):
......
# expected: reffail
# Generators participate in the notional Python stack just like normal function calls do, # Generators participate in the notional Python stack just like normal function calls do,
# even if we implement them using separate C stacks. # even if we implement them using separate C stacks.
# #
......
# expected: reffail
def G1(i=0): def G1(i=0):
while True: while True:
yield i yield i
......
# expected: reffail
# This throws an exception in the import machinery when we try to access __path__, # This throws an exception in the import machinery when we try to access __path__,
# but that should get caught. # but that should get caught.
......
# expected: reffail
# Test some weird getattr/hasattr guarding scenarios # Test some weird getattr/hasattr guarding scenarios
......
# expected: reffail
g = 0 g = 0
class C(object): class C(object):
@property @property
......
# expected: reffail
# Regression test: make sure we guard / invalidate our getattr() rewrites: # Regression test: make sure we guard / invalidate our getattr() rewrites:
class C(object): class C(object):
......
# expected: reffail
# getitem # getitem
def f(l): def f(l):
......
# expected: reffail
# I would have expected this to be valid, but cPython and pypy err out saying "name 'x' is local and global" # I would have expected this to be valid, but cPython and pypy err out saying "name 'x' is local and global"
try: try:
......
# expected: reffail
import grp import grp
print grp.getgrnam("root") print grp.getgrnam("root")
# expected: reffail
import gzip import gzip
import io import io
......
# expected: reffail
a = 'test' a = 'test'
assert hasattr(a, "__str__") assert hasattr(a, "__str__")
assert hasattr(a, "dupa") == False assert hasattr(a, "dupa") == False
......
# expected: reffail
import hashlib import hashlib
#for m in [hashlib.md5(), hashlib.sha1(), hashlib.sha256(), hashlib.sha512()]: #for m in [hashlib.md5(), hashlib.sha1(), hashlib.sha256(), hashlib.sha512()]:
......
# expected: reffail
import imp import imp
print len(imp.find_module("os")) print len(imp.find_module("os"))
e = imp.find_module("encodings") e = imp.find_module("encodings")
......
# expected: reffail
try: try:
import non_existent_module import non_existent_module
assert 0, "shouldn't get here" assert 0, "shouldn't get here"
......
# expected: reffail
import test_package.import_target import test_package.import_target
import import_target import import_target
print print
......
# expected: reffail
# The six.py module exposed some issues with how we were handling imports; # The six.py module exposed some issues with how we were handling imports;
# an imported name is not necessarily an attribute of the module object itself, # an imported name is not necessarily an attribute of the module object itself,
......
# expected: reffail
import import_target import import_target
print import_target.x print import_target.x
......
# expected: reffail
import traceback import traceback
import sys import sys
def f(): def f():
......
# expected: reffail
# This is the same as incremental_tb_bjit.py but tests the baseline JIT. # This is the same as incremental_tb_bjit.py but tests the baseline JIT.
try: try:
import __pyston__ import __pyston__
......
# expected: reffail
def f1(): def f1():
class C(object): class C(object):
......
# expected: reffail
# should_error # should_error
# As the test filename says, init functions must return None. # As the test filename says, init functions must return None.
# This file tests that; it also makes sure that it gets tested # This file tests that; it also makes sure that it gets tested
......
# expected: reffail
import StringIO import StringIO
import sys import sys
......
# expected: reffail
import inspect import inspect
def f1(a, b=2, *args, **kw): def f1(a, b=2, *args, **kw):
......
# expected: reffail
class C(object): class C(object):
def foo(self): def foo(self):
pass pass
......
# expected: reffail
# while I think nothing requires that this works I actually found this in a library... # while I think nothing requires that this works I actually found this in a library...
import subprocess import subprocess
def f(): def f():
......
# expected: reffail
try: try:
print intern(123) print intern(123)
except TypeError: except TypeError:
......
# expected: reffail
class Random(object): class Random(object):
def __init__(self, seed): def __init__(self, seed):
self.cur = seed self.cur = seed
......
# expected: reffail
# can't try large numbers yet due to lack of long # can't try large numbers yet due to lack of long
for i in xrange(1, 100): for i in xrange(1, 100):
for j in xrange(1, 100): for j in xrange(1, 100):
......
# expected: reffail
import io import io
filename = "io_test_.txt" filename = "io_test_.txt"
......
# expected: reffail
class M(type): class M(type):
pass pass
......
# expected: reffail
# Regression test: make sure we GC special iterator objects correctly # Regression test: make sure we GC special iterator objects correctly
import gc import gc
......
# expected: reffail
import itertools import itertools
its = [] its = []
......
# expected: reffail
from StringIO import StringIO from StringIO import StringIO
import json import json
......
# expected: reffail
# statcheck: noninit_count('slowpath_runtimecall') <= 500 # statcheck: noninit_count('slowpath_runtimecall') <= 500
# statcheck: noninit_count('slowpath_callfunc') <= 500 # statcheck: noninit_count('slowpath_callfunc') <= 500
# run_args: -n # run_args: -n
......
# expected: reffail
# run_args: -n # run_args: -n
# statcheck: noninit_count('slowpath_runtimecall') < 20 # statcheck: noninit_count('slowpath_runtimecall') < 20
......
# expected: reffail
class C(object): class C(object):
def __len__(self): def __len__(self):
print "__len__" print "__len__"
......
# expected: reffail
l = range(5) l = range(5)
print l print l
print l * 5 print l * 5
......
# expected: reffail
# regression test: list sorting had a gc bug # regression test: list sorting had a gc bug
import gc import gc
......
# expected: reffail
class MyList(list): class MyList(list):
pass pass
......
# expected: reffail
print [(i, j) for i in range(4) for j in range(4)] print [(i, j) for i in range(4) for j in range(4)]
def f(): def f():
......
# expected: reffail
def f1(): def f1():
l = [] l = []
for i in xrange(5): for i in xrange(5):
......
# expected: reffail
import logging import logging
import warnings import warnings
......
# expected: reffail
l = 2L l = 2L
print l print l
print type(l) print type(l)
......
# expected: reffail
import marshal import marshal
o = [-1, 1.23456789, complex(1.2, 3.4)] o = [-1, 1.23456789, complex(1.2, 3.4)]
o += [True, False, None] o += [True, False, None]
......
# expected: reffail
import math import math
print math.sqrt(2) print math.sqrt(2)
print math.sqrt(0) print math.sqrt(0)
......
# expected: reffail
# run_args: -n # run_args: -n
# statcheck: noninit_count('slowpath_member_descriptor_get') <= 1500 # statcheck: noninit_count('slowpath_member_descriptor_get') <= 1500
......
# expected: reffail
def test(v): def test(v):
print len(v), v.readonly, v.itemsize, v.tobytes(), v.tolist() print len(v), v.readonly, v.itemsize, v.tobytes(), v.tolist()
......
# expected: reffail
# This would make a good Python quiz: # This would make a good Python quiz:
sl = slice(1,2) sl = slice(1,2)
......
# expected: reffail
class MM(type): class MM(type):
def __new__(*args): def __new__(*args):
print "MM.__new__", args[:3] print "MM.__new__", args[:3]
......
# expected: reffail
# run_args: -n # run_args: -n
# statcheck: noninit_count('slowpath_classmethod_get') <= 10 # statcheck: noninit_count('slowpath_classmethod_get') <= 10
# statcheck: noninit_count('slowpath_staticmethod_get') <= 10 # statcheck: noninit_count('slowpath_staticmethod_get') <= 10
......
# expected: reffail
from types import ModuleType from types import ModuleType
class MyModule(ModuleType): class MyModule(ModuleType):
......
# expected: reffail
# Make sure we can at least support people who want to register themselves with modulefinder, # Make sure we can at least support people who want to register themselves with modulefinder,
# even if we don't actually support using modulefinder to find modules. # even if we don't actually support using modulefinder to find modules.
......
# expected: reffail
import empty_module import empty_module
import math import math
import types import types
......
# expected: reffail
import os import os
import pty import pty
import subprocess import subprocess
......
# expected: reffail
# Test a relatively-obscure corner case of multiple inheritance: # Test a relatively-obscure corner case of multiple inheritance:
# the metaclass is normally the first base's metaclass, but type_new # the metaclass is normally the first base's metaclass, but type_new
# will specifically delegate to a later base's metaclass if it is more # will specifically delegate to a later base's metaclass if it is more
......
# expected: reffail
# Testing the basic multiple-inheritance rules and functionality: # Testing the basic multiple-inheritance rules and functionality:
class C(object): class C(object):
......
# expected: reffail
import multiprocessing import multiprocessing
# from https://docs.python.org/2/library/multiprocessing.html # from https://docs.python.org/2/library/multiprocessing.html
......
# expected: reffail
class A(object): class A(object):
def foo(self): def foo(self):
print "foo" print "foo"
......
# expected: reffail
# We could just have a file for each, but if we Do these in execs, # We could just have a file for each, but if we Do these in execs,
# we don't need separate files for each, and that makes it easier # we don't need separate files for each, and that makes it easier
# to just spam all the permutations. # to just spam all the permutations.
......
# expected: reffail
# Simple test: # Simple test:
class MyClass(object): class MyClass(object):
__a = 1 __a = 1
......
# expected: reffail
import sys import sys
import subprocess import subprocess
......
# expected: reffail
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# The Computer Language Benchmarks Game # The Computer Language Benchmarks Game
# http://shootout.alioth.debian.org/ # http://shootout.alioth.debian.org/
......
# expected: reffail
print None.__class__ print None.__class__
print type(None).__doc__, None.__doc__ print type(None).__doc__, None.__doc__
......
# expected: reffail
# Objects are allowed to resurrect other objects too, I guess # Objects are allowed to resurrect other objects too, I guess
from testing_helpers import test_gc from testing_helpers import test_gc
......
# expected: reffail
class MyException(Exception): class MyException(Exception):
pass pass
......
# expected: reffail
class C(object): class C(object):
def __delattr__(self, attr): def __delattr__(self, attr):
print "delattr", attr print "delattr", attr
......
# expected: reffail
# object.__new__ doesn't complain if __init__ is overridden: # object.__new__ doesn't complain if __init__ is overridden:
class C1(object): class C1(object):
......
# expected: reffail
o = object() o = object()
r = o.__reduce__() r = o.__reduce__()
print type(r), len(r) print type(r), len(r)
......
# expected: reffail
class C(): class C():
pass pass
......
# expected: reffail
import operator import operator
print operator.methodcaller print operator.methodcaller
......
# expected: reffail
# Simple optparse test, taken from the optparse.py docstring: # Simple optparse test, taken from the optparse.py docstring:
from optparse import OptionParser from optparse import OptionParser
......
# expected: reffail
import os.path import os.path
print type(os) print type(os)
......
# expected: reffail
# #
# currently broken: # currently broken:
......
# expected: reffail
try: try:
import __pyston__ import __pyston__
__pyston__.setOption("OSR_THRESHOLD_BASELINE", 50) __pyston__.setOption("OSR_THRESHOLD_BASELINE", 50)
......
# expected: reffail
# statcheck: '-O' in EXTRA_JIT_ARGS or 1 <= stats['num_osr_exits'] <= 5 # statcheck: '-O' in EXTRA_JIT_ARGS or 1 <= stats['num_osr_exits'] <= 5
# Try to trick the JIT into OSR'ing into an optimized version with a speculation # Try to trick the JIT into OSR'ing into an optimized version with a speculation
......
# expected: reffail
orig_ae = AssertionError orig_ae = AssertionError
class MyAssertionError(Exception): class MyAssertionError(Exception):
......
# expected: reffail
import os import os
import test_package import test_package
......
# expected: reffail
# I really don't understand all the intricacies of unicode parsing, but apparently in addition to # I really don't understand all the intricacies of unicode parsing, but apparently in addition to
# Python-specific coding lines, you can put a unicode byte order mark to signify that the text # Python-specific coding lines, you can put a unicode byte order mark to signify that the text
# is encoded. # is encoded.
......
# expected: reffail
import pickle import pickle
l = [[], (123,)] l = [[], (123,)]
......
# expected: reffail
import time import time
def pidigits(length): def pidigits(length):
......
# expected: reffail
import platform import platform
print type(platform.python_implementation()) print type(platform.python_implementation())
......
# expected: reffail
def f(a): def f(a):
print a print a
......
# expected: reffail
# This is the same as print.py, but using print as a function # This is the same as print.py, but using print as a function
# I guess print() as a function doesn't use the softspace technique. # I guess print() as a function doesn't use the softspace technique.
......
# expected: reffail
# I think pypa has an issue parsing decorator expressions if they aren't simple names # I think pypa has an issue parsing decorator expressions if they aren't simple names
# https://github.com/vinzenz/libpypa/issues/15 # https://github.com/vinzenz/libpypa/issues/15
......
# expected: reffail
# run_args: -n # run_args: -n
# statcheck: noninit_count('slowpath_getattr') <= 25 # statcheck: noninit_count('slowpath_getattr') <= 25
......
# expected: reffail
import pwd import pwd
import os import os
print pwd.getpwuid(os.getuid())[5] == os.environ["HOME"] print pwd.getpwuid(os.getuid())[5] == os.environ["HOME"]
# expected: reffail
# skip-if: '-x' in EXTRA_JIT_ARGS # skip-if: '-x' in EXTRA_JIT_ARGS
# - too slow # - too slow
......
# expected: reffail
print 'basic test' print 'basic test'
class C(object): class C(object):
__slots__ = ['a', 'b', '__private_var'] __slots__ = ['a', 'b', '__private_var']
......
# expected: reffail
# two-argument `raise' statements where second argument is itself an exception # two-argument `raise' statements where second argument is itself an exception
class A(Exception): pass class A(Exception): pass
class B(Exception): pass class B(Exception): pass
......
# expected: reffail
import random import random
print type(random.random()) print type(random.random())
# expected: reffail
import operator import operator
print reduce(operator.add, range(50)) print reduce(operator.add, range(50))
......
# expected: reffail
# Random regression test from implementing refcounting: # Random regression test from implementing refcounting:
def f(): def f():
......
# expected: reffail
# Not sure if these are important or not: # Not sure if these are important or not:
p = property(1, 2, 3) p = property(1, 2, 3)
......
# expected: reffail
import relative_import4_pkg import relative_import4_pkg
# expected: reffail
import os, sys import os, sys
def delete_file(name): def delete_file(name):
......
# expected: reffail
a=1 a=1
try: try:
a.b a.b
......
# expected: reffail
import resource import resource
for k in sorted(dir(resource)): for k in sorted(dir(resource)):
......
# expected: reffail
print list(reversed("hello")) print list(reversed("hello"))
print list(reversed("")) print list(reversed(""))
......
# expected: reffail
import gc import gc
import select import select
......
# expected: reffail
# Objects are iterable if they just implement __getitem__: # Objects are iterable if they just implement __getitem__:
class C(object): class C(object):
......
# expected: reffail
class C(object): class C(object):
def __init__(self): def __init__(self):
self.t = set([self]) self.t = set([self])
......
# expected: reffail
s1 = {1} s1 = {1}
def sorted(s): def sorted(s):
......
# expected: reffail
class MyDescr(object): class MyDescr(object):
def __set__(self, inst, val): def __set__(self, inst, val):
print type(self), type(inst), val print type(self), type(inst), val
......
# expected: reffail
# this file is adapted from dictcomp.py # this file is adapted from dictcomp.py
def set2str(s): def set2str(s):
# set isn't guaranteed to keep things in sorted order (although in CPython it does AFAICT) # set isn't guaranteed to keep things in sorted order (although in CPython it does AFAICT)
......
# expected: reffail
import signal import signal
for k in sorted(dir(signal)): for k in sorted(dir(signal)):
......
# expected: reffail
class Indexable(object): class Indexable(object):
def __getitem__(self, idx): def __getitem__(self, idx):
print "called getitem on object", idx print "called getitem on object", idx
......
# expected: reffail
import socket import socket
s = socket.socket() s = socket.socket()
......
# expected: fail
import sys import sys
old_stdout = sys.stdout old_stdout = sys.stdout
......
# expected: reffail
def show(obj): def show(obj):
print obj.__class__ print obj.__class__
for b in obj.__class__.__mro__: for b in obj.__class__.__mro__:
......
# expected: reffail
import os import os
try: try:
os.unlink('example.db') os.unlink('example.db')
......
# expected: reffail
import sre_compile import sre_compile
import sre_constants import sre_constants
......
# expected: reffail
import ssl import ssl
import socket import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
......
# expected: reffail
# The use of c makes sure a closure gets passed through all 4 functions. # The use of c makes sure a closure gets passed through all 4 functions.
# The use of a in g makes sure that a is in f's closure. # The use of a in g makes sure that a is in f's closure.
# The a in j should refer to the a in h, thus throwing an exception since # The a in j should refer to the a in h, thus throwing an exception since
......
# expected: reffail
class C(object): class C(object):
i = 0 i = 0
def next(self): def next(self):
......
# expected: reffail
def test(string, encoding): def test(string, encoding):
s = string.encode(encoding) s = string.encode(encoding)
print encoding, s print encoding, s
......
# expected: reffail
print "-".join(["hello", "world"]) print "-".join(["hello", "world"])
print "-".join(("hello", "world")) print "-".join(("hello", "world"))
......
# expected: reffail
# Testing capitalize/title methods. # Testing capitalize/title methods.
def test(s): def test(s):
......
# expected: reffail
import strop import strop
print repr(strop.whitespace) print repr(strop.whitespace)
......
# expected: reffail
import struct import struct
s = struct.pack("II", 1, 1234) s = struct.pack("II", 1, 1234)
print repr(s) print repr(s)
......
# expected: reffail
class CustomInt(int): class CustomInt(int):
pass pass
......
# expected: reffail
from abc import ABCMeta from abc import ABCMeta
class SubClassHook: class SubClassHook:
......
# expected: reffail
import subprocess import subprocess
subprocess.check_call(["true"]) subprocess.check_call(["true"])
......
# expected: reffail
class B(object): class B(object):
def __new__(cls, arg1): def __new__(cls, arg1):
print "B.__new__", arg1 print "B.__new__", arg1
......
# expected: reffail
# this test is a modfied version of a testcase inside test_descr # this test is a modfied version of a testcase inside test_descr
class C: class C:
......
# expected: reffail
import os import os
import sys import sys
......
# expected: reffail
# this is copied out of cpythons test_sys.py and adopted to use assert stmts # this is copied out of cpythons test_sys.py and adopted to use assert stmts
import sys import sys
import thread import thread
......
# expected: reffail
# should_error # should_error
# Different ways of nesting exceptions # Different ways of nesting exceptions
......
# expected: reffail
""" """
Frame Hack Recipe #1: Ruby-style string interpolation (version 1) Frame Hack Recipe #1: Ruby-style string interpolation (version 1)
""" """
......
# expected: reffail
import sys import sys
def f(): def f():
var = 42 var = 42
......
# expected: reffail
# PEP-302 import hook test # PEP-302 import hook test
import sys import sys
......
# expected: reffail
import sys_modules_replacement_target import sys_modules_replacement_target
print hasattr(sys_modules_replacement_target, "path") print hasattr(sys_modules_replacement_target, "path")
# expected: reffail
# Not sure how important or necessary this behavior is, but # Not sure how important or necessary this behavior is, but
# CPython's behavior around sys.modules seems to be that it saves # CPython's behavior around sys.modules seems to be that it saves
# an internal reference to the object, so if you set sys.modules # an internal reference to the object, so if you set sys.modules
......
# expected: reffail
import sys import sys
import os.path import os.path
......
# expected: reffail
import os import os
import tempfile import tempfile
......
# expected: reffail
import termios, sys import termios, sys
fd = sys.stdout.fileno() fd = sys.stdout.fileno()
try: try:
......
# expected: reffail
assert chr(0) == '\x00' assert chr(0) == '\x00'
......
# expected: reffail
# This is a copy of cpythons test with the recursive repr test disabled # This is a copy of cpythons test with the recursive repr test disabled
# remove this test when we can pass cpythons test # remove this test when we can pass cpythons test
......
# expected: reffail
# This file isn't really meant to be run as a test, though it won't really # This file isn't really meant to be run as a test, though it won't really
# make a difference. # make a difference.
......
# expected: reffail
from thread import start_new_thread from thread import start_new_thread
import time import time
......
# expected: reffail
# skip-if: '-n' in EXTRA_JIT_ARGS or '-O' in EXTRA_JIT_ARGS # skip-if: '-n' in EXTRA_JIT_ARGS or '-O' in EXTRA_JIT_ARGS
# Make sure that we can fork from a threaded environment # Make sure that we can fork from a threaded environment
......
# expected: reffail
from thread import start_new_thread from thread import start_new_thread
import time import time
......
# expected: reffail
# Make sure we can spawn a bunch of threads # Make sure we can spawn a bunch of threads
import threading import threading
......
# expected: reffail
from thread import start_new_thread, allocate_lock, _count from thread import start_new_thread, allocate_lock, _count
import time import time
......
# expected: reffail
import gc import gc
import threading import threading
......
# expected: reffail
import sys import sys
import traceback import traceback
......
# expected: reffail
# A test of both the tracebacks we generate and the traceback module # A test of both the tracebacks we generate and the traceback module
# #
# (We keep fixing tracebacks in one case to break them in another, so it's time for a test.) # (We keep fixing tracebacks in one case to break them in another, so it's time for a test.)
......
# expected: reffail
import sys, traceback import sys, traceback
def lumberjack(): def lumberjack():
......
# expected: reffail
import math import math
def type_trunc(type, arg): def type_trunc(type, arg):
......
# expected: reffail
# we have one test at global scope, another at local. # we have one test at global scope, another at local.
# they behave differently in codegen; there have been points at which either was bugged when the other was not. # they behave differently in codegen; there have been points at which either was bugged when the other was not.
try: try:
......
# expected: reffail
def f(): def f():
try: try:
def foo(): return 0 def foo(): return 0
......
# expected: reffail
def f(): def f():
try: try:
# Looks like this returns from the function, but it needs to go to the finally block # Looks like this returns from the function, but it needs to go to the finally block
......
# expected: reffail
# try-finally support # try-finally support
import sys import sys
......
# expected: reffail
def f(): def f():
print (1,2,3)[-1] print (1,2,3)[-1]
f() f()
......
# expected: reffail
d = {} d = {}
for i in xrange(1000): for i in xrange(1000):
d[i] = i ** 2 d[i] = i ** 2
......
# expected: reffail
# should_error # should_error
# Int not iterable: # Int not iterable:
a, b, c = 1 a, b, c = 1
# expected: reffail
# Some parsing tests: # Some parsing tests:
print ((1, 2),) print ((1, 2),)
print (1, 2, 3) print (1, 2, 3)
......
# expected: reffail
# Regression test: make sure that we can handle various kinds of written type errors. # Regression test: make sure that we can handle various kinds of written type errors.
# ex if we can prove that an expression would throw an error due to type issues, we should # ex if we can prove that an expression would throw an error due to type issues, we should
# still compile and run the function just fine. # still compile and run the function just fine.
......
# expected: reffail
import slots_test import slots_test
HEAPTYPE = 1<<9 HEAPTYPE = 1<<9
......
# expected: reffail
def f(x): def f(x):
print x, not x, ~x, +x, -x print x, not x, ~x, +x, -x
......
# expected: reffail
print repr(unicode()) print repr(unicode())
print repr(unicode('hello world')) print repr(unicode('hello world'))
print unicode('hello world') print unicode('hello world')
......
# expected: reffail
# Test the behavior of tuple unpacking in the face of exceptions being thrown at certain points. # Test the behavior of tuple unpacking in the face of exceptions being thrown at certain points.
# - If an exception gets thrown in the "unpack to a given size" part, none of the targets get set # - If an exception gets thrown in the "unpack to a given size" part, none of the targets get set
# - If setting a target throws an exception, then the previous targets had been set, but not the future ones # - If setting a target throws an exception, then the previous targets had been set, but not the future ones
......
# expected: reffail
import urlparse import urlparse
print urlparse.urlparse("http://www.dropbox.com") print urlparse.urlparse("http://www.dropbox.com")
# expected: reffail
import uuid import uuid
# Hack to get the test passing until we support CTypes. # Hack to get the test passing until we support CTypes.
......
# expected: reffail
import sys import sys
def f(): def f():
# By the time of the f_locals call, x will only be alive because # By the time of the f_locals call, x will only be alive because
......
# expected: reffail
import warnings import warnings
import _warnings import _warnings
......
# expected: reffail
from weakref import WeakKeyDictionary, WeakValueDictionary from weakref import WeakKeyDictionary, WeakValueDictionary
class S(object): class S(object):
......
# expected: reffail
import weakref import weakref
import gc import gc
......
# expected: reffail
import weakref import weakref
def doStuff(): def doStuff():
......
# expected: reffail
# test to ensure that weakref callbacks and finalizers get called in the # test to ensure that weakref callbacks and finalizers get called in the
# right order # right order
......
# expected: reffail
import weakref import weakref
from testing_helpers import test_gc from testing_helpers import test_gc
......
# expected: reffail
# Make sure we can subclass from weakref.ref, since the weakref module itself does this # Make sure we can subclass from weakref.ref, since the weakref module itself does this
from weakref import ref from weakref import ref
......
# expected: reffail
import weakref import weakref
import array import array
import re import re
......
# expected: reffail
# Make sure we can support weakrefs on extension objects. # Make sure we can support weakrefs on extension objects.
# The _sre.SRE_Pattern type is one of the few builtin types that supports weakrefs natively. # The _sre.SRE_Pattern type is one of the few builtin types that supports weakrefs natively.
......
# expected: reffail
class Mgr(object): class Mgr(object):
def __init__(self): print 'Mgr.__init__()' def __init__(self): print 'Mgr.__init__()'
......
# expected: reffail
class C(object): class C(object):
pass pass
print C.__str__ is object.__str__ print C.__str__ is object.__str__
......
# expected: reffail
import sys, os import sys, os
# this zip contains two pkgs: test1 and test2 # this zip contains two pkgs: test1 and test2
......
# expected: reffail
import os import os
import zipimport import zipimport
......
...@@ -207,6 +207,9 @@ def get_test_options(fn, check_stats, run_memcheck): ...@@ -207,6 +207,9 @@ def get_test_options(fn, check_stats, run_memcheck):
elif l.startswith("# no-collect-stats"): elif l.startswith("# no-collect-stats"):
opts.collect_stats = False opts.collect_stats = False
if opts.expected == "reffail":
opts.expected = "fail"
if not opts.skip: if not opts.skip:
# consider other reasons for skipping file # consider other reasons for skipping file
if SKIP_FAILING_TESTS and opts.expected == 'fail': if SKIP_FAILING_TESTS and opts.expected == 'fail':
......
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