From c1c860f633ec87a4951f4681758db9c8f95d4f1a Mon Sep 17 00:00:00 2001 From: Armin Rigo Date: Sun, 31 Aug 2014 12:33:37 +0200 Subject: Accept a plain string and don't try to decode it to unicode and then re-encode it to utf-8. It may not work. --- py/_code/code.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'py') diff --git a/py/_code/code.py b/py/_code/code.py index aa60da8017..0e632992b2 100644 --- a/py/_code/code.py +++ b/py/_code/code.py @@ -588,7 +588,7 @@ class FormattedExcinfo(object): class TerminalRepr: def __str__(self): s = self.__unicode__() - if sys.version_info[0] < 3: + if sys.version_info[0] < 3 and isinstance(s, unicode): s = s.encode('utf-8') return s -- cgit v1.2.3-65-gdbad From 25312bc72336c17bf7ead71e8f8ce70633629f29 Mon Sep 17 00:00:00 2001 From: Armin Rigo Date: Mon, 1 Sep 2014 08:56:24 +0200 Subject: Reapply fix c6f52c21fe7e --- py/_path/local.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'py') diff --git a/py/_path/local.py b/py/_path/local.py index af09f43014..354e8b4a11 100644 --- a/py/_path/local.py +++ b/py/_path/local.py @@ -750,7 +750,8 @@ class LocalPath(FSBase): mkdtemp = classmethod(mkdtemp) def make_numbered_dir(cls, prefix='session-', rootdir=None, keep=3, - lock_timeout = 172800): # two days + lock_timeout = 172800, # two days + min_timeout = 300): # five minutes """ return unique directory with a number greater than the current maximum one. The number is assumed to start directly after prefix. if keep is true directories with a number less than (maxnum-keep) @@ -818,6 +819,20 @@ class LocalPath(FSBase): for path in rootdir.listdir(): num = parse_num(path) if num is not None and num <= (maxnum - keep): + if min_timeout: + # NB: doing this is needed to prevent (or reduce + # a lot the chance of) the following situation: + # 'keep+1' processes call make_numbered_dir() at + # the same time, they create dirs, but then the + # last process notices the first dir doesn't have + # (yet) a .lock in it and kills it. + try: + t1 = path.lstat().mtime + t2 = lockfile.lstat().mtime + if abs(t2-t1) < min_timeout: + continue # skip directories too recent + except py.error.Error: + continue # failure to get a time, better skip lf = path.join('.lock') try: t1 = lf.lstat().mtime -- cgit v1.2.3-65-gdbad From 69a9252d26e40945758dc6c2f471c08662c3a064 Mon Sep 17 00:00:00 2001 From: Armin Rigo Date: Mon, 1 Sep 2014 08:57:48 +0200 Subject: reapply dc81116ff4b7 --- py/_code/source.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'py') diff --git a/py/_code/source.py b/py/_code/source.py index e17bc1cd35..9903262112 100644 --- a/py/_code/source.py +++ b/py/_code/source.py @@ -416,6 +416,8 @@ def getstatementrange_old(lineno, source, assertion=False): trysource = source[start:end] if trysource.isparseable(): return start, end + if end == start + 100: # XXX otherwise, it takes forever + break # XXX raise SyntaxError("no valid source range around line %d " % (lineno,)) -- cgit v1.2.3-65-gdbad From ae54ab93d638d56c8d8b3ee8330f0c25ba287a01 Mon Sep 17 00:00:00 2001 From: Armin Rigo Date: Mon, 1 Sep 2014 09:06:02 +0200 Subject: Add two README files in "py" and "_pytest". PLEASE READ THEM when updating these! --- _pytest/README-BEFORE-UPDATING | 17 +++++++++++++++++ py/README-BEFORE-UPDATING | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 _pytest/README-BEFORE-UPDATING create mode 100644 py/README-BEFORE-UPDATING (limited to 'py') diff --git a/_pytest/README-BEFORE-UPDATING b/_pytest/README-BEFORE-UPDATING new file mode 100644 index 0000000000..10b95ee2a6 --- /dev/null +++ b/_pytest/README-BEFORE-UPDATING @@ -0,0 +1,17 @@ +This is PyPy's code of the pytest lib. We don't expect to upgrade it +very often, but once we do: + + WARNING! + + WE HAVE MADE A FEW TWEAKS HERE! + +Please be sure that you don't just copy the newer version from +upstream without checking the few changes that we did. This +can be done like this: + + cd + hg log . -v | less + +then search for all " _pytest/" in that list to know which are the +relevant checkins. (Look for the checkins that only edit one +or two files in this directory.) diff --git a/py/README-BEFORE-UPDATING b/py/README-BEFORE-UPDATING new file mode 100644 index 0000000000..e83bad622c --- /dev/null +++ b/py/README-BEFORE-UPDATING @@ -0,0 +1,17 @@ +This is PyPy's code of the py lib. We don't expect to upgrade it +very often, but once we do: + + WARNING! + + WE HAVE MADE A FEW TWEAKS HERE! + +Please be sure that you don't just copy the newer version from +upstream without checking the few changes that we did. This +can be done like this: + + cd + hg log . -v | less + +then search for all " py/" in that list to know which are the +relevant checkins. (Look for the checkins that only edit one +or two files in this directory.) -- cgit v1.2.3-65-gdbad From 1faa591c77b90abd5d1095976e3db709afaa9879 Mon Sep 17 00:00:00 2001 From: Ronan Lamy Date: Mon, 1 Sep 2014 18:20:09 +0100 Subject: Backout 44c3924 : no need to patch dead code --- py/_code/source.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'py') diff --git a/py/_code/source.py b/py/_code/source.py index 9903262112..e17bc1cd35 100644 --- a/py/_code/source.py +++ b/py/_code/source.py @@ -416,8 +416,6 @@ def getstatementrange_old(lineno, source, assertion=False): trysource = source[start:end] if trysource.isparseable(): return start, end - if end == start + 100: # XXX otherwise, it takes forever - break # XXX raise SyntaxError("no valid source range around line %d " % (lineno,)) -- cgit v1.2.3-65-gdbad